Esempio n. 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;
        }
        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;
        }
Esempio n. 3
0
 public SingleExplorerDeployViewModel(IDeployDestinationExplorerViewModel destination, IDeploySourceExplorerViewModel source, IEnumerable <IExplorerTreeItem> selectedItems, IDeployStatsViewerViewModel stats, IShellViewModel shell, IPopupController popupController)
     : this(destination, source, selectedItems, stats, shell, popupController, null)
 {
 }