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