Exemplo n.º 1
0
        private async void Load()
        {
            //Startup
            RunOnStartup.IsChecked = Aoba.Settings.RunAtStart;
            //After Load
            CopyLink.IsChecked = Aoba.Settings.CopyLink;
            OpenLink.IsChecked = Aoba.Settings.OpenLink;
            //Toasts
            ToastAll.IsChecked     = ToastBox.IsEnabled = Aoba.Settings.ShowToasts;
            ToastCapture.IsChecked = Aoba.Settings.ToastCapture;
            ToastSuccess.IsChecked = Aoba.Settings.ToastSucess;
            ToastFailed.IsChecked  = Aoba.Settings.ToastFailed;
            //Sounds
            SoundAll.IsChecked     = SoundBox.IsEnabled = Aoba.Settings.PlaySounds;
            SoundCapture.IsChecked = Aoba.Settings.SoundCapure;
            SoundSuccess.IsChecked = Aoba.Settings.SoundSuccess;
            SoundFailed.IsChecked  = Aoba.Settings.SoundFailed;
            //Image Format
            ImageFormat.SelectedIndex = (Aoba.Settings.Format == System.Drawing.Imaging.ImageFormat.Jpeg) ? 1 : 0;
            //Save Copy
            SaveCopy.IsChecked = SaveBox.IsEnabled = Aoba.Settings.SaveCopy;
            SaveLocation.Text  = Aoba.Settings.SaveLocation;
            //Fullscreen Capture Mode
            FullscreenCaputue.SelectedIndex = (int)Aoba.Settings.FullscreenCapture;
            //Tray
            CloseToTray.IsChecked = Aoba.Settings.CloseToTray;
            StartInTray.IsChecked = Aoba.Settings.StartInTray;
            //In-Game
            GameCapture.IsChecked = Aoba.Settings.GameCapture;
            ShowFPS.IsChecked     = Aoba.Settings.ShowFPS;
            //Misc
            ClipboardAutoUpload.IsChecked = Aoba.Settings.AutoUploadFromClipboard;
            //Account
            Username.Text = Aoba.Settings.Username;
            await Aoba.UpdateStats();

            if (Aoba.UserStats == null)
            {
                Aoba.Settings.AuthToken = null;

                if (Aoba.Settings.Password != null)
                {
                    await Aoba.Login();

                    if (Aoba.Settings.AuthToken != null)
                    {
                        ShowLoggedIn();
                    }
                }
            }
            RenderKeyBinds();
        }
Exemplo n.º 2
0
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                AccountBox.IsEnabled   = false;
                Aoba.Settings.Username = Username.Text;
                Aoba.Settings.Password = Password.Password;
                await Aoba.Login();

                AccountBox.IsEnabled = true;
                ShowLoggedIn();
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
                AccountBox.IsEnabled = true;
            }
            finally
            {
                Save();
            }
        }