// Copyright (c) 2023 schick Informatik // Description: Show about info and allow user detail editing // using BreCalClient.misc.Model; using System; using System.Diagnostics; using System.Windows; using System.Windows.Controls; namespace BreCalClient { /// /// Interaction logic for AboutDialog.xaml /// public partial class AboutDialog : Window { #region Construction public AboutDialog() { InitializeComponent(); } #endregion #region Properties public LoginResult? LoginResult { get; set; } #endregion #region events public event Action? ChangePasswordRequested; #endregion #region event handler private void buttonClose_Click(object sender, RoutedEventArgs e) { this.Close(); } private void buttonChangePassword_Click(object sender, RoutedEventArgs e) { if (this.LoginResult != null) { this.LoginResult.UserPhone = this.textBoxUserPhone.Text.Trim(); this.LoginResult.UserEmail = this.textBoxUserEmail.Text.Trim(); } this.ChangePasswordRequested?.Invoke(this.wpBoxOldPassword.Password, this.wpBoxNewPassword.Password); } private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e) { Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true }); e.Handled = true; } private void wpBoxOldPassword_TextChanged(object sender, TextChangedEventArgs e) { this.buttonChangePassword.IsEnabled = (this.wpBoxOldPassword.Password.Length > 0) && (this.wpBoxNewPassword.Password.Length > 0) && (this.wpBoxNewPasswordRepeat.Password.Length > 0) && this.wpBoxNewPassword.Password.Equals(this.wpBoxNewPasswordRepeat.Password) && (!this.wpBoxNewPassword.Password.Equals(this.wpBoxOldPassword.Password)); } private void Window_Loaded(object sender, RoutedEventArgs e) { if(LoginResult != null) { this.textBoxUserEmail.Text = LoginResult.UserEmail; this.textBoxUserPhone.Text = LoginResult.UserPhone; } } #endregion } }