public RepositoryPublishControl(ITeamExplorerServices teServices, INotificationDispatcher notifications) { InitializeComponent(); this.WhenActivated(d => { d(this.BindCommand(ViewModel, vm => vm.PublishRepository, v => v.publishRepositoryButton)); ViewModel.PublishRepository.Subscribe(state => { if (state == ProgressState.Success) { teServices.ShowMessage(UI.Resources.RepositoryPublishedMessage); NotifyDone(); } }); d(this.WhenAny(x => x.ViewModel.IsPublishing, x => x.Value) .Subscribe(x => NotifyIsBusy(x))); d(notifications.Listen() .Where(n => n.Type == Notification.NotificationType.Error) .Subscribe(n => teServices.ShowError(n.Message))); d(this.WhenAny(x => x.ViewModel.SafeRepositoryNameWarningValidator.ValidationResult, x => x.Value) .WhereNotNull() .Select(result => result?.Message) .Subscribe(message => { if (!String.IsNullOrEmpty(message)) { teServices.ShowWarning(message); } else { teServices.ClearNotifications(); } })); nameText.Text = ViewModel.DefaultRepositoryName; }); IsVisibleChanged += (s, e) => { if (IsVisible) { this.TryMoveFocus(FocusNavigationDirection.First).Subscribe(); } }; }
public GistCreationControl( ITeamExplorerServices teServices, INotificationDispatcher notifications, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { InitializeComponent(); this.WhenActivated(d => { errorMessage.Visibility = Visibility.Collapsed; d(this.Bind(ViewModel, vm => vm.Description, v => v.descriptionTextBox.Text)); d(this.Bind(ViewModel, vm => vm.FileName, v => v.fileNameTextBox.Text)); d(this.Bind(ViewModel, vm => vm.IsPrivate, v => v.makePrivate.IsChecked)); d(this.BindCommand(ViewModel, vm => vm.CreateGist, v => v.createGistButton)); d(this.Bind(ViewModel, vm => vm.Account, v => v.accountStackPanel.DataContext)); ViewModel.CreateGist .Where(x => x != null) .Subscribe(gist => { var browser = serviceProvider.GetExportedValue <IVisualStudioBrowser>(); browser?.OpenUrl(new Uri(gist.HtmlUrl)); var ns = serviceProvider.GetExportedValue <IStatusBarNotificationService>(); ns?.ShowMessage(UI.Resources.gistCreatedMessage); NotifyDone(); }); d(notifications.Listen() .Where(n => n.Type == Notification.NotificationType.Error) .ObserveOnDispatcher(DispatcherPriority.Normal) .Subscribe(n => { errorMessage.Visibility = Visibility.Visible; errorMessageText.Text = n.Message; })); }); }
public GitHubPaneView(INotificationDispatcher notifications) { this.InitializeComponent(); this.WhenActivated(d => { infoPanel.Visibility = Visibility.Collapsed; d(notifications.Listen() .ObserveOnDispatcher(DispatcherPriority.Normal) .Subscribe(n => { if (n.Type == Notification.NotificationType.Error || n.Type == Notification.NotificationType.Warning) { infoPanel.MessageType = MessageType.Warning; } else { infoPanel.MessageType = MessageType.Information; } infoPanel.Message = n.Message; })); }); }
public GitHubPaneView(INotificationDispatcher notifications) { InitializeComponent(); this.WhenActivated(d => { d(notifications.Listen() .ObserveOnDispatcher(DispatcherPriority.Normal) .Subscribe(n => { if (n.Type == Notification.NotificationType.Error || n.Type == Notification.NotificationType.Warning) { infoPanel.Icon = Octicon.alert; } else { infoPanel.Icon = Octicon.info; } infoPanel.Message = n.Message; })); }); }
public RepositoryPublishControl(ITeamExplorerServices teServices, INotificationDispatcher notifications) { InitializeComponent(); this.WhenActivated(d => { d(this.OneWayBind(ViewModel, vm => vm.Connections, v => v.hostsComboBox.ItemsSource)); d(this.OneWayBind(ViewModel, vm => vm.IsHostComboBoxVisible, v => v.hostsComboBox.Visibility)); d(this.Bind(ViewModel, vm => vm.SelectedConnection, v => v.hostsComboBox.SelectedItem)); d(this.Bind(ViewModel, vm => vm.RepositoryName, v => v.nameText.Text)); d(this.Bind(ViewModel, vm => vm.Description, v => v.description.Text)); d(this.Bind(ViewModel, vm => vm.KeepPrivate, v => v.makePrivate.IsChecked)); d(this.OneWayBind(ViewModel, vm => vm.CanKeepPrivate, v => v.makePrivate.IsEnabled)); d(this.OneWayBind(ViewModel, vm => vm.Accounts, v => v.accountsComboBox.ItemsSource)); d(this.Bind(ViewModel, vm => vm.SelectedAccount, v => v.accountsComboBox.SelectedItem)); d(this.BindCommand(ViewModel, vm => vm.PublishRepository, v => v.publishRepositoryButton)); d(this.OneWayBind(ViewModel, vm => vm.IsPublishing, v => v.nameText.IsEnabled, x => x == false)); d(this.OneWayBind(ViewModel, vm => vm.IsPublishing, v => v.description.IsEnabled, x => x == false)); d(this.OneWayBind(ViewModel, vm => vm.IsPublishing, v => v.accountsComboBox.IsEnabled, x => x == false)); ViewModel.PublishRepository.Subscribe(state => { if (state == ProgressState.Success) { teServices.ShowMessage(UI.Resources.RepositoryPublishedMessage); NotifyDone(); } }); d(this.WhenAny(x => x.ViewModel.IsPublishing, x => x.Value) .Subscribe(x => NotifyIsBusy(x))); d(notifications.Listen() .Where(n => n.Type == Notification.NotificationType.Error) .Subscribe(n => teServices.ShowError(n.Message))); d(this.WhenAny(x => x.ViewModel.SafeRepositoryNameWarningValidator.ValidationResult, x => x.Value) .WhereNotNull() .Select(result => result?.Message) .Subscribe(message => { if (!String.IsNullOrEmpty(message)) { teServices.ShowWarning(message); } else { teServices.ClearNotifications(); } })); nameText.Text = ViewModel.DefaultRepositoryName; }); IsVisibleChanged += (s, e) => { if (IsVisible) { this.TryMoveFocus(FocusNavigationDirection.First).Subscribe(); } }; }