Commit 387d57b8 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added SIP account settings + few interface changes

parent 482b05b0
......@@ -81,14 +81,6 @@ void Globals::StartServer(const Platform::Array<Platform::String^>^ outOfProcSer
this->started = true;
}
void Globals::DoPeriodicKeepAlive()
{
// Make sure only one API call is in progress at a time
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
// TODO: Do stuff here - refresh tokens, get new certs from server, etc.
}
unsigned int Globals::GetCurrentProcessId()
{
return ::GetCurrentProcessId();
......
......@@ -18,9 +18,6 @@ namespace Linphone
// Start the out-of-process WinRT server, so that the UI process can instantiate WinRT objects in this process.
void StartServer(const Platform::Array<Platform::String^>^ outOfProcServerClassNames);
// Do some app-specific periodic tasks, to let the remote server know that this endpoint is still alive.
void DoPeriodicKeepAlive();
// Get the process id of the current process
static unsigned int GetCurrentProcessId();
......
......@@ -64,9 +64,6 @@ namespace Linphone
private void Application_Launching(object sender, LaunchingEventArgs e)
{
Debug.WriteLine("[Linphone] Launching");
// Call this method below at the beginning of this handler,
// to let the background process that the UI is entering the foreground.
LinphoneManager.Instance.ConnectBackgroundProcessToInterface();
}
......@@ -75,22 +72,23 @@ namespace Linphone
private void Application_Activated(object sender, ActivatedEventArgs e)
{
Debug.WriteLine("[Linphone] Activated");
// Call this method below at the beginning of this handler,
// to let the background process that the UI is entering the foreground.
LinphoneManager.Instance.ConnectBackgroundProcessToInterface();
}
// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
{
Debug.WriteLine("[Linphone] Deactivated");
LinphoneManager.Instance.DisconnectBackgroundProcessFromInterface();
}
// Code to execute when the application is closing (eg, user hit Back)
// This code will not execute when the application is deactivated
private void Application_Closing(object sender, ClosingEventArgs e)
{
{
Debug.WriteLine("[Linphone] Closing");
LinphoneManager.Instance.DisconnectBackgroundProcessFromInterface();
}
// Code to execute if a navigation fails
......
This diff is collapsed.
......@@ -17,6 +17,8 @@ namespace Linphone.Model
const string UsernameKeyName = "Username";
const string PasswordKeyName = "Password";
const string DomainKeyName = "Domain";
const string ProxyKeyName = "Proxy";
const string OutboundProxyKeyName = "OutboundProxy";
const string DebugSettingKeyName = "Debug";
const string TransportSettingKeyName = "Transport";
......@@ -109,6 +111,7 @@ namespace Linphone.Model
settings.Save();
}
#region SIP Account
public string Username
{
get
......@@ -154,6 +157,37 @@ namespace Linphone.Model
}
}
public string Proxy
{
get
{
return GetValueOrDefault<string>(ProxyKeyName, "");
}
set
{
if (AddOrUpdateValue(ProxyKeyName, value))
{
Save();
}
}
}
public bool? OutboundProxy
{
get
{
return GetValueOrDefault<bool?>(OutboundProxyKeyName, false);
}
set
{
if (AddOrUpdateValue(OutboundProxyKeyName, value))
{
Save();
}
}
}
#endregion
public bool? DebugEnabled
{
get
......
......@@ -84,6 +84,15 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to SIP account.
/// </summary>
public static string AccountMenu {
get {
return ResourceManager.GetString("AccountMenu", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Number or address.
/// </summary>
......@@ -282,6 +291,15 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Network.
/// </summary>
public static string NetworkMenu {
get {
return ResourceManager.GetString("NetworkMenu", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PCMA.
/// </summary>
......@@ -354,6 +372,51 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Domain.
/// </summary>
public static string SIPDomain {
get {
return ResourceManager.GetString("SIPDomain", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Outbound proxy.
/// </summary>
public static string SIPOutboundProxy {
get {
return ResourceManager.GetString("SIPOutboundProxy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password.
/// </summary>
public static string SIPPassword {
get {
return ResourceManager.GetString("SIPPassword", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Proxy.
/// </summary>
public static string SIPProxy {
get {
return ResourceManager.GetString("SIPProxy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Username.
/// </summary>
public static string SIPUsername {
get {
return ResourceManager.GetString("SIPUsername", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to speaker.
/// </summary>
......
......@@ -263,4 +263,25 @@ http://www.linphone.org/m/help
<data name="TunnelServer" xml:space="preserve">
<value>Tunnel server</value>
</data>
<data name="NetworkMenu" xml:space="preserve">
<value>Network</value>
</data>
<data name="AccountMenu" xml:space="preserve">
<value>SIP account</value>
</data>
<data name="SIPDomain" xml:space="preserve">
<value>Domain</value>
</data>
<data name="SIPOutboundProxy" xml:space="preserve">
<value>Outbound proxy</value>
</data>
<data name="SIPPassword" xml:space="preserve">
<value>Password</value>
</data>
<data name="SIPProxy" xml:space="preserve">
<value>Proxy</value>
</data>
<data name="SIPUsername" xml:space="preserve">
<value>Username</value>
</data>
</root>
\ No newline at end of file
<phone:PhoneApplicationPage
x:Class="Linphone.Views.AccountSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,5,0,0">
<!--<TextBlock Foreground="Black" Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>-->
<TextBlock Text="{Binding Path=LocalizedResources.AccountMenu, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<ScrollViewer x:Name="ContentPanel" Grid.Row="1">
<Grid Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Grid.Row="0">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.SIPUsername, Source={StaticResource LocalizedStrings}}">
</TextBlock>
<TextBox
x:Name="Username">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="EmailUserName" />
</InputScope>
</TextBox.InputScope>
</TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="1" Margin="0,10,0,0">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.SIPPassword, Source={StaticResource LocalizedStrings}}">
</TextBlock>
<PasswordBox
x:Name="Password">
</PasswordBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="2" Margin="0,10,0,0">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.SIPDomain, Source={StaticResource LocalizedStrings}}">
</TextBlock>
<TextBox
x:Name="Domain">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Url" />
</InputScope>
</TextBox.InputScope>
</TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="3" Margin="0,10,0,0">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.SIPProxy, Source={StaticResource LocalizedStrings}}">
</TextBlock>
<TextBox
x:Name="Proxy">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Url" />
</InputScope>
</TextBox.InputScope>
</TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="4" Margin="0,10,0,0">
<toolkit:ToggleSwitch
x:Name="OutboundProxy"
Header="{Binding Path=LocalizedResources.SIPOutboundProxy, Source={StaticResource LocalizedStrings}}">
</toolkit:ToggleSwitch>
</StackPanel>
</Grid>
</ScrollViewer>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Linphone.Resources;
using Linphone.Model;
namespace Linphone.Views
{
public partial class AccountSettings : PhoneApplicationPage
{
private SettingsManager _appSettings = new SettingsManager();
public AccountSettings()
{
InitializeComponent();
BuildLocalizedApplicationBar();
Username.Text = _appSettings.Username;
Password.Password = _appSettings.Password;
Domain.Text = _appSettings.Domain;
Proxy.Text = _appSettings.Proxy;
OutboundProxy.IsChecked = _appSettings.OutboundProxy;
}
private void cancel_Click_1(object sender, EventArgs e)
{
NavigationService.GoBack();
}
private void save_Click_1(object sender, EventArgs e)
{
_appSettings.Username = Username.Text;
_appSettings.Password = Password.Password;
_appSettings.Domain = Domain.Text;
_appSettings.Proxy = Domain.Text;
_appSettings.OutboundProxy = OutboundProxy.IsChecked;
NavigationService.GoBack();
}
private void BuildLocalizedApplicationBar()
{
ApplicationBar = new ApplicationBar();
ApplicationBarIconButton appBarSave = new ApplicationBarIconButton(new Uri("/Assets/AppBar/save.png", UriKind.Relative));
appBarSave.Text = AppResources.SaveSettings;
ApplicationBar.Buttons.Add(appBarSave);
appBarSave.Click += save_Click_1;
ApplicationBarIconButton appBarCancel = new ApplicationBarIconButton(new Uri("/Assets/AppBar/cancel.png", UriKind.Relative));
appBarCancel.Text = AppResources.CancelChanges;
ApplicationBar.Buttons.Add(appBarCancel);
appBarCancel.Click += cancel_Click_1;
}
}
}
\ No newline at end of file
......@@ -18,42 +18,52 @@
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<phone:Pivot Title="{Binding Path=LocalizedResources.AdvancedSettingsMenu, Source={StaticResource LocalizedStrings}}">
<!--Pivot item one-->
<phone:PivotItem Header="{Binding Path=LocalizedResources.TunnelMenu, Source={StaticResource LocalizedStrings}}">
<StackPanel Orientation="Vertical">
<TextBlock
Text="{Binding Path=LocalizedResources.TunnelServer, Source={StaticResource LocalizedStrings}}" />
<TextBox
x:Name="tunnelServer"
IsEnabled="True"
IsReadOnly="False">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Url" />
</InputScope>
</TextBox.InputScope>
</TextBox>
<phone:PivotItem Header="{Binding Path=LocalizedResources.NetworkMenu, Source={StaticResource LocalizedStrings}}">
<ScrollViewer>
<StackPanel Orientation="Vertical">
<toolkit:ListPicker
Grid.Row="1"
x:Name="Transport"
Header="{Binding Path=LocalizedResources.TransportSetting, Source={StaticResource LocalizedStrings}}">
</toolkit:ListPicker>
<TextBlock
Text="{Binding Path=LocalizedResources.TunnelPort, Source={StaticResource LocalizedStrings}}" />
<toolkit:ListPicker
Margin="12,20,0,0"
x:Name="tunnelMode"
Header="{Binding Path=LocalizedResources.TunnelMode, Source={StaticResource LocalizedStrings}}">
</toolkit:ListPicker>
<TextBlock
Margin="12,20,0,0"
Text="{Binding Path=LocalizedResources.TunnelServer, Source={StaticResource LocalizedStrings}}" />
<TextBox
x:Name="tunnelPort"
IsEnabled="True"
IsReadOnly="False">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Number" />
</InputScope>
</TextBox.InputScope>
</TextBox>
<TextBox
x:Name="tunnelServer"
IsEnabled="True"
IsReadOnly="False">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Url" />
</InputScope>
</TextBox.InputScope>
</TextBox>
<toolkit:ListPicker
x:Name="tunnelMode"
Header="{Binding Path=LocalizedResources.TunnelMode, Source={StaticResource LocalizedStrings}}">
</toolkit:ListPicker>
</StackPanel>
<TextBlock
Margin="12,0,0,0"
Text="{Binding Path=LocalizedResources.TunnelPort, Source={StaticResource LocalizedStrings}}" />
<TextBox
x:Name="tunnelPort"
IsEnabled="True"
IsReadOnly="False">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Number" />
</InputScope>
</TextBox.InputScope>
</TextBox>
</StackPanel>
</ScrollViewer>
</phone:PivotItem>
<!--Pivot item two-->
......
......@@ -34,6 +34,14 @@ namespace Linphone.Views
tunnelMode.SelectedItem = _appSettings.TunnelMode;
tunnelPort.Text = _appSettings.TunnelPort;
tunnelServer.Text = _appSettings.TunnelServer;
List<string> transports = new List<string>
{
AppResources.TransportUDP,
AppResources.TransportTCP
};
Transport.ItemsSource = transports;
Transport.SelectedItem = _appSettings.Transport;
}
private void cancel_Click_1(object sender, EventArgs e)
......@@ -47,6 +55,7 @@ namespace Linphone.Views
_appSettings.TunnelMode = tunnelMode.SelectedItem.ToString();
_appSettings.TunnelServer = tunnelServer.Text;
_appSettings.TunnelPort = tunnelPort.Text;
_appSettings.Transport = Transport.SelectedItem.ToString();
NavigationService.GoBack();
}
......
......@@ -28,48 +28,51 @@
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<ScrollViewer x:Name="ContentPanel" Grid.Row="1">
<Grid Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<toolkit:ToggleSwitch
Grid.Row="0"
x:Name="Debug"
Header="{Binding Path=LocalizedResources.DebugSetting, Source={StaticResource LocalizedStrings}}">
</toolkit:ToggleSwitch>
<toolkit:ToggleSwitch
Grid.Row="0"
x:Name="Debug"
Header="{Binding Path=LocalizedResources.DebugSetting, Source={StaticResource LocalizedStrings}}">
</toolkit:ToggleSwitch>
<Button
Grid.Row="1"
x:Name="Account"
Click="account_Click_1"
Margin="0,30,0,0"
Content="{Binding Path=LocalizedResources.AccountMenu, Source={StaticResource LocalizedStrings}}" />
<toolkit:ListPicker
Grid.Row="1"
x:Name="Transport"
Header="{Binding Path=LocalizedResources.TransportSetting, Source={StaticResource LocalizedStrings}}">
</toolkit:ListPicker>
<Button
Grid.Row="2"
x:Name="Codecs"
Click="codecs_Click_1"
Margin="0,30,0,0"
Content="{Binding Path=LocalizedResources.CodecsMenu, Source={StaticResource LocalizedStrings}}" />
<Button
Grid.Row="2"
x:Name="Codecs"
Click="codecs_Click_1"
Margin="0,30,0,0"
Content="{Binding Path=LocalizedResources.CodecsMenu, Source={StaticResource LocalizedStrings}}" />
<Button
Grid.Row="3"
x:Name="Advanced"
Click="advanced_Click_1"
Margin="0,30,0,0"
Content="{Binding Path=LocalizedResources.AdvancedSettingsMenu, Source={StaticResource LocalizedStrings}}" />
<Button
Grid.Row="3"
x:Name="Advanced"
Click="advanced_Click_1"
Margin="0,30,0,0"
Content="{Binding Path=LocalizedResources.AdvancedSettingsMenu, Source={StaticResource LocalizedStrings}}" />
<Button
Grid.Row="4"
Click="LockScreenSettings_Click_1"
x:Name="LockScreenSettings"
Margin="0,30,0,0"
Content="{Binding Path=LocalizedResources.LockScreenSettings, Source={StaticResource LocalizedStrings}}" />
</Grid>
<Button
Grid.Row="4"
Click="LockScreenSettings_Click_1"
x:Name="LockScreenSettings"
Margin="0,30,0,0"
Content="{Binding Path=LocalizedResources.LockScreenSettings, Source={StaticResource LocalizedStrings}}" />
</Grid>
</ScrollViewer>
</Grid>
</phone:PhoneApplicationPage>
\ No newline at end of file
......@@ -22,17 +22,6 @@ namespace Linphone.Views
{
InitializeComponent();
BuildLocalizedApplicationBar();
string tcp = AppResources.TransportTCP;
string udp = AppResources.TransportUDP;
List<string> transports = new List<string>
{
tcp,
udp
};
Transport.ItemsSource = transports;
Transport.SelectedItem = _appSettings.Transport;
Debug.IsChecked = _appSettings.DebugEnabled;
}
......@@ -44,11 +33,15 @@ namespace Linphone.Views
private void save_Click_1(object sender, EventArgs e)
{
_appSettings.DebugEnabled = Debug.IsChecked;
_appSettings.Transport = Transport.SelectedItem.ToString();
NavigationService.GoBack();
}
private void account_Click_1(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Views/AccountSettings.xaml", UriKind.RelativeOrAbsolute));
}
private void codecs_Click_1(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Views/CodecsSettings.xaml", UriKind.RelativeOrAbsolute));
......
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