Ejemplo n.º 1
0
        public WorkSurfaceContextViewModel(IEventAggregator eventPublisher, WorkSurfaceKey workSurfaceKey, IWorkSurfaceViewModel workSurfaceViewModel, IPopupController popupController, Action <IContextualResourceModel, bool, System.Action> saveDialogAction)
            : base(eventPublisher)
        {
            if (workSurfaceKey == null)
            {
                throw new ArgumentNullException(nameof(workSurfaceKey));
            }
            if (workSurfaceViewModel == null)
            {
                throw new ArgumentNullException(nameof(workSurfaceViewModel));
            }
            VerifyArgument.IsNotNull("popupController", popupController);
            WorkSurfaceKey       = workSurfaceKey;
            WorkSurfaceViewModel = workSurfaceViewModel;

            _windowManager = CustomContainer.Get <IWindowManager>();

            var model = WorkSurfaceViewModel as IWorkflowDesignerViewModel;

            if (model != null)
            {
                model.WorkflowChanged += UpdateForWorkflowChange;
                _server = model.Server;
                if (_server != null)
                {
                    _server.IsConnectedChanged += EnvironmentModelOnIsConnectedChanged();
                    _server.Connection.ReceivedResourceAffectedMessage += OnReceivedResourceAffectedMessage;
                }
            }

            _popupController  = popupController;
            _saveDialogAction = saveDialogAction;
        }
        public WorkSurfaceContextViewModel(IEventAggregator eventPublisher, WorkSurfaceKey workSurfaceKey, IWorkSurfaceViewModel workSurfaceViewModel, IPopupController popupController, Action <IContextualResourceModel, bool> saveDialogAction)
            : base(eventPublisher)
        {
            if (workSurfaceKey == null)
            {
                throw new ArgumentNullException("workSurfaceKey");
            }
            if (workSurfaceViewModel == null)
            {
                throw new ArgumentNullException("workSurfaceViewModel");
            }
            VerifyArgument.IsNotNull("popupController", popupController);
            WorkSurfaceKey       = workSurfaceKey;
            WorkSurfaceViewModel = workSurfaceViewModel;

            _windowManager           = CustomContainer.Get <IWindowManager>();
            _workspaceItemRepository = WorkspaceItemRepository.Instance;

            var model = WorkSurfaceViewModel as IWorkflowDesignerViewModel;

            if (model != null)
            {
                _environmentModel = model.EnvironmentModel;
                if (_environmentModel != null)
                {
                    // MUST use connection server event publisher - debug events are published from the server!
                    DebugOutputViewModel = new DebugOutputViewModel(_environmentModel.Connection.ServerEvents, EnvironmentRepository.Instance, new DebugOutputFilterStrategy());
                    _environmentModel.IsConnectedChanged += EnvironmentModelOnIsConnectedChanged();
                    _environmentModel.Connection.ReceivedResourceAffectedMessage += OnReceivedResourceAffectedMessage;
                }
            }

            if (WorkSurfaceKey.WorkSurfaceContext == WorkSurfaceContext.Scheduler)
            {
                if (DebugOutputViewModel == null)
                {
                    DebugOutputViewModel = new DebugOutputViewModel(new EventPublisher(), EnvironmentRepository.Instance, new DebugOutputFilterStrategy());
                }
            }
            _popupController  = popupController;
            _saveDialogAction = saveDialogAction;
        }
 public TestWorkSurfaceContextViewModel(IEventAggregator eventPublisher, WorkSurfaceKey workSurfaceKey, IWorkSurfaceViewModel workSurfaceViewModel)
     : base(eventPublisher, workSurfaceKey, workSurfaceViewModel, new Mock<IPopupController>().Object, (a, b) => { })
 {
 }
 public TestWorkSurfaceContextViewModel(WorkSurfaceKey workSurfaceKey, IWorkSurfaceViewModel workSurfaceViewModel)
     : base(workSurfaceKey, workSurfaceViewModel)
 {
 }
 public WorkSurfaceContextViewModel(WorkSurfaceKey workSurfaceKey, IWorkSurfaceViewModel workSurfaceViewModel)
     : this(EventPublishers.Aggregator, workSurfaceKey, workSurfaceViewModel, new PopupController(), (a, b) => RootWebSite.ShowNewWorkflowSaveDialog(a, null, b))
 {
 }