Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var SsidRequest = Repository.Get(new Uri("https://oauth2.epn.bz/ssid?client_id=web-client"));
            var SsidToken   = JsonConvert.DeserializeObject <SSID>(SsidRequest);

            if (LoginBox.Text == "" || PasswordBox.Text == "")
            {
                MessageBox.Show("Заполните все поля!", "Внимание!", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                try
                {
                    var CredentialType = Repository.GetTokenWithClient(SsidToken.Data.Attributes.SsidToken, LoginBox.Text, PasswordBox.Text);

                    var API = JsonConvert.DeserializeObject <AccessTokenResult>(CredentialType);

                    DesktopForm desktopForm = new DesktopForm(API.Data.Attributes.AccessToken);
                    desktopForm.Show();
                    if (SaveDataCheckBox.IsChecked == true)
                    {
                        File.WriteAllText(@"Token.txt", API.Data.Attributes.AccessToken);
                        //File.WriteAllText(@"Password.txt", PasswordBox.Text);
                    }

                    this.Close();
                }
                catch (Exception ex)
                {
                }
            }
        }
Пример #2
0
        public SettingForm(DesktopForm desktopForm)
        {
            InitializeComponent();


            this.Settings     = desktopForm.Settings;
            this.DesktopForm  = desktopForm;
            this.LinkSettings = desktopForm.LinkSettings;
        }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent();

            if (File.ReadAllText(@"Token.txt") != "")
            {
                DesktopForm desktopForm = new DesktopForm(File.ReadAllText(@"Token.txt"));
                desktopForm.Show();
                this.Close();
            }

            //LoginBox.Text = System.IO.File.ReadAllText(@"Login.txt");
            //PasswordBox.Text = File.ReadAllText(@"Password.txt");
        }