private void PushApplication(object sender, EventArgs e)
        {
            Project project = vsMonitorSelection.GetActiveProject();

            if (project != null)
            {
                var cloudGuid          = GetCurrentCloudGuid(project);
                var projectDirectories = GetProjectDirectories(project);

                Messenger.Default.Register <NotificationMessageAction <Guid> >(this,
                                                                               message =>
                {
                    if (message.Notification.Equals(Messages.SetPushAppData))
                    {
                        message.Execute(cloudGuid);
                    }
                });

                Messenger.Default.Register <NotificationMessageAction <string> >(this,
                                                                                 message =>
                {
                    if (message.Notification.Equals(Messages.SetPushAppDirectory))
                    {
                        message.Execute(projectDirectories.DeployFromPath);
                    }
                });

                var window = new Push();
                var helper = new WindowInteropHelper(window);
                helper.Owner = (IntPtr)(dte.MainWindow.HWnd);
                var result = window.ShowDialog();

                if (result.GetValueOrDefault())
                {
                    PushViewModel modelData = null;
                    Messenger.Default.Send(new NotificationMessageAction <PushViewModel>(Messages.GetPushAppData, model => modelData = model));
                    SetCurrentCloudGuid(project, modelData.SelectedCloud.ID);

                    List <string> services = new List <string>();
                    foreach (var provisionedService in modelData.ApplicationServices)
                    {
                        services.Add(provisionedService.Name);
                    }
                    PerformAction("Push Application", project, modelData.SelectedCloud, projectDirectories, (c, d) =>
                                  c.Push(modelData.Name, modelData.Url, Convert.ToUInt16(modelData.Instances), d, Convert.ToUInt32(modelData.SelectedMemory), services.ToArray()));
                }
            }
        }
 int IVsTrackBatchRetargetingEvents.OnBatchRetargetingBegin()
 {
     if (VsVersionHelper.IsVisualStudio2013)
     {
         Project project = _vsMonitorSelection.GetActiveProject();
         if (project != null)
         {
             _platformRetargetingProject = null;
             string frameworkName = project.GetTargetFramework();
             if (NETCore45.Equals(frameworkName, StringComparison.OrdinalIgnoreCase) || Windows80.Equals(frameworkName, StringComparison.OrdinalIgnoreCase))
             {
                 _platformRetargetingProject = project.UniqueName;
             }
         }
     }
     return(VSConstants.S_OK);
 }
Esempio n. 3
0
        int IVsTrackBatchRetargetingEvents.OnBatchRetargetingBegin()
        {
            NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate
            {
                await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                var project = _vsMonitorSelection.GetActiveProject();

                if (project != null)
                {
                    _platformRetargetingProject = null;
                    var frameworkName           = project.GetTargetFrameworkString();
                    if (NETCore45.Equals(frameworkName, StringComparison.OrdinalIgnoreCase) || Windows80.Equals(frameworkName, StringComparison.OrdinalIgnoreCase))
                    {
                        _platformRetargetingProject = project.UniqueName;
                    }
                }
            });

            return(VSConstants.S_OK);
        }