/// <summary>
        /// Initializes the expression designer and opens the expression designer window.
        /// </summary>
        /// <param name="parentWindow">The parent window.</param>
        /// <param name="process">The parent process.</param>
        /// <param name="method">The service method.</param>
        /// <param name="serviceTypes">The collection of known service types.</param>
        /// <param name="saveAction">The save action.</param>
        /// <param name="cancelAction">The cancel action.</param>
        /// <param name="removeAction">The remove action.</param>
        public void EditExpression(
            ITopLevelWindow parentWindow,
            IProcessEdit process,
            ServiceMethodEdit method,
            IEnumerable<ServiceExposedTypeEdit> serviceTypes,
            Action saveAction,
            Action cancelAction,
            Action removeAction)
        {
            SaveAction = saveAction;
            CancelAction = cancelAction;
            RemoveAction = removeAction;
            _knownTypes = serviceTypes.ToArray();

            ExpressionDesigner.Value.LoadFromExpressionObjects(new List<IExpressionObjectBase>());

            WindowManager.Value.ShowStatus(new Status { IsBusy = true });

            var expressions = new List<IExpressionObjectBase>();
            var newExpressions = new List<IExpressionObjectBase>();

            var syncContext = new NotifyClientAction(
                () =>
                {
                    ExpressionDesigner.Value.LoadFromExpressionObjects(expressions);
                    WindowManager.Value.ShowStatus(new Status());
                });

            syncContext.OperationStarted();

            newExpressions.Add(CreateSourceItem(method.InputParameters));
            newExpressions.Add(CreateDestinationItem(process));

            if (!string.IsNullOrWhiteSpace(method.EndpointMapping))
            {
                try
                {
                    var expressionsContainer = Serializer.Deserialize(method.EndpointMapping);
                    expressions.AddRange(expressionsContainer.Expressions);
                }
                catch
                {
                    // Do nothing, new expressions will be used.
                }
            }

            UpdateStateList(process);

            UpdateStoredExpressions(expressions, newExpressions, syncContext);

            syncContext.OperationCompleted();
            WindowManager.Value.ShowChildWindow(parentWindow, this);
        }
예제 #2
0
 private static void Static(WeakEventListener<ServiceMethodViewModel, ServiceMethodEdit, PropertyChangedEventArgs> listener, ServiceMethodEdit source)
 {
     source.PropertyChanged -= listener.OnEvent;
 }
예제 #3
0
        /// <summary>
        /// Refreshes the specified model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The <paramref name="model"/> parameter is null.
        /// </exception>
        public void Refresh(ServiceMethodEdit model)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            Model = model;
            RaisePropertyChanged(() => ResultTypeGuid);
            RaisePropertyChanged(() => HasResultType);
        }
예제 #4
0
        /// <summary>
        /// Initializes the specified model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="parentViewModel">The parent view model.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The <paramref name="model"/> parameter is null.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// The <paramref name="parentViewModel"/> parameter is null.
        /// </exception>
        public void Initialize(ServiceMethodEdit model, IServiceCreationSettingsViewModel parentViewModel)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            if (parentViewModel == null)
                throw new ArgumentNullException("parentViewModel");

            ParentViewModel = parentViewModel;

            Refresh(model);
        }
        /// <summary>
        /// Opens the expression designer window.
        /// </summary>
        /// <param name="parentWindow">
        /// The parent window.
        /// </param>
        /// <param name="process">
        /// The process.
        /// </param>
        /// <param name="method">
        /// The method.
        /// </param>
        /// <param name="serviceTypes">
        /// The service types.
        /// </param>
        public void EditExpression(
            ITopLevelWindow parentWindow,
            IProcessEdit process,
            ServiceMethodEdit method,
            IEnumerable<ServiceExposedTypeEdit> serviceTypes)
        {
            if (parentWindow == null)
                throw new ArgumentNullException("parentWindow");

            if (process == null)
                throw new ArgumentNullException("process");

            if (method == null)
                throw new ArgumentNullException("method");

            if (serviceTypes == null)
                throw new ArgumentNullException("serviceTypes");

            _method = method;
            _knownTypes = serviceTypes.ToArray();

            ExpressionDesigner.Value.LoadFromExpressionObjects(new List<IExpressionObjectBase>());

            WindowManager.Value.ShowStatus(new Status { IsBusy = true });

            var expressions = new List<IExpressionObjectBase>();
            var newExpressions = new List<IExpressionObjectBase>();

            var syncContext = new NotifyClientAction(
                () =>
                {
                    ExpressionDesigner.Value.LoadFromExpressionObjects(expressions);
                    WindowManager.Value.ShowStatus(new Status());
                });

            syncContext.OperationStarted();

            newExpressions.Add(CreateSourceItem(process));
            newExpressions.Add(CreateDestinationItem(method.ResultTypeGuid));

            if (!string.IsNullOrWhiteSpace(method.ResultMapping))
            {
                try
                {
                    var expressionsContainer = Serializer.Deserialize(method.ResultMapping);
                    expressions.AddRange(expressionsContainer.Expressions);
                }
                catch
                {
                    // Do nothing, new expressions will be used.
                }
            }

            UpdateStateList(process);

            UpdateStoredExpressions(expressions, newExpressions, syncContext);

            syncContext.OperationCompleted();
            WindowManager.Value.ShowChildWindow(parentWindow, this);
        }
        /// <summary>
        /// Invoked when window is closed. Clears ViewModel's resources on invocation.
        /// </summary>
        protected override void OnClosed()
        {
            base.OnClosed();

            _method = null;
            _knownTypes = null;
        }