コード例 #1
0
        public SingleExplorerDeployViewModel(IDeployDestinationExplorerViewModel destination, IDeploySourceExplorerViewModel source, IEnumerable <IExplorerTreeItem> selectedItems, IDeployStatsViewerViewModel stats, IShellViewModel shell, IPopupController popupController, IAsyncWorker asyncWorker)
        {
            VerifyArgument.AreNotNull(new Dictionary <string, object> {
                { "destination", destination }, { "source", source }, { "selectedItems", selectedItems }, { "stats", stats }, { "popupController", popupController }
            });
            _destination = destination;

            PopupController = popupController;

            _source             = source;
            _errorMessage       = "";
            _source.Preselected = selectedItems;
            _stats = stats;
            _shell = shell;
            _stats.CalculateAction = () =>
            {
                IsDeployLoading        = true;
                ServicesCount          = _stats.Services.ToString();
                SourcesCount           = _stats.Sources.ToString();
                TestsCount             = _stats.Tests.ToString();
                TriggersCount          = _stats.Triggers.ToString();
                NewResourcesCount      = _stats.NewResources.ToString();
                NewTestsCount          = _stats.NewTests.ToString();
                NewTriggersCount       = _stats.NewTriggers.ToString();
                OverridesCount         = _stats.Overrides.ToString();
                OverridesTestsCount    = _stats.OverridesTests.ToString();
                OverridesTriggersCount = _stats.OverridesTriggers.ToString();
                ConflictItems          = _stats.Conflicts;
                NewItems      = _stats.New;
                ShowConflicts = false;
                ViewModelUtils.RaiseCanExecuteChanged(DeployCommand);
                IsDeployLoading = false;
            };
            SourceConnectControlViewModel      = _source.ConnectControlViewModel;
            DestinationConnectControlViewModel = _destination.ConnectControlViewModel;

            SourceConnectControlViewModel.SelectedEnvironmentChanged      += UpdateServerCompareChanged;
            DestinationConnectControlViewModel.SelectedEnvironmentChanged += UpdateServerCompareChanged;
            DeployCommand                   = new DelegateCommand(Deploy, () => CanDeploy);
            SelectDependenciesCommand       = new DelegateCommand(SelectDependencies, () => CanSelectDependencies);
            NewResourcesViewCommand         = new DelegateCommand(ViewNewResources);
            OverridesViewCommand            = new DelegateCommand(ViewOverrides);
            Destination.ServerStateChanged += DestinationServerStateChanged;
            Destination.PropertyChanged    += DestinationOnPropertyChanged;
            ShowConflicts                   = false;
        }
コード例 #2
0
        public DeploySourceExplorerViewModel(IShellViewModel shellViewModel, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IDeployStatsViewerViewModel statsArea, IEnvironmentViewModel selectedEnvironment)
        {
            if (shellViewModel == null)
            {
                throw new ArgumentNullException(nameof(shellViewModel));
            }
            var localhostEnvironment = CreateEnvironmentFromServer(shellViewModel.LocalhostServer, shellViewModel);

            _shellViewModel = shellViewModel;
            _selectAction   = SelectAction;
            _selectedEnv    = selectedEnvironment;

            Environments = new ObservableCollection <IEnvironmentViewModel> {
                localhostEnvironment
            };
            LoadLocalHostEnvironment(localhostEnvironment);
            ConnectControlViewModel = new ConnectControlViewModel(_shellViewModel.LocalhostServer, aggregator, _shellViewModel.ExplorerViewModel.ConnectControlViewModel.Servers);

            ShowConnectControl = true;
            ConnectControlViewModel.ServerDisconnected += ServerDisconnected;
            _statsArea = statsArea;
            foreach (var environmentViewModel in _environments)
            {
                environmentViewModel.SelectAction = SelectAction;
            }

            if (ConnectControlViewModel.SelectedConnection != null && !ConnectControlViewModel.SelectedConnection.IsLocalHost)
            {
                UpdateItemForDeploy(ConnectControlViewModel.SelectedConnection.EnvironmentID);
            }
            IsRefreshing       = false;
            ShowConnectControl = false;
            RefreshCommand     = new Microsoft.Practices.Prism.Commands.DelegateCommand(() => RefreshEnvironment(SelectedEnvironment.ResourceId));
            ConnectControlViewModel.SelectedEnvironmentChanged += ConnectControlSelectedExplorerEnvironmentChanged;
            ConnectControlViewModel.ServerConnected            += (sender, server) =>
            {
                IsDeployLoading = true;
                ServerConnectedAsync(server).ContinueWith(t =>
                {
                    IsDeployLoading = false;
                }, TaskContinuationOptions.ExecuteSynchronously);
            };
            IsDeploy = true;
        }
コード例 #3
0
        public SingleExplorerDeployViewModel(IDeployDestinationExplorerViewModel destination, IDeploySourceExplorerViewModel source, IEnumerable <IExplorerTreeItem> selectedItems, IDeployStatsViewerViewModel stats, IShellViewModel shell, IPopupController popupController)
        {
            VerifyArgument.AreNotNull(new Dictionary <string, object> {
                { "destination", destination }, { "source", source }, { "selectedItems", selectedItems }, { "stats", stats }, { "popupController", popupController }
            });
            _destination = destination;
            // ReSharper disable once VirtualMemberCallInContructor
            PopupController = popupController;

            _source             = source;
            _errorMessage       = "";
            _source.Preselected = selectedItems;
            _stats = stats;
            _shell = shell;
            _stats.CalculateAction = () =>
            {
                ServicesCount     = _stats.Services.ToString();
                SourcesCount      = _stats.Sources.ToString();
                NewResourcesCount = _stats.NewResources.ToString();
                OverridesCount    = _stats.Overrides.ToString();
                ConflictItems     = _stats.Conflicts;
                NewItems          = _stats.New;
                ShowConflicts     = false;
                if (!string.IsNullOrEmpty(_stats.RenameErrors))
                {
                    PopupController.ShowDeployNameConflict(_stats.RenameErrors);
                }
                ViewModelUtils.RaiseCanExecuteChanged(DeployCommand);
            };
            SourceConnectControlViewModel      = _source.ConnectControlViewModel;
            DestinationConnectControlViewModel = _destination.ConnectControlViewModel;

            SourceConnectControlViewModel.SelectedEnvironmentChanged      += UpdateServerCompareChanged;
            DestinationConnectControlViewModel.SelectedEnvironmentChanged += UpdateServerCompareChanged;
            DeployCommand                   = new DelegateCommand(Deploy, () => CanDeploy);
            SelectDependenciesCommand       = new DelegateCommand(SelectDependencies, () => CanSelectDependencies);
            NewResourcesViewCommand         = new DelegateCommand(ViewNewResources);
            OverridesViewCommand            = new DelegateCommand(ViewOverrides);
            Destination.ServerStateChanged += DestinationServerStateChanged;
            Destination.PropertyChanged    += DestinationOnPropertyChanged;
            ShowConflicts                   = false;
        }
コード例 #4
0
        public DeploySourceExplorerViewModel(IShellViewModel shellViewModel, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IDeployStatsViewerViewModel statsArea)
        {
            if (shellViewModel == null)
            {
                throw new ArgumentNullException(nameof(shellViewModel));
            }
            var localhostEnvironment = CreateEnvironmentFromServer(shellViewModel.LocalhostServer, shellViewModel);

            _shellViewModel = shellViewModel;
            _selectAction   = SelectAction;
            // ReSharper disable once VirtualMemberCallInContructor
            Environments = new ObservableCollection <IEnvironmentViewModel> {
                localhostEnvironment
            };
            // ReSharper disable once VirtualMemberCallInContructor
            LoadEnvironment(localhostEnvironment);

            ConnectControlViewModel = new ConnectControlViewModel(_shellViewModel.LocalhostServer, aggregator, _shellViewModel.ExplorerViewModel.ConnectControlViewModel.Servers);

            ShowConnectControl = true;
            ConnectControlViewModel.ServerConnected    += async(sender, server) => { await ServerConnected(sender, server); };
            ConnectControlViewModel.ServerDisconnected += ServerDisconnected;
            _statsArea = statsArea;
            foreach (var environmentViewModel in _environments)
            {
                environmentViewModel.SelectAction = SelectAction;
            }

            if (ConnectControlViewModel.SelectedConnection != null)
            {
                UpdateItemForDeploy(ConnectControlViewModel.SelectedConnection.EnvironmentID);
            }
            IsRefreshing       = false;
            ShowConnectControl = false;
            RefreshCommand     = new Microsoft.Practices.Prism.Commands.DelegateCommand(() => RefreshEnvironment(SelectedEnvironment.ResourceId));
            ConnectControlViewModel.SelectedEnvironmentChanged += async(sender, id) =>
            {
                await DeploySourceExplorerViewModelSelectedEnvironmentChanged(sender, id);
            };
            IsDeploy = true;
        }
コード例 #5
0
 public DeploySourceExplorerViewModel(IShellViewModel shellViewModel, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IDeployStatsViewerViewModel statsArea)
     : this(shellViewModel, aggregator, statsArea, null)
 {
 }
コード例 #6
0
 public SingleExplorerDeployViewModel(IDeployDestinationExplorerViewModel destination, IDeploySourceExplorerViewModel source, IEnumerable <IExplorerTreeItem> selectedItems, IDeployStatsViewerViewModel stats, IShellViewModel shell, IPopupController popupController)
     : this(destination, source, selectedItems, stats, shell, popupController, null)
 {
 }
コード例 #7
0
 public DeploySourceExplorerViewModelForTesting(IShellViewModel shellViewModel, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IDeployStatsViewerViewModel statsArea)
     : base(shellViewModel, aggregator, statsArea)
 {
     // ReSharper disable once VirtualMemberCallInContructor
     SelectedItems = new List <IExplorerTreeItem>();
 }
コード例 #8
0
 public DeploySourceExplorerViewModelForTesting(IShellViewModel shellViewModel, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IDeployStatsViewerViewModel statsArea)
     : base(shellViewModel, aggregator, statsArea)
 {
     SelectedItems = new List <IExplorerTreeItem>();
 }