Exemplo n.º 1
0
        private void textChanged(object sender, RoutedEventArgs e)
        {
            SharingProvider provider = providers[(string)((sender as Control).Tag)];

            provider.IsDirty = true;
            provider.Valid   = false;
        }
Exemplo n.º 2
0
        private void checkChange(object sender, RoutedEventArgs e)
        {
            SharingProvider provider = providers[(string)((sender as Control).Tag)];

            provider.Enabled = (sender as CheckBox).IsChecked.GetValueOrDefault(true);
            if (provider.Enabled)
            {
                provider.UsernameBox.IsEnabled = true;
                provider.PasswordBox.IsEnabled = true;
                provider.TestButton.IsEnabled  = true;
                provider.IsDirty = true;
                provider.Valid   = false;
            }
            else
            {
                provider.UsernameBox.IsEnabled = false;
                provider.PasswordBox.IsEnabled = false;
                provider.TestButton.IsEnabled  = false;
                provider.UsernameBox.Text      = String.Empty;
                provider.PasswordBox.Password  = String.Empty;
                provider.ResultsLabel.Content  = String.Empty;
                provider.IsDirty = true;
                provider.Valid   = true;
            }
        }
Exemplo n.º 3
0
        private void testClick(object sender, RoutedEventArgs e)
        {
            SharingProvider provider = providers[(string)((sender as Control).Tag)];

            provider.ResultsLabel.Foreground = Brushes.Black;
            provider.ResultsLabel.Content    = UI.TestingCredentials;
            provider.TestButton.IsEnabled    = false;
            provider.UsernameBox.IsEnabled   = false;
            provider.PasswordBox.IsEnabled   = false;
            provider.Worker         = new BackgroundWorker();
            provider.Worker.DoWork += delegate(object s, DoWorkEventArgs args)
            {
                TestCredentialsData data = (TestCredentialsData)args.Argument;
                args.Result = data.Implementation.TestCredentials(data.Username, data.Password);
            };
            provider.Worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args)
            {
                if ((bool)args.Result)
                {
                    provider.Valid = true;
                    provider.ResultsLabel.Content    = UI.LoginSuccessful;
                    provider.ResultsLabel.Foreground = Brushes.Green;
                }
                else
                {
                    provider.ResultsLabel.Content    = UI.LoginFailed;
                    provider.ResultsLabel.Foreground = Brushes.Red;
                }
                provider.TestButton.IsEnabled  = true;
                provider.UsernameBox.IsEnabled = true;
                provider.PasswordBox.IsEnabled = true;
            };
            provider.Worker.RunWorkerAsync(new TestCredentialsData()
            {
                Implementation = provider.Implementation,
                Username       = provider.UsernameBox.Text,
                Password       = provider.PasswordBox.Password
            });
        }