public FrameworkElement Run(params object[] data) { //Create the main view UserInterfaceCore.MainView = new MainControl(); //Change the view the main view has UserInterfaceCore.ChangeView(typeof(LoginControl), data); //Return the main view to base application return(UserInterfaceCore.MainView); }
public FrameworkElement Run(params object[] data) { //Create the main view UserInterfaceCore.HolderPage = new HolderPage(); //Get the language UserInterfaceCore.SetResource(data[0].ToString()); StaticVars.IcyWindLocation = System.IO.Path.GetDirectoryName((string)data[1]); UserInterfaceCore.Focus = () => FlashWindow.SetForegroundWindow((IntPtr)data[2]); UserInterfaceCore.Flash = () => FlashWindow.Flash((IntPtr)data[2], 20); //Look for the latest system yaml files RiotUpdateHandler.GetLatestSystemYaml(); //RiotUpdateHandler.GetLatestSystemYamlPbe(); //Change the view the main view has UserInterfaceCore.ChangeView(typeof(LoginPage)); //Return the main view to base application return(UserInterfaceCore.HolderPage); }
private void Login_Click(object sender, RoutedEventArgs e) { LoginProgressBar.Visibility = Visibility.Visible; var loginCred = new LoginCredentials { Username = Username.Text, Password = Password.Password }; //Missing information. This is done to save bandwidth for the user. // if (string.IsNullOrWhiteSpace(loginCred.Username) || string.IsNullOrWhiteSpace(loginCred.PasswordHash)) { UserInterfaceCore.HolderPage.ShowNotification(UserInterfaceCore.ShortNameToString("NoCred")); LoginProgressBar.Visibility = Visibility.Hidden; return; } var t = new Thread(async() => { var accountInfo = AccountManager.GetAccountInfo(loginCred); // Failed login information if (!string.IsNullOrWhiteSpace(accountInfo.Error)) { switch (accountInfo.Error) { case "InvalidCred": case "UserBanned": case "EmailNotVerified": await Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { UserInterfaceCore.HolderPage.ShowNotification(UserInterfaceCore.ShortNameToString(accountInfo.Error)); LoginProgressBar.Visibility = Visibility.Hidden; Password.Clear(); })); break; default: await Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { UserInterfaceCore.HolderPage.ShowNotification(UserInterfaceCore.ShortNameToString("LoginErrorGeneric")); LoginProgressBar.Visibility = Visibility.Hidden; Password.Clear(); })); break; } return; } if (!string.IsNullOrWhiteSpace(accountInfo.TwoFactor)) { LoginProgressBar.Visibility = Visibility.Hidden; switch (accountInfo.Error) { //TODO: Implement a way to input a code for 2FA //TODO: Add an option to exclude 2FA for certain known devices of IP ADDRESSES case "CheckEmail": case "CheckText": await Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { UserInterfaceCore.HolderPage.ShowNotification(UserInterfaceCore.ShortNameToString(accountInfo.Error)); LoginProgressBar.Visibility = Visibility.Hidden; })); break; default: await Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { UserInterfaceCore.HolderPage.ShowNotification(UserInterfaceCore.ShortNameToString("LoginErrorGeneric")); LoginProgressBar.Visibility = Visibility.Hidden; })); break; } return; } //This is the OpenId config used to login. I use a custom //Implementation which may not fully represent OpenId but //It gets the job done var openId = RiotAuth.GetOpenIdConfig(); //The SHA1 Hash of the password is used as the password //To get the accounts from the servers. The MD5 hash of that //Password is the AES key. This may need to change to a different //Hashing algorithm, and maybe the encryption should include //A part form the IcyWindAuth server which is used to decrypt var aesKey = MD5.Hash(Password.Password); StaticVars.AccountInfo = accountInfo; StaticVars.LoginCred = loginCred; StaticVars.Password = aesKey; //This is done to stop people who are not devs or donators from accessing IcyWind in Beta // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (!accountInfo.IsDev && !accountInfo.IsPaid && false) { await Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { UserInterfaceCore.HolderPage.ShowNotification(UserInterfaceCore.ShortNameToString("FeaturedDonator")); })); return; } if (!string.IsNullOrWhiteSpace(accountInfo.Accounts)) { foreach (var account in JsonConvert.DeserializeObject <string[]>(accountInfo.Accounts)) { var copyAccount = account; var mm = copyAccount.Length % 4; if (mm > 0) { copyAccount += new string('=', 4 - mm); } var data = Convert.FromBase64String(copyAccount); var accountAsJson = Encoding.UTF8.GetString(data); var decodedString = JsonConvert.DeserializeObject <IcyWindRiotAccountCrypted>(accountAsJson); if (StaticVars.LoginCred.AccountData == null) { StaticVars.LoginCred.AccountData = new List <IcyWindRiotAccountCrypted>(); } StaticVars.LoginCred.AccountData.Add(decodedString); var accountDecrypted = AES.DecryptBase64(aesKey, decodedString.CryptString); var accountDetail = JsonConvert.DeserializeObject <IcyWindRiotAccountInfo>(accountDecrypted); await RiotAuth.Login(this, Dispatcher, accountDetail.Username, accountDetail.Password, accountDetail.Region, openId, true, null); } } else { StaticVars.LoginCred.AccountData = new List <IcyWindRiotAccountCrypted>(); } await Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { UserInterfaceCore.ChangeView(typeof(AccountSelectorPage)); //Fade out the audio var timer = new System.Timers.Timer { Interval = 50 }; timer.Elapsed += (obj, evt) => { Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { player.Volume -= 0.01; if (!(player.Volume <= 0)) { return; } player.Stop(); timer.Stop(); Video.Stop(); })); }; timer.Start(); LoginProgressBar.Visibility = Visibility.Hidden; })); }); t.Start(); }
private void ProfileImageContainer_OnClick(object sender, RoutedEventArgs e) { StaticVars.ActiveClient = Account; UserInterfaceCore.ChangeView(typeof(MainPage)); UserInterfaceCore.ChangeMainPageView <HomePage>(); }