private void btn_login_Click(object sender, RoutedEventArgs e) { if (Login(tb_usr.Text, tb_pw.Password)) { WindowState = System.Windows.WindowState.Minimized; btn_login.IsEnabled = false; btn_logout.IsEnabled = true; RememberConfig.SaveConfig(tb_usr.Text, tb_pw.Password); } }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { IntPtr handle = Process.GetCurrentProcess().MainWindowHandle; int exStyle = (int)GetWindowLong(handle, (int)GetWindowLongFields.GWL_EXSTYLE); exStyle |= (int)ExtendedWindowStyles.WS_EX_TOOLWINDOW; SetWindowLong(handle, (int)GetWindowLongFields.GWL_EXSTYLE, (IntPtr)exStyle); string usr, pw; RememberConfig.GetConfig(out usr, out pw); tb_usr.Text = usr; tb_pw.Password = pw; }