private void butLoginM_Click(object sender, RoutedEventArgs e) { auth = new Launch.Login.YggdrasilLoginAuth(txtBoxUNE.Text, pwbox.Password); if (requiredPreLogin) { info = auth.Login(); auth = !string.IsNullOrWhiteSpace(info.ErrorMsg) ? null : new Launch.Login.YggdrasilRefreshAuth(info.Session); } if ((bool)butRM2.IsChecked) { MeCore.Config.username = txtBoxUNE.Text; MeCore.Config.Save(null); } else { MeCore.Config.QuickChange("username", ""); } if ((bool)butRPW.IsChecked) { MeCore.Config.ScoreStringToOver50(pwbox.Password); MeCore.Config.Save(null); } else { MeCore.Config.QuickChange("password", ""); } DialogResult = true; Close(); }
private void butLoginOff_Click(object sender, RoutedEventArgs e) { auth = new Launch.Login.OfflineAuth(txtBoxUN.Text); if (requiredPreLogin) { info = auth.Login(); auth = !string.IsNullOrWhiteSpace(info.ErrorMsg) ? null : new Launch.Login.AuthWarpper(info); } if ((bool)butRM1.IsChecked) { MeCore.Config.username = txtBoxUN.Text; MeCore.Config.Save(null); } DialogResult = true; Close(); }
private void CreateCustomAuth() { if (MeCore.Config.Server.Auths.Count != 0) { short i = 0; foreach (var item in MeCore.Config.Server.Auths) { ++i; Grid gridCustomAuth = new Grid(); gridCustomAuth.Visibility = Visibility.Collapsed; Label lbltitie = new Label(); lbltitie.SetLocalizedContent("Login"); lbltitie.FontSize = 21.333; lbltitie.Margin = new Thickness(10, 10, 0, 0); lbltitie.HorizontalAlignment = HorizontalAlignment.Left; lbltitie.VerticalAlignment = VerticalAlignment.Top; gridCustomAuth.Children.Add(lbltitie); Label lblune = new Label(); lblune.SetLocalizedContent("UNEM"); lblune.FontSize = 16; lblune.Margin = new Thickness(10, 45, 0, 0); lblune.HorizontalAlignment = HorizontalAlignment.Left; lblune.VerticalAlignment = VerticalAlignment.Top; gridCustomAuth.Children.Add(lblune); TextBox txtboxune = new TextBox(); txtboxune.Text = ""; txtboxune.FontSize = 18.667; txtboxune.Margin = new Thickness(10, 75, 10, 0); txtboxune.Height = 30; txtboxune.HorizontalAlignment = HorizontalAlignment.Stretch; txtboxune.VerticalAlignment = VerticalAlignment.Top; txtboxune.TextWrapping = TextWrapping.Wrap; gridCustomAuth.Children.Add(txtboxune); Label lblpw = new Label(); lblpw.SetLocalizedContent("PW"); lblpw.FontSize = 16; lblpw.Margin = new Thickness(10, 105, 0, 0); lblpw.HorizontalAlignment = HorizontalAlignment.Left; lblpw.VerticalAlignment = VerticalAlignment.Top; gridCustomAuth.Children.Add(lblpw); PasswordBox pwbox = new PasswordBox(); pwbox.Password = ""; pwbox.FontSize = 18.667; pwbox.Margin = new Thickness(10, 135, 10, 0); pwbox.Height = 30; pwbox.HorizontalAlignment = HorizontalAlignment.Stretch; pwbox.VerticalAlignment = VerticalAlignment.Top; gridCustomAuth.Children.Add(pwbox); Button butback = new Button(); butback.SetLocalizedContent("Back"); butback.FontSize = 16; butback.Margin = new Thickness(0, 0, 10, 10); butback.Width = 202; butback.Height = 32; butback.HorizontalAlignment = HorizontalAlignment.Right; butback.VerticalAlignment = VerticalAlignment.Bottom; butback.BorderThickness = new Thickness(2); butback.Style = (Style)Resources["NormalButton"]; butback.Click += delegate (object sender, RoutedEventArgs e) { gridCustomAuth.Visibility = Visibility.Collapsed; gridMenu.Visibility = Visibility.Visible; }; gridCustomAuth.Children.Add(butback); Button butlogin = new Button(); butlogin.SetLocalizedContent("Login"); butlogin.FontSize = 16; butlogin.Margin = new Thickness(0, 0, 217, 10); butlogin.Width = 202; butlogin.Height = 32; butlogin.HorizontalAlignment = HorizontalAlignment.Right; butlogin.VerticalAlignment = VerticalAlignment.Bottom; butlogin.BorderThickness = new Thickness(2); butlogin.Style = (Style)Resources["NormalButton"]; butlogin.Click += delegate (object sender, RoutedEventArgs e) { auth = new Launch.Login.YggdrasilLoginAuth(txtboxune.Text, pwbox.Password,new Launch.Login.YggdrasilHelper(item.Url)); if (requiredPreLogin) { info = auth.Login(); auth = !string.IsNullOrWhiteSpace(info.ErrorMsg) ? null : new Launch.Login.YggdrasilRefreshAuth(info.Session, new Launch.Login.YggdrasilHelper(item.Url)); } Close(); }; gridCustomAuth.Children.Add(butlogin); gridMain.Children.Add(gridCustomAuth); ButtonMenu butcustomauth = new ButtonMenu(); butcustomauth.Content = string.Format(Lang.LangManager.GetLangFromResource("Online"), item.Name); butcustomauth.MenuImage = new BitmapImage(new Uri("pack://application:,,,/Resources/others.png")); butcustomauth.FontSize = 16; butcustomauth.Margin = new Thickness(0, 60 * (i + 1), -17, 0); butcustomauth.Height = 60; butcustomauth.Background = new SolidColorBrush(Colors.White); butcustomauth.VerticalAlignment = VerticalAlignment.Top; butcustomauth.Style = (Style)Resources["ButtonMeListSolid"]; butcustomauth.ListType = true; butcustomauth.Click += delegate (object sender, RoutedEventArgs e) { gridMenu.Visibility = Visibility.Collapsed; gridCustomAuth.Visibility = Visibility.Visible; }; gridscrolllist.Children.Add(butcustomauth); } } }