Commit ac7ea074 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Improved status bar (and removed from every view except Dialer)

parent 8690cc2e
......@@ -40,7 +40,7 @@ namespace Linphone.Agents
this.isIncomingCallAgent = false;
Debug.WriteLine("[KeepAliveAgent] Keep Alive");
BackgroundManager.Instance.InitLinphoneCore();
//BackgroundManager.Instance.InitLinphoneCore();
}
else
{
......
......@@ -7,9 +7,10 @@
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="50" d:DesignWidth="480">
d:DesignHeight="30" d:DesignWidth="480">
<StackPanel x:Name="LayoutRoot" Background="Transparent" Orientation="Horizontal">
<Image x:Name="Status" Source="/Assets/led_disconnected.png" Stretch="UniformToFill" Margin="10,0,0,0"></Image>
<Image x:Name="StatusLed" Source="/Assets/led_disconnected.png" Height="20" Width="20" Stretch="Uniform" Margin="10,0,10,0"></Image>
<TextBlock x:Name="StatusText" FontSize="20" Text="{Binding Path=LocalizedResources.Disconnected, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</UserControl>
\ No newline at end of file
......@@ -10,6 +10,7 @@ using Microsoft.Phone.Shell;
using Linphone.Model;
using Linphone.Core;
using System.Windows.Media.Imaging;
using Linphone.Resources;
namespace Linphone.Controls
{
......@@ -24,13 +25,13 @@ namespace Linphone.Controls
public StatusBar()
{
InitializeComponent();
RefreshStatusIcon(LinphoneManager.Instance.LastKnownState);
RefreshStatus(LinphoneManager.Instance.LastKnownState);
}
/// <summary>
/// Refresh the status icon reading the default proxy config state.
/// </summary>
public void RefreshStatusIcon()
public void RefreshStatus()
{
RegistrationState state;
if (LinphoneManager.Instance.LinphoneCore.GetDefaultProxyConfig() == null)
......@@ -38,24 +39,32 @@ namespace Linphone.Controls
else
state = LinphoneManager.Instance.LinphoneCore.GetDefaultProxyConfig().GetState();
RefreshStatusIcon(state);
RefreshStatus(state);
}
/// <summary>
/// Refresh the status icon given the registration state in param.
/// </summary>
public void RefreshStatusIcon(RegistrationState state)
public void RefreshStatus(RegistrationState state)
{
Dispatcher.BeginInvoke(() =>
{
if (state == RegistrationState.RegistrationOk)
Status.Source = new BitmapImage(new Uri("/Assets/led_connected.png", UriKind.Relative));
else if (state == RegistrationState.RegistrationInProgress)
Status.Source = new BitmapImage(new Uri("/Assets/led_inprogress.png", UriKind.Relative));
else if (state == RegistrationState.RegistrationFailed)
Status.Source = new BitmapImage(new Uri("/Assets/led_error.png", UriKind.Relative));
else
Status.Source = new BitmapImage(new Uri("/Assets/led_disconnected.png", UriKind.Relative));
if (state == RegistrationState.RegistrationOk) {
StatusLed.Source = new BitmapImage(new Uri("/Assets/led_connected.png", UriKind.Relative));
StatusText.Text = AppResources.Registered;
}
else if (state == RegistrationState.RegistrationInProgress) {
StatusLed.Source = new BitmapImage(new Uri("/Assets/led_inprogress.png", UriKind.Relative));
StatusText.Text = AppResources.RegistrationInProgress;
}
else if (state == RegistrationState.RegistrationFailed) {
StatusLed.Source = new BitmapImage(new Uri("/Assets/led_error.png", UriKind.Relative));
StatusText.Text = AppResources.RegistrationFailed;
}
else {
StatusLed.Source = new BitmapImage(new Uri("/Assets/led_disconnected.png", UriKind.Relative));
StatusText.Text = AppResources.Disconnected;
}
});
}
}
......
......@@ -575,7 +575,7 @@ namespace Linphone.Model
Logger.Msg("[LinphoneManager] Registration state changed: " + state.ToString() + ", message=" + message + " for identity " + config.GetIdentity());
LastKnownState = state;
if (BasePage.StatusBar != null)
BasePage.StatusBar.RefreshStatusIcon(state);
BasePage.StatusBar.RefreshStatus(state);
});
}
......
......@@ -246,6 +246,15 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Disconnected.
/// </summary>
public static string Disconnected {
get {
return ResourceManager.GetString("Disconnected", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to G722.
/// </summary>
......@@ -354,6 +363,33 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Registered.
/// </summary>
public static string Registered {
get {
return ResourceManager.GetString("Registered", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed.
/// </summary>
public static string RegistrationFailed {
get {
return ResourceManager.GetString("RegistrationFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to In Progress.
/// </summary>
public static string RegistrationInProgress {
get {
return ResourceManager.GetString("RegistrationInProgress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to LeftToRight.
/// </summary>
......
......@@ -299,4 +299,16 @@ http://www.linphone.org/m/help
<data name="Refresh" xml:space="preserve">
<value>Refresh</value>
</data>
<data name="Disconnected" xml:space="preserve">
<value>Disconnected</value>
</data>
<data name="Registered" xml:space="preserve">
<value>Registered</value>
</data>
<data name="RegistrationFailed" xml:space="preserve">
<value>Failed</value>
</data>
<data name="RegistrationInProgress" xml:space="preserve">
<value>In Progress</value>
</data>
</root>
\ No newline at end of file
......@@ -23,8 +23,6 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:StatusBar x:Name="status" Grid.Row="0"></controls:StatusBar>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="1" Margin="12,17,0,28">
<!--<TextBlock Text="" Style="{StaticResource PhoneTextNormalStyle}"/>-->
......
......@@ -37,7 +37,6 @@ namespace Linphone.Views
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
StatusBar = status;
while (actions.Children.Count > 0)
{
......
......@@ -23,8 +23,6 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:StatusBar x:Name="status" Grid.Row="0"></controls:StatusBar>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="1" Margin="12,5,0,0">
......
......@@ -35,7 +35,6 @@ namespace Linphone.Views
protected override void OnNavigatedTo(NavigationEventArgs nee)
{
base.OnNavigatedTo(nee);
StatusBar = status;
}
private void contactsList_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
......
......@@ -23,8 +23,6 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controls:StatusBar x:Name="status" Grid.Row="0"></controls:StatusBar>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="1" Margin="12,5,0,0">
......
......@@ -38,7 +38,6 @@ namespace Linphone.Views
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
StatusBar = status;
TileManager tileManager = TileManager.Instance;
tileManager.RemoveMissedCallsTile();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment