private void Unsubscribe_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Are you sure you want to unsubscribe?", "Unsubscribing", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { _service.Unsubscribe(); UIController.HidePanel(_featuresPanel); _service = null; _featuresPanel = null; } }
/// <summary> /// Update the lists of people in asyncronous way. /// </summary> private void AsyncUpdate() { Popups.UILoading loading = null; this.Dispatcher.BeginInvoke(new Action(delegate() { loading = new Popups.UILoading("Loading Profile"); UIController.ShowPanel(loading); })); WUser me = UIController.Proxy.GetUser(UIController.MyProfile.Username, UIController.Password); if (me != null) UIController.MyProfile = me; WService[] services = UIController.Proxy.GetServices(UIController.MyProfile.Username, UIController.Password); this.Dispatcher.BeginInvoke(new Action(delegate() { Posts.Text = UIController.MyProfile.Statuses.ToString(); Followings.Text = UIController.MyProfile.Followings.ToString(); Followers.Text = UIController.MyProfile.Followers.ToString(); if (String.IsNullOrEmpty(UIController.MyProfile.Avatar)) Avatar.InternalImage.Source = new BitmapImage(new Uri("pack://application:,,,/It.Uniba.Di.Cdg.SocialTfs.Client;component/Images/DefaultAvatar.png")); else Avatar.InternalImage.Source = new BitmapImage(new Uri(UIController.MyProfile.Avatar)); UserName.Text = UIController.MyProfile.Username; if (services.Length != 0) Services.Children.Clear(); foreach (WService s in services) { Objects.UIService service = new Objects.UIService(s); service.Click += service_Click; Services.Children.Add(service); } UIController.HidePanel(loading); })); }
private void ShowSettings(Objects.UIService service) { _service = service; _featuresPanel = new Popups.UIFeatures(_service.Service, false); _featuresPanel.Unsubscribe.Click += Unsubscribe_Click; _featuresPanel.SaveServiceSettings.Click += SaveServiceSettings_Click; UIController.ShowPanel(_featuresPanel); }
private void TFSLoginCancel(object sender, RoutedEventArgs e) { UIController.HidePanel(_tfsLoginPanel); _service = null; _tfsLoginPanel = null; }
private void service_Click(object sender, RoutedEventArgs e) { Objects.UIService service = sender as Objects.UIService; if (service.Service.Registered) { ShowSettings(service); } else { _service = service; if (service.Service.RequireOAuth) { _pinPanel = new Popups.UIPinPanel(_service.Service.Image, _service.Service.OAuthVersion); _pinPanel.Ok.Click += PinPanelOk; _pinPanel.Cancel.Click += PinPanelCancel; UIController.ShowPanel(_pinPanel); _browser = service.Subscribe(); if (_service.Service.OAuthVersion == 2) _browser.DocumentComplete += browser_DocumentComplete; } else if (service.Service.RequireTFSAuthentication) { _tfsLoginPanel = new Popups.UITFSLogin(_service.Service.Image, _service.Service.RequireTFSDomain); _tfsLoginPanel.Ok.Click += TFSLoginOk; _tfsLoginPanel.Cancel.Click += TFSLoginCancel; UIController.ShowPanel(_tfsLoginPanel); } } }
private void SaveServiceSettings_Click(object sender, RoutedEventArgs e) { UIController.Proxy.UpdateChosenFeatures( UIController.MyProfile.Username, UIController.Password, _service.Service.Id, _featuresPanel.ChosenFeatures().ToArray()); if (String.IsNullOrEmpty(UIController.MyProfile.Avatar) && _featuresPanel.ChosenFeatures().Contains("Avatar")) { Uri[] avatarsUri = UIController.Proxy.GetAvailableAvatars(UIController.MyProfile.Username, UIController.Password); if (avatarsUri.Length > 0) { Uri uri = avatarsUri[0]; if (UIController.Proxy.SaveAvatar(UIController.MyProfile.Username, UIController.Password, uri)) { UIController.ChangeProfileButtonImage(uri); Avatar.InternalImage.Source = new BitmapImage(uri); } } } UIController.HidePanel(_featuresPanel); _service = null; _featuresPanel = null; }
private void PinPanelCancel(object sender, RoutedEventArgs e) { UIController.HidePanel(_pinPanel); _service = null; _pinPanel = null; }
private void OhlohCancel(object sender, RoutedEventArgs e) { UIController.HidePanel(_ohlohPanel); _service = null; _ohlohPanel = null; }
private void CoderwallCancel(object sender, RoutedEventArgs e) { UIController.HidePanel(_coderwallPanel); _service = null; _coderwallPanel = null; }