コード例 #1
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                txbStudFulter.TextChanged += TextBox_TextChanged;
                if (Properties.Settings.Default.SafePW == true)
                {
                    string user  = Properties.Settings.Default.UserName;
                    string pass  = SecurePasswordVault.ToInsecureString(SecurePasswordVault.DecryptString(Properties.Settings.Default.Password));
                    var    gotit = await RestClient.LoginAndGetSession(user, pass);

                    if (gotit != true) //Login vereist
                    {
                        LoadLoginAndQuitIfNeeded();
                    }
                }
                else //Login vereist
                {
                    LoadLoginAndQuitIfNeeded();
                }



                timerRefresh.Interval  = new TimeSpan(0, 0, 15);
                timerRefresh.Tick     += (p, ex) => { DownloadActiveSessions(); };
                timerRefresh.IsEnabled = true;
                RefreshDataFromServer();
            }
            catch (Exception ex)
            {
                await this.ShowMessageAsync("Error bij Window_Loaded", " Error=" + ex.Message);
            }
        }
 private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
 {
     if (Properties.Settings.Default.SafePW == true)
     {
         chkSafePW.IsChecked = true;
         txbUser.Text        = Properties.Settings.Default.UserName;
         txbPass.Password    = SecurePasswordVault.ToInsecureString(SecurePasswordVault.DecryptString(Properties.Settings.Default.Password));
     }
 }