Commit 52ec746a authored by Sylvain Berfini's avatar Sylvain Berfini

Started login view

parent 5ca8db77
......@@ -175,6 +175,9 @@
<Compile Include="Views\Dialer.xaml.cs">
<DependentUpon>Dialer.xaml</DependentUpon>
</Compile>
<Compile Include="Views\FirstLogin.xaml.cs">
<DependentUpon>FirstLogin.xaml</DependentUpon>
</Compile>
<Compile Include="Views\FullScreenPicture.xaml.cs">
<DependentUpon>FullScreenPicture.xaml</DependentUpon>
</Compile>
......@@ -363,6 +366,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\FirstLogin.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\FullScreenPicture.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18046
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
......@@ -336,6 +336,15 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Create a linphone.org account.
/// </summary>
public static string CreateAccount {
get {
return ResourceManager.GetString("CreateAccount", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Debug.
/// </summary>
......@@ -480,6 +489,15 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Username and/or Domain cannot be empty.
/// </summary>
public static string ErrorLogin {
get {
return ResourceManager.GetString("ErrorLogin", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Saving picture.
/// </summary>
......@@ -624,6 +642,15 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Use linphone.org account.
/// </summary>
public static string LinphoneLogin {
get {
return ResourceManager.GetString("LinphoneLogin", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to LockScreen settings.
/// </summary>
......@@ -633,6 +660,33 @@ namespace Linphone.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Log in.
/// </summary>
public static string Login {
get {
return ResourceManager.GetString("Login", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Loging in....
/// </summary>
public static string LoginIn {
get {
return ResourceManager.GetString("LoginIn", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connection.
/// </summary>
public static string LoginMenu {
get {
return ResourceManager.GetString("LoginMenu", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Message received.
/// </summary>
......
......@@ -485,4 +485,22 @@ http://www.linphone.org/m/help
<data name="MessageReceived" xml:space="preserve">
<value>Message received</value>
</data>
<data name="CreateAccount" xml:space="preserve">
<value>Create a linphone.org account</value>
</data>
<data name="Login" xml:space="preserve">
<value>Log in</value>
</data>
<data name="LoginIn" xml:space="preserve">
<value>Loging in...</value>
</data>
<data name="LoginMenu" xml:space="preserve">
<value>Connection</value>
</data>
<data name="ErrorLogin" xml:space="preserve">
<value>Username and/or Domain cannot be empty</value>
</data>
<data name="LinphoneLogin" xml:space="preserve">
<value>Use linphone.org account</value>
</data>
</root>
\ No newline at end of file
<linphone:BasePage
x:Class="Linphone.Views.FirstLogin"
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"
xmlns:linphone="clr-namespace:Linphone"
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 x:Name="TitlePanel" Grid.Row="1" Margin="12,5,0,0">
<TextBlock Text="{Binding Path=LocalizedResources.LoginMenu, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="20,0,20,20">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" VerticalAlignment="Center">
<toolkit:PhoneTextBox x:Name="Username" Hint="{Binding Path=LocalizedResources.SIPUsername, Source={StaticResource LocalizedStrings}}">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="EmailUserName" />
</InputScope>
</TextBox.InputScope>
</toolkit:PhoneTextBox>
<toolkit:PhoneTextBox x:Name="Password" Hint="{Binding Path=LocalizedResources.SIPPassword, Source={StaticResource LocalizedStrings}}">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Password" />
</InputScope>
</TextBox.InputScope>
</toolkit:PhoneTextBox>
<toolkit:PhoneTextBox x:Name="Domain" Hint="{Binding Path=LocalizedResources.SIPDomain, Source={StaticResource LocalizedStrings}}">
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Url" />
</InputScope>
</TextBox.InputScope>
</toolkit:PhoneTextBox>
<Button x:Name="LogIn" Content="{Binding Path=LocalizedResources.Login, Source={StaticResource LocalizedStrings}}" Click="LogIn_Click"/>
<TextBlock
x:Name="ErrorMessage"
Text="{Binding Path=LocalizedResources.ErrorLogin, Source={StaticResource LocalizedStrings}}"
Visibility="Collapsed"
HorizontalAlignment="Center"
Foreground="Red"/>
<StackPanel x:Name="Loading" Orientation="Vertical" Margin="0,20,0,0" Visibility="Collapsed">
<ProgressBar IsIndeterminate="True"/>
<TextBlock Text="{Binding Path=LocalizedResources.LoginIn, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Center"/>
</StackPanel>
</StackPanel>
<Button x:Name="LinphoneLogIn" Grid.Row="1" Content="{Binding Path=LocalizedResources.LinphoneLogin, Source={StaticResource LocalizedStrings}}" Click="LinphoneLogIn_Click"/>
<Button x:Name="Register" Grid.Row="2" Content="{Binding Path=LocalizedResources.CreateAccount, Source={StaticResource LocalizedStrings}}" Click="Register_Click" IsEnabled="False"/>
</Grid>
</Grid>
</linphone:BasePage>
\ 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.Model;
namespace Linphone.Views
{
/// <summary>
/// Handles the first login and the account creation
/// </summary>
public partial class FirstLogin : BasePage
{
private SIPAccountSettingsManager _settings = new SIPAccountSettingsManager();
/// <summary>
/// Public constructor
/// </summary>
public FirstLogin()
{
InitializeComponent();
}
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Create LinphoneCore if not created yet, otherwise do nothing
await LinphoneManager.Instance.InitLinphoneCore();
if (LinphoneManager.Instance.LinphoneCore.GetProxyConfigList().Count > 0)
{
NavigationService.Navigate(new Uri("/Views/Dialer.xaml", UriKind.RelativeOrAbsolute));
NavigationService.RemoveBackEntry(); // Prevent a back to this screen from the dialer
}
}
private void LogIn_Click(object sender, RoutedEventArgs e)
{
ErrorMessage.Visibility = Visibility.Collapsed;
if (Username.Text.Length > 0 && Domain.Text.Length > 0)
{
LogIn.IsEnabled = false;
Register.IsEnabled = false;
LinphoneLogIn.IsEnabled = false;
Loading.Visibility = Visibility.Visible;
Username.IsEnabled = false;
Password.IsEnabled = false;
Domain.IsEnabled = false;
_settings.Username = Username.Text;
_settings.Password = Password.Text;
_settings.Domain = Domain.Text;
_settings.Save();
NavigationService.Navigate(new Uri("/Views/Dialer.xaml", UriKind.RelativeOrAbsolute));
NavigationService.RemoveBackEntry(); // Prevent a back to this screen from the dialer
}
else
{
ErrorMessage.Visibility = Visibility.Visible;
}
}
private void Register_Click(object sender, RoutedEventArgs e)
{
//TODO
}
private void LinphoneLogIn_Click(object sender, RoutedEventArgs e)
{
Domain.Text = "sip.linphone.org";
LinphoneLogIn.Visibility = Visibility.Collapsed;
ErrorMessage.Visibility = Visibility.Collapsed;
}
}
}
\ No newline at end of file
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