// Done! private void Enter_Click(object sender, RoutedEventArgs e) { UserImage.IsEnabled = false; Enter.IsEnabled = false; Loader.Visibility = Visibility.Visible; string un = this.UserNameText.Text; string up = this.UserPasswordText.Password; new Thread(() => this.Connect(un, up)).Start(); new Thread(() => { while (true) { Thread.Sleep(200); if (mc.Authenticated) { break; } } AlterConfigurationDelegate call = this.AlterConfiguration; this.Dispatcher.BeginInvoke(DispatcherPriority.Send, call); }).Start(); }
// Done! public void AlterConfiguration() { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(DispatcherPriority.Send, new AlterConfigurationDelegate(this.AlterConfiguration)); return; } UserImage.IsEnabled = true; Enter.IsEnabled = true; Loader.Visibility = Visibility.Hidden; Loader.BeginStoryboard(LoaderStoryboard.Storyboard); ContentHolder.Opacity = 0; ContentHolder.Visibility = Visibility.Hidden; ContactsHolder.Opacity = 1; ContactsHolder.Visibility = Visibility.Visible; //int count = 0; new Thread(() => { AlterConfigurationDelegate call = AlterContacts; int time = System.Environment.TickCount; while (true) { Thread.Sleep(200); if (mc.ContactsSyncronized()) { break; } } this.Dispatcher.BeginInvoke(DispatcherPriority.Send, call); }).Start(); }