private void LogIn_Click(object sender, RoutedEventArgs e) { ErrorMessage.Text = ""; 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; NetworkSettingsManager networkSettings = new NetworkSettingsManager(); _settings.Username = Username.Text; _settings.Password = Password.Password; _settings.Domain = Domain.Text; if (Domain.Text.Equals("sip.linphone.org")) { _settings.Proxy = "<sip:sip.linphone.org:5223;transport=tls>"; _settings.Transport = AppResources.TransportTLS; _settings.OutboundProxy = true; networkSettings.StunServer = "stun.linphone.org"; networkSettings.FWPolicy = AppResources.FirewallPolicyIce; } networkSettings.Save(); _settings.Save(); NavigationService.Navigate(new Uri("/Views/Dialer.xaml", UriKind.RelativeOrAbsolute)); NavigationService.RemoveBackEntry(); // Prevent a back to this screen from the dialer } else { ErrorMessage.Text = AppResources.ErrorLogin; } }
private void Save() { if (Domain.Text.Contains(":")) { if (Proxy.Text.Length == 0) { Proxy.Text = Domain.Text; } Domain.Text = Domain.Text.Split(':')[0]; } _settings.Username = Username.Text; _settings.UserId = UserId.Text; _settings.Password = Password.Password; _settings.Domain = Domain.Text; _settings.Proxy = Proxy.Text; _settings.OutboundProxy = OutboundProxy.IsChecked; _settings.DisplayName = DisplayName.Text; _settings.Transport = Transport.SelectedItem.ToString(); _settings.Expires = Expires.Text; _settings.AVPF = AVPF.IsChecked; _settings.Save(); if (linphoneAccount) { NetworkSettingsManager networkSettings = new NetworkSettingsManager(); networkSettings.Load(); networkSettings.MEncryption = networkSettings.EnumToMediaEncryption[MediaEncryption.SRTP]; networkSettings.FWPolicy = networkSettings.EnumToFirewallPolicy[FirewallPolicy.UseIce]; networkSettings.StunServer = "stun.linphone.org"; networkSettings.Save(); } }