protected override void Initialize()
        {
            base.Initialize();

            vsMonitorSelection = (IVsMonitorSelection)GetService(typeof(IVsMonitorSelection));
            dte = GetService(typeof(SDTE)) as DTE;

            if (provider == null)
            {
                var preferences = new PreferencesProvider("VisualStudio2010");
                provider = new CloudFoundryProvider(preferences);
            }

            var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (null != mcs)
            {
                mcs.AddCommand(new MenuCommand(CloudFoundryExplorer,
                               new CommandID(GuidList.guidCloudFoundryCmdSet,
                               (int)PkgCmdIDList.cmdidCloudFoundryExplorer)));

                mcs.AddCommand(new MenuCommand(PushApplication,
                               new CommandID(GuidList.guidCloudFoundryCmdSet,
                               (int)PkgCmdIDList.cmdidPushCloudFoundryApplication)));

                mcs.AddCommand(new MenuCommand(UpdateApplication,
                               new CommandID(GuidList.guidCloudFoundryCmdSet,
                               (int)PkgCmdIDList.cmdidUpdateCloudFoundryApplication)));
            }
        }
 public InstanceTreeViewItemViewModel(Instance instance, ApplicationTreeViewItemViewModel parentApplication)
     : base(parentApplication, true)
 {
     Messenger.Default.Send<NotificationMessageAction<ICloudFoundryProvider>>(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
     this.app = parentApplication.Application;
     this.instance = instance;
     this.dispatcher = Dispatcher.CurrentDispatcher;
 }
 public FolderTreeViewItemViewModel(string name, string path, CloudFoundry.Net.Types.Application app, ushort id)
     : base(null, true)
 {
     Messenger.Default.Send<NotificationMessageAction<ICloudFoundryProvider>>(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
     this.name = name;
     this.app = app;
     this.path = path;
     this.id = id;
 }
Пример #4
0
 public ExplorerViewModel()
 {
     CloseCloudCommand = new RelayCommand<CloudViewModel>(CloseCloud);
     Messenger.Default.Send(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
     Messenger.Default.Register<NotificationMessage<Cloud>>(this, ProcessCloudNotification);
     Messenger.Default.Register<NotificationMessage<Application>>(this, ProcessApplicationNotification);
     Messenger.Default.Register<NotificationMessage<string>>(this, ProcessErrorMessage);
     this.provider.CloudsChanged += CloudsCollectionChanged;
 }
Пример #5
0
        public DialogViewModel(string resultMessageId)
        {
            Messenger.Default.Send<NotificationMessageAction<ICloudFoundryProvider>>(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
            this.resultMessageId = resultMessageId;
            this.ConfirmedCommand = new RelayCommand(Confirmed, CanExecuteConfirmed);
            this.CancelledCommand = new RelayCommand(Cancelled, CanExecuteCancelled);

            InitializeData();
            RegisterGetData();
        }
Пример #6
0
 public CloudExplorerViewModel()
 {
     Messenger.Default.Send(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, (p) => this.provider = p));
     this.dispatcher = Dispatcher.CurrentDispatcher;
     AddCloudCommand = new RelayCommand(AddCloud);
     PushAppCommand = new RelayCommand(PushApp);
     UpdateAppCommand = new RelayCommand(UpdateApp);
     foreach (var cloud in provider.Clouds)
         clouds.Add(new CloudTreeViewItemViewModel(cloud));
     this.provider.CloudsChanged += CloudsCollectionChanged;
 }
 public FileTreeViewItemViewModel(string name, string path, CloudFoundry.Net.Types.Application app, ushort id)
     : base(null, true)
 {
     Messenger.Default.Send<NotificationMessageAction<ICloudFoundryProvider>>(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
     this.name = name;
     this.app = app;
     this.path = path;
     this.id = id;
     this.fileExtension = System.IO.Path.GetExtension(name);
     OpenFileCommand = new RelayCommand<MouseButtonEventArgs>(OpenFile);
     OpenFileFromContextCommand = new RelayCommand(OpenFileFromContext);
 }
        public ApplicationTreeViewItemViewModel(Application application, CloudTreeViewItemViewModel parentCloud)
            : base(parentCloud, true)
        {
            Messenger.Default.Send<NotificationMessageAction<ICloudFoundryProvider>>(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
            OpenApplicationCommand = new RelayCommand<MouseButtonEventArgs>(OpenApplication);
            StartApplicationCommand = new RelayCommand(StartApplication, CanStart);
            StopApplicationCommand = new RelayCommand(StopApplication, CanStop);
            RestartApplicationCommand = new RelayCommand(RestartApplication, CanStop);
            DeleteApplicationCommand = new RelayCommand(DeleteApplication);

            this.Application = application;
            this.Application.InstanceCollection.CollectionChanged += InstanceCollection_CollectionChanged;
            this.dispatcher = Dispatcher.CurrentDispatcher;
        }
        public CloudTreeViewItemViewModel(Cloud cloud)
            : base(null, false)
        {
            Messenger.Default.Send<NotificationMessageAction<ICloudFoundryProvider>>(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
            OpenCloudCommand = new RelayCommand<MouseButtonEventArgs>(OpenCloud);
            RemoveCloudCommand = new RelayCommand(RemoveCloud);
            ConnectCommand = new RelayCommand(Connect, CanExecuteConnect);
            DisconnectCommand = new RelayCommand(Disconnect, CanExecuteDisconnect);
            RefreshCommand = new RelayCommand(Refresh);

            this.Cloud = cloud;
            if (Cloud.IsConnected)
                foreach (var application in Cloud.Applications)
                    Children.Add(new ApplicationTreeViewItemViewModel(application, this));

            this.Cloud.Applications.CollectionChanged += Applications_CollectionChanged;
            connector.DoWork += BeginConnect;
            connector.RunWorkerCompleted += EndConnect;
            connector.RunWorkerAsync();
        }
Пример #10
0
        public CloudViewModel(Cloud cloud)
        {
            Messenger.Default.Send(new NotificationMessageAction<ICloudFoundryProvider>(
                                       Messages.GetCloudFoundryProvider, p => provider = p));
            dispatcher = Dispatcher.CurrentDispatcher;
            Cloud = cloud;

            ChangePasswordCommand           = new RelayCommand(ChangePassword);
            ValidateAccountCommand          = new RelayCommand(ValidateAccount, CanExecuteValidateAccount);
            ConnectCommand                  = new RelayCommand(Connect, CanExecuteConnect);
            DisconnectCommand               = new RelayCommand(Disconnect, CanExecuteDisconnect);
            StartCommand                    = new RelayCommand(Start, CanExecuteStart);
            StopCommand                     = new RelayCommand(Stop, CanExecuteStopActions);
            RestartCommand                  = new RelayCommand(Restart, CanExecuteStopActions);
            ManageApplicationUrlsCommand    = new RelayCommand(ManageApplicationUrls);
            RemoveApplicationServiceCommand = new RelayCommand(RemoveApplicationService);
            ProvisionServiceCommand         = new RelayCommand(CreateService);
            RefreshCommand                  = new RelayCommand(Refresh, CanExecuteRefresh);
            DeleteApplicationCommand        = new RelayCommand(DeleteApplication);
        }
        public CloudExplorerViewModel()
        {
            Messenger.Default.Send(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, (p) => provider = p));
            dispatcher = Dispatcher.CurrentDispatcher;

            PushAppCommand = new RelayCommand(PushApp);
            UpdateAppCommand = new RelayCommand(UpdateApp);
            PreferencesCommand = new RelayCommand(Preferences);

            if (null != provider)
            {
                if (null != provider.Clouds)
                {
                    foreach (Cloud cloud in provider.Clouds)
                    {
                        clouds.Add(new CloudTreeViewItemViewModel(cloud));
                    }
                }
                provider.CloudAdded += provider_CloudAdded;
                provider.CloudRemoved += provider_CloudRemoved;
            }
        }
Пример #12
0
        public CloudViewModel(Cloud cloud)
        {
            Messenger.Default.Send(new NotificationMessageAction<ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
            this.dispatcher = Dispatcher.CurrentDispatcher;
            this.Cloud = cloud;

            ChangePasswordCommand = new RelayCommand(ChangePassword);
            ValidateAccountCommand = new RelayCommand(ValidateAccount, CanExecuteValidateAccount);
            ConnectCommand = new RelayCommand(Connect, CanExecuteConnect);
            DisconnectCommand = new RelayCommand(Disconnect, CanExecuteDisconnect);
            StartCommand = new RelayCommand(Start, CanExecuteStart);
            StopCommand = new RelayCommand(Stop, CanExecuteStopActions);
            RestartCommand = new RelayCommand(Restart, CanExecuteStopActions);
            ManageApplicationUrlsCommand = new RelayCommand(ManageApplicationUrls);
            RemoveApplicationServiceCommand = new RelayCommand(RemoveApplicationService);
            ProvisionServiceCommand = new RelayCommand(CreateService);
            RefreshCommand = new RelayCommand(Refresh, CanExecuteRefresh);
            DeleteApplicationCommand = new RelayCommand(DeleteApplication);

            var instanceTimer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(3)};
            instanceTimer.Tick += RefreshApplication;
            instanceTimer.Start();
        }
        public CloudTreeViewItemViewModel(Cloud cloud)
            : base(null, false)
        {
            Messenger.Default.Send(new NotificationMessageAction <ICloudFoundryProvider>(
                                       Messages.GetCloudFoundryProvider,
                                       p =>
            {
                provider = p;
                provider.CloudChanged += provider_CloudChanged;
            }));

            OpenCloudCommand   = new RelayCommand <MouseButtonEventArgs>(OpenCloud);
            RemoveCloudCommand = new RelayCommand(RemoveCloud);
            ConnectCommand     = new RelayCommand(Connect, CanExecuteConnect);
            DisconnectCommand  = new RelayCommand(Disconnect, CanExecuteDisconnect);
            RefreshCommand     = new RelayCommand(Refresh);

            Cloud = cloud;
            if (Cloud.IsConnected)
            {
                foreach (Application application in Cloud.Applications)
                {
                    Children.Add(new ApplicationTreeViewItemViewModel(application, this));
                }
            }

            Cloud.Applications.CollectionChanged += Applications_CollectionChanged;
            connector.DoWork             += BeginConnect;
            connector.RunWorkerCompleted += EndConnect;
            lock (connector)
            {
                if (false == connector.IsBusy)
                {
                    connector.RunWorkerAsync();
                }
            }
        }
Пример #14
0
 public CloudExplorerViewModel()
 {
     Messenger.Default.Send(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, (p) => this.provider = p));
     this.dispatcher  = Dispatcher.CurrentDispatcher;
     AddCloudCommand  = new RelayCommand(AddCloud);
     PushAppCommand   = new RelayCommand(PushApp);
     UpdateAppCommand = new RelayCommand(UpdateApp);
     foreach (var cloud in provider.Clouds)
     {
         clouds.Add(new CloudTreeViewItemViewModel(cloud));
     }
     this.provider.CloudsChanged += CloudsCollectionChanged;
 }
Пример #15
0
 public FileTreeViewItemViewModel(string name, string path, CloudFoundry.Net.Types.Application app, ushort id)
     : base(null, true)
 {
     Messenger.Default.Send <NotificationMessageAction <ICloudFoundryProvider> >(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
     this.name                  = name;
     this.app                   = app;
     this.path                  = path;
     this.id                    = id;
     this.fileExtension         = System.IO.Path.GetExtension(name);
     OpenFileCommand            = new RelayCommand <MouseButtonEventArgs>(OpenFile);
     OpenFileFromContextCommand = new RelayCommand(OpenFileFromContext);
 }
        public CloudExplorerViewModel()
        {
            Messenger.Default.Send(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, (p) => provider = p));
            dispatcher = Dispatcher.CurrentDispatcher;

            PushAppCommand     = new RelayCommand(PushApp);
            UpdateAppCommand   = new RelayCommand(UpdateApp);
            PreferencesCommand = new RelayCommand(Preferences);

            if (null != provider)
            {
                if (null != provider.Clouds)
                {
                    foreach (Cloud cloud in provider.Clouds)
                    {
                        clouds.Add(new CloudTreeViewItemViewModel(cloud));
                    }
                }
                provider.CloudAdded   += provider_CloudAdded;
                provider.CloudRemoved += provider_CloudRemoved;
            }
        }
Пример #17
0
 public InstanceTreeViewItemViewModel(Instance instance, ApplicationTreeViewItemViewModel parentApplication) : base(parentApplication, true)
 {
     Messenger.Default.Send <NotificationMessageAction <ICloudFoundryProvider> >(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
     this.app        = parentApplication.Application;
     this.instance   = instance;
     this.dispatcher = Dispatcher.CurrentDispatcher;
 }
Пример #18
0
 public ExplorerViewModel()
 {
     CloseCloudCommand = new RelayCommand <CloudViewModel>(CloseCloud);
     Messenger.Default.Send(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
     Messenger.Default.Register <NotificationMessage <Cloud> >(this, ProcessCloudNotification);
     Messenger.Default.Register <NotificationMessage <Application> >(this, ProcessApplicationNotification);
     Messenger.Default.Register <NotificationMessage <string> >(this, ProcessErrorMessage);
     this.provider.CloudsChanged += CloudsCollectionChanged;
 }
Пример #19
0
 public FolderTreeViewItemViewModel(string name, string path, CloudFoundry.Net.Types.Application app, ushort id)
     : base(null, true)
 {
     Messenger.Default.Send <NotificationMessageAction <ICloudFoundryProvider> >(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
     this.name = name;
     this.app  = app;
     this.path = path;
     this.id   = id;
 }
        public ApplicationTreeViewItemViewModel(Application application, CloudTreeViewItemViewModel parentCloud) : base(parentCloud, true)
        {
            Messenger.Default.Send <NotificationMessageAction <ICloudFoundryProvider> >(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
            OpenApplicationCommand    = new RelayCommand <MouseButtonEventArgs>(OpenApplication);
            StartApplicationCommand   = new RelayCommand(StartApplication, CanStart);
            StopApplicationCommand    = new RelayCommand(StopApplication, CanStop);
            RestartApplicationCommand = new RelayCommand(RestartApplication, CanStop);
            DeleteApplicationCommand  = new RelayCommand(DeleteApplication);

            this.Application = application;
            this.Application.InstanceCollection.CollectionChanged += InstanceCollection_CollectionChanged;
            this.dispatcher = Dispatcher.CurrentDispatcher;
        }
Пример #21
0
        public DialogViewModel(string resultMessageId)
        {
            Messenger.Default.Send <NotificationMessageAction <ICloudFoundryProvider> >(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
            this.resultMessageId  = resultMessageId;
            this.ConfirmedCommand = new RelayCommand(Confirmed, CanExecuteConfirmed);
            this.CancelledCommand = new RelayCommand(Cancelled, CanExecuteCancelled);

            InitializeData();
            RegisterGetData();
        }
Пример #22
0
        public CloudViewModel(Cloud cloud)
        {
            Messenger.Default.Send(new NotificationMessageAction <ICloudFoundryProvider>(Messages.GetCloudFoundryProvider, p => this.provider = p));
            this.dispatcher = Dispatcher.CurrentDispatcher;
            this.Cloud      = cloud;

            ChangePasswordCommand           = new RelayCommand(ChangePassword);
            ValidateAccountCommand          = new RelayCommand(ValidateAccount, CanExecuteValidateAccount);
            ConnectCommand                  = new RelayCommand(Connect, CanExecuteConnect);
            DisconnectCommand               = new RelayCommand(Disconnect, CanExecuteDisconnect);
            StartCommand                    = new RelayCommand(Start, CanExecuteStart);
            StopCommand                     = new RelayCommand(Stop, CanExecuteStopActions);
            RestartCommand                  = new RelayCommand(Restart, CanExecuteStopActions);
            ManageApplicationUrlsCommand    = new RelayCommand(ManageApplicationUrls);
            RemoveApplicationServiceCommand = new RelayCommand(RemoveApplicationService);
            ProvisionServiceCommand         = new RelayCommand(CreateService);
            RefreshCommand                  = new RelayCommand(Refresh, CanExecuteRefresh);
            DeleteApplicationCommand        = new RelayCommand(DeleteApplication);

            var instanceTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(3)
            };

            instanceTimer.Tick += RefreshApplication;
            instanceTimer.Start();
        }