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(); }
public PageGuideAuthTry(Launch.Login.IAuth author) { InitializeComponent(); GetInfo(this.author = author); }
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); } } }
private async void AuthButton_Click(object sender, RoutedEventArgs e) { if (e.Source is ButtonMenu) { if ((bool)toggleDetele.IsChecked) { var ani = new ThicknessAnimationUsingKeyFrames(); ani.KeyFrames.Add(new LinearThicknessKeyFrame(new Thickness(-20, ((ButtonMenu)e.Source).Margin.Top, 20, ((ButtonMenu)e.Source).Margin.Bottom), TimeSpan.FromSeconds(0.2))); ani.KeyFrames.Add(new LinearThicknessKeyFrame(new Thickness(-100, ((ButtonMenu)e.Source).Margin.Top, 100, ((ButtonMenu)e.Source).Margin.Bottom), TimeSpan.FromSeconds(0.3))); ani.KeyFrames.Add(new LinearThicknessKeyFrame(new Thickness(-465, ((ButtonMenu)e.Source).Margin.Top, 465, ((ButtonMenu)e.Source).Margin.Bottom), TimeSpan.FromSeconds(0.5))); ((ButtonMenu)e.Source).BeginAnimation(MarginProperty, ani); foreach (ButtonMenu button in gridscrolllist.Children) { if (button != ((ButtonMenu)e.Source)) { var ani1 = new ThicknessAnimationUsingKeyFrames(); ani1.KeyFrames.Add(new LinearThicknessKeyFrame(button.Margin, TimeSpan.FromSeconds(0.5))); ani1.KeyFrames.Add(new LinearThicknessKeyFrame(new Thickness(button.Margin.Left, button.Margin.Top - 60, button.Margin.Right, button.Margin.Bottom + 60), TimeSpan.FromSeconds(0.8))); button.BeginAnimation(MarginProperty, ani1); } } MeCore.Config.SavedAuths.Remove(((ButtonMenu)e.Source).Content as string); if (MeCore.Config.DefaultAuth.Equals(((ButtonMenu)e.Source).Content as string)) { MeCore.Config.DefaultAuth = ""; } MeCore.Config.Save(); await System.Threading.Tasks.TaskEx.Delay(2000); CreateCustomAuth(); return; } SavedAuth auth; string name = ((ButtonMenu)e.Source).Content as string; MeCore.Config.SavedAuths.TryGetValue(name, out auth); this.auth = auth.AuthType.Equals("Yggdrasil") ? new Launch.Login.YggdrasilRefreshAuth(Guid.Parse(auth.AccessToken).ToString()) : new Launch.Login.OfflineAuth(name) as Launch.Login.IAuth; MeCore.Config.QuickChange("DefaultAuth", name); Close(); } }