コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Amatsugu/Aoba
        private async void ShowLoggedIn()
        {
            if (loginForm == null)
            {
                loginForm = AccountBox.Content;
            }
            await Aoba.UpdateStats();

            var spanel       = new StackPanel();
            var logoutButton = new Button();

            logoutButton.Content = $"Logout";
            logoutButton.Click  += (o, e) =>
            {
                Aoba.Settings.AuthToken = null;
                AccountBox.Content      = loginForm;
                UserStatus.Content      = "User not logged in...";
            };
            spanel.Children.Add(new Label {
                Content = $"Logged in as: {Aoba.Settings.Username}"
            });
            spanel.Children.Add(logoutButton);
            AccountBox.Content = spanel;
            UserStatus.Content = $"Upload Count: {Aoba.UserStats?.screenShotCount}";
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Amatsugu/Aoba
        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();
        }