Commit f4aa6f84 authored by Sylvain Berfini's avatar Sylvain Berfini

Added userid field to account form

parent d6d482a0
......@@ -320,6 +320,7 @@ namespace Linphone.Model
{
#region Constants settings names
private const string UsernameKeyName = "Username";
private const string UserIdKeyName = "UserId";
private const string PasswordKeyName = "Password";
private const string DomainKeyName = "Domain";
private const string ProxyKeyName = "Proxy";
......@@ -334,6 +335,7 @@ namespace Linphone.Model
public void Load()
{
dict[UsernameKeyName] = "";
dict[UserIdKeyName] = "";
dict[DomainKeyName] = "";
dict[ProxyKeyName] = "";
dict[PasswordKeyName] = "";
......@@ -368,7 +370,9 @@ namespace Linphone.Model
var authInfos = LinphoneManager.Instance.LinphoneCore.GetAuthInfos();
if (authInfos.Count > 0)
{
dict[PasswordKeyName] = ((LinphoneAuthInfo)authInfos[0]).GetPassword();
LinphoneAuthInfo info = ((LinphoneAuthInfo)authInfos[0]);
dict[PasswordKeyName] = info.GetPassword();
dict[UserIdKeyName] = info.GetUserId();
}
dict[DisplayNameKeyName] = address.GetDisplayName();
}
......@@ -380,7 +384,7 @@ namespace Linphone.Model
/// </summary>
public void Save()
{
bool AccountChanged = ValueChanged(UsernameKeyName) || ValueChanged(PasswordKeyName) || ValueChanged(DomainKeyName)
bool AccountChanged = ValueChanged(UsernameKeyName) || ValueChanged(UserIdKeyName) || ValueChanged(PasswordKeyName) || ValueChanged(DomainKeyName)
|| ValueChanged(ProxyKeyName) || ValueChanged(OutboundProxyKeyName) || ValueChanged(DisplayNameKeyName);
if (AccountChanged)
......@@ -407,6 +411,7 @@ namespace Linphone.Model
}
String username = GetNew(UsernameKeyName);
String userid = GetNew(UserIdKeyName);
String password = GetNew(PasswordKeyName);
String domain = GetNew(DomainKeyName);
String proxy = GetNew(ProxyKeyName);
......@@ -450,7 +455,7 @@ namespace Linphone.Model
}
// Can't set string to null: http://stackoverflow.com/questions/12980915/exception-when-trying-to-read-null-string-in-c-sharp-winrt-component-from-winjs
var auth = lc.CreateAuthInfo(username, "", password, "", "", domain);
var auth = lc.CreateAuthInfo(username, userid, password, "", "", domain);
lc.AddAuthInfo(auth);
lc.AddProxyConfig(cfg);
......@@ -479,6 +484,21 @@ namespace Linphone.Model
}
}
/// <summary>
/// SIP Account userid setting (String).
/// </summary>
public string UserId
{
get
{
return Get(UserIdKeyName);
}
set
{
Set(UserIdKeyName, value);
}
}
/// <summary>
/// SIP account password setting (String).
/// </summary>
......
This diff is collapsed.
......@@ -534,4 +534,7 @@ Do you want to report it to the developpers ? It will help fix it faster.</value
<data name="SendEmail" xml:space="preserve">
<value>Send by email</value>
</data>
<data name="SIPUserId" xml:space="preserve">
<value>Auth userid</value>
</data>
</root>
\ No newline at end of file
......@@ -38,6 +38,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Grid.Row="0">
......@@ -56,7 +57,23 @@
</TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="1" Margin="0,10,0,0">
<StackPanel Orientation="Vertical" Grid.Row="1">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.SIPUserId, Source={StaticResource LocalizedStrings}}">
</TextBlock>
<TextBox
x:Name="UserId"
KeyDown="UserId_KeyDown">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="EmailUserName" />
</InputScope>
</TextBox.InputScope>
</TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="2" Margin="0,10,0,0">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.SIPPassword, Source={StaticResource LocalizedStrings}}">
......@@ -67,7 +84,7 @@
</PasswordBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="2" Margin="0,10,0,0">
<StackPanel Orientation="Vertical" Grid.Row="3" Margin="0,10,0,0">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.SIPDomain, Source={StaticResource LocalizedStrings}}">
......@@ -83,7 +100,7 @@
</TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="3" Margin="0,10,0,0">
<StackPanel Orientation="Vertical" Grid.Row="4" Margin="0,10,0,0">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.SIPProxy, Source={StaticResource LocalizedStrings}}">
......@@ -94,14 +111,14 @@
</TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="4" Margin="0,10,0,0">
<StackPanel Orientation="Vertical" Grid.Row="5" Margin="0,10,0,0">
<toolkit:ToggleSwitch
x:Name="OutboundProxy"
Header="{Binding Path=LocalizedResources.SIPOutboundProxy, Source={StaticResource LocalizedStrings}}">
</toolkit:ToggleSwitch>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="5" Margin="0,10,0,0">
<StackPanel Orientation="Vertical" Grid.Row="6" Margin="0,10,0,0">
<TextBlock
Margin="10,0,0,0"
Text="{Binding Path=LocalizedResources.DisplayName, Source={StaticResource LocalizedStrings}}">
......
......@@ -27,6 +27,7 @@ namespace Linphone.Views
_settings.Load();
Username.Text = _settings.Username;
UserId.Text = _settings.UserId;
Password.Password = _settings.Password;
Domain.Text = _settings.Domain;
Proxy.Text = _settings.Proxy;
......@@ -61,6 +62,7 @@ namespace Linphone.Views
}
_settings.Username = Username.Text;
_settings.UserId = UserId.Text;
_settings.Password = Password.Password;
_settings.Domain = Domain.Text;
_settings.Proxy = Proxy.Text;
......@@ -87,6 +89,12 @@ namespace Linphone.Views
}
private void Username_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == Key.Enter)
UserId.Focus();
}
private void UserId_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == Key.Enter)
Password.Focus();
......
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