Пример #1
0
 private void Done()
 {
     if (!IsWorstErrorReadOnly)
     {
         ValidationMemoManager.FixErrors();
     }
 }
Пример #2
0
        public ServiceDesignerViewModel(ModelItem modelItem, IContextualResourceModel rootModel, IServerRepository serverRepository, IEventAggregator eventPublisher, IAsyncWorker asyncWorker)
            : base(modelItem)
        {
            ValidationMemoManager = new ValidationMemoManager(this);
            MappingManager        = new MappingManager(this);
            if (modelItem.ItemType != typeof(DsfDatabaseActivity) && modelItem.ItemType != typeof(DsfPluginActivity) && modelItem.ItemType != typeof(DsfWebserviceActivity))
            {
                AddTitleBarEditToggle();
            }
            AddTitleBarMappingToggle();

            VerifyArgument.IsNotNull("rootModel", rootModel);
            VerifyArgument.IsNotNull("environmentRepository", serverRepository);
            VerifyArgument.IsNotNull("eventPublisher", eventPublisher);
            VerifyArgument.IsNotNull("asyncWorker", asyncWorker);

            _worker         = asyncWorker;
            _eventPublisher = eventPublisher;
            eventPublisher.Subscribe(this);
            ButtonDisplayValue = DoneText;

            ShowExampleWorkflowLink = Visibility.Collapsed;
            RootModel = rootModel;
            ValidationMemoManager.DesignValidationErrors = new ObservableCollection <IErrorInfo>();
            FixErrorsCommand = new DelegateCommand(o =>
            {
                ValidationMemoManager.FixErrors();
                IsFixed = IsWorstErrorReadOnly;
            });
            DoneCommand          = new DelegateCommand(o => Done());
            DoneCompletedCommand = new DelegateCommand(o => DoneCompleted());

            InitializeDisplayName();

            InitializeImageSource();

            IsAsyncVisible       = ActivityTypeToActionTypeConverter.ConvertToActionType(Type) == Common.Interfaces.Core.DynamicServices.enActionType.Workflow;
            OutputMappingEnabled = !RunWorkflowAsync;

            var activeEnvironment = serverRepository.ActiveServer;

            if (EnvironmentID == Guid.Empty && !activeEnvironment.IsLocalHostCheck())
            {
                _environment = activeEnvironment;
            }
            else
            {
                var environment = serverRepository.FindSingle(c => c.EnvironmentID == EnvironmentID);
                if (environment == null)
                {
                    IList <IServer> environments = ServerRepository.Instance.LookupEnvironments(activeEnvironment);
                    environment = environments.FirstOrDefault(model => model.EnvironmentID == EnvironmentID);
                }
                _environment = environment;
            }

            ValidationMemoManager.InitializeValidationService(_environment);
            IsLoading = true;
            _worker.Start(() => InitializeResourceModel(_environment), b =>
            {
                if (b)
                {
                    UpdateDesignerAfterResourceLoad(serverRepository);
                }
            });

            ViewComplexObjectsCommand = new RelayCommand(item =>
            {
                ViewJsonObjects(item as IComplexObjectItemModel);
            }, CanViewComplexObjects);
        }