public CloudExplorer() { InitializeComponent(); this.DataContext = new CloudExplorerViewModel(); this.Unloaded += (s, e) => Messenger.Default.Unregister(this); Messenger.Default.Register <NotificationMessageAction <bool> >( this, message => { if (message.Notification.Equals(Messages.AddCloud)) { var view = new Views.AddCloud(); Window parentWindow = Window.GetWindow(this); view.Owner = parentWindow; var result = view.ShowDialog(); message.Execute(result.GetValueOrDefault()); } }); Messenger.Default.Register <NotificationMessageAction <bool> >( this, message => { if (message.Notification.Equals(Messages.PushApp)) { var view = new Views.Push(); Window parentWindow = Window.GetWindow(this); view.Owner = parentWindow; var result = view.ShowDialog(); message.Execute(result.GetValueOrDefault()); } }); Messenger.Default.Register <NotificationMessageAction <bool> >( this, message => { if (message.Notification.Equals(Messages.UpdateApp)) { var view = new Views.Update(); Window parentWindow = Window.GetWindow(this); view.Owner = parentWindow; var result = view.ShowDialog(); message.Execute(result.GetValueOrDefault()); } }); Messenger.Default.Register <NotificationMessageAction <bool> >( this, message => { if (message.Notification.Equals(Messages.Progress)) { var view = new Views.ProgressDialog(); Window parentWindow = Window.GetWindow(this); view.Owner = parentWindow; var result = view.ShowDialog(); message.Execute(result.GetValueOrDefault()); } }); }
public CloudExplorer() { InitializeComponent(); this.DataContext = new CloudExplorerViewModel(); this.Unloaded += (s,e) => Messenger.Default.Unregister(this); Messenger.Default.Register<NotificationMessageAction<bool>>( this, message => { if (message.Notification.Equals(Messages.AddCloud)) { var view = new Views.AddCloud(); Window parentWindow = Window.GetWindow(this); view.Owner = parentWindow; var result = view.ShowDialog(); message.Execute(result.GetValueOrDefault()); } }); Messenger.Default.Register<NotificationMessageAction<bool>>( this, message => { if (message.Notification.Equals(Messages.PushApp)) { var view = new Views.Push(); Window parentWindow = Window.GetWindow(this); view.Owner = parentWindow; var result = view.ShowDialog(); message.Execute(result.GetValueOrDefault()); } }); Messenger.Default.Register<NotificationMessageAction<bool>>( this, message => { if (message.Notification.Equals(Messages.UpdateApp)) { var view = new Views.Update(); Window parentWindow = Window.GetWindow(this); view.Owner = parentWindow; var result = view.ShowDialog(); message.Execute(result.GetValueOrDefault()); } }); Messenger.Default.Register<NotificationMessageAction<bool>>( this, message => { if (message.Notification.Equals(Messages.Progress)) { var view = new Views.ProgressDialog(); Window parentWindow = Window.GetWindow(this); view.Owner = parentWindow; var result = view.ShowDialog(); message.Execute(result.GetValueOrDefault()); } }); }
private void UpdateApplication(object sender, EventArgs e) { Project project = vsMonitorSelection.GetActiveProject(); if (project != null) { Guid cloudGuid = GetCurrentCloudGuid(project); ProjectDirectories projectDirectories = GetProjectDirectories(project); Messenger.Default.Register<NotificationMessageAction<Guid>>(this, message => { if (message.Notification.Equals(Messages.SetUpdateAppData)) message.Execute(cloudGuid); }); Messenger.Default.Register<NotificationMessageAction<string>>(this, message => { if (message.Notification.Equals(Messages.SetPushAppDirectory)) message.Execute(projectDirectories.DeployFromPath); }); var window = new Update(); var helper = new WindowInteropHelper(window); helper.Owner = (IntPtr)(dte.MainWindow.HWnd); var result = window.ShowDialog(); if (result.GetValueOrDefault()) { UpdateViewModel modelData = null; Messenger.Default.Send(new NotificationMessageAction<UpdateViewModel>(Messages.GetUpdateAppData, model => modelData = model)); SetCurrentCloudGuid(project, modelData.SelectedCloud.ID); PerformAction("Update Application", project, modelData.SelectedCloud, projectDirectories, (c, d) => { var updateResult = c.Update(modelData.SelectedApplication.Name, d); if (updateResult.Success) c.Restart(new Application() {Name = modelData.SelectedApplication.Name}); return updateResult; }); } } }