Example #1
0
        public override IList <IToolRegion> BuildRegions()
        {
            IList <IToolRegion> regions = new List <IToolRegion>();

            if (SourceRegion == null)
            {
                AddSourceRegion(regions);
                AddNamespaceRegion(regions);
                AddActionRegion(regions);
                InputArea = new DotNetInputRegion(ModelItem, ActionRegion);
                regions.Add(InputArea);
                OutputsRegion = new OutputsRegion(ModelItem, true);
                regions.Add(OutputsRegion);
                if (OutputsRegion.Outputs.Count > 0)
                {
                    OutputsRegion.IsEnabled = true;
                }
                ErrorRegion = new ErrorRegion();
                regions.Add(ErrorRegion);
                SourceRegion.Dependants.Add(NamespaceRegion);
                NamespaceRegion.Dependants.Add(ActionRegion);
                ActionRegion.Dependants.Add(InputArea);
                ActionRegion.Dependants.Add(OutputsRegion);
            }
            regions.Add(ManageServiceInputViewModel);
            Regions = regions;
            return(regions);
        }
        public override IList <IToolRegion> BuildRegions()
        {
            IList <IToolRegion> regions = new List <IToolRegion>();

            if (SourceRegion == null)
            {
                SourceRegion = new WebSourceRegion(Model, ModelItem)
                {
                    SourceChangedAction = () => { OutputsRegion.IsEnabled = false; }
                };
                regions.Add(SourceRegion);
                InputArea = new WebPostInputRegion(ModelItem, SourceRegion);
                InputArea.PropertyChanged += (sender, args) =>
                {
                    if (args.PropertyName == "PostData" && InputArea.Headers.All(value => string.IsNullOrEmpty(value.Name)))
                    {
                        ((ManageWebServiceInputViewModel)ManageServiceInputViewModel).BuidHeaders(InputArea.PostData);
                    }
                };
                regions.Add(InputArea);
                OutputsRegion = new OutputsRegion(ModelItem, true);
                regions.Add(OutputsRegion);
                if (OutputsRegion.Outputs.Count > 0)
                {
                    OutputsRegion.IsEnabled = true;
                }
                ErrorRegion = new ErrorRegion();
                regions.Add(ErrorRegion);
                SourceRegion.Dependants.Add(InputArea);
                SourceRegion.Dependants.Add(OutputsRegion);
            }
            regions.Add(ManageServiceInputViewModel);
            Regions = regions;
            return(regions);
        }
        public override IList <IToolRegion> BuildRegions()
        {
            IList <IToolRegion> regions = new List <IToolRegion>();

            if (SourceRegion == null)
            {
                SourceRegion = new WebSourceRegion(Model, ModelItem)
                {
                    SourceChangedAction = () => { OutputsRegion.IsEnabled = false; }
                };
                regions.Add(SourceRegion);
                InputArea = new WebGetInputRegion(ModelItem, SourceRegion);
                regions.Add(InputArea);
                OutputsRegion = new OutputsRegion(ModelItem, true);
                regions.Add(OutputsRegion);
                if (OutputsRegion.Outputs.Count > 0)
                {
                    OutputsRegion.IsEnabled = true;
                }
                ErrorRegion = new ErrorRegion();
                regions.Add(ErrorRegion);
                SourceRegion.Dependants.Add(InputArea);
                SourceRegion.Dependants.Add(OutputsRegion);
            }
            regions.Add(ManageServiceInputViewModel);
            Regions = regions;
            return(regions);
        }
Example #4
0
        public override IList <IToolRegion> BuildRegions()
        {
            IList <IToolRegion> regions = new List <IToolRegion>();

            if (SourceRegion == null)
            {
                SourceRegion = new DatabaseSourceRegion(Model, ModelItem, enSourceType.ODBC)
                {
                    SourceChangedAction = () => { OutputsRegion.IsEnabled = false; }
                };
                regions.Add(SourceRegion);
                ActionRegion = new DbActionRegionOdbc(Model, ModelItem, SourceRegion);
                ActionRegion.SomethingChanged += (sender, args) =>
                {
                    CommandText = ((IODBCActionToolRegion <IDbAction>)ActionRegion).CommandText;
                };
                ActionRegion.ErrorsHandler += (sender, list) =>
                {
                    var errorInfos = list.Select(error => new ActionableErrorInfo(new ErrorInfo {
                        ErrorType = ErrorType.Critical, Message = error
                    }, () => { })).ToList();
                    UpdateDesignValidationErrors(errorInfos);
                    Errors = new List <IActionableErrorInfo>(errorInfos);
                };
                CommandText = ((IODBCActionToolRegion <IDbAction>)ActionRegion).CommandText;
                regions.Add(ActionRegion);
                InputArea = new DatabaseInputRegion(ModelItem, ActionRegion);
                regions.Add(InputArea);
                OutputsRegion = new OutputsRegion(ModelItem);
                regions.Add(OutputsRegion);
                if (OutputsRegion.Outputs.Count > 0)
                {
                    OutputsRegion.IsEnabled = true;
                }
                ErrorRegion = new ErrorRegion();
                regions.Add(ErrorRegion);
                SourceRegion.Dependants.Add(InputArea);
                SourceRegion.Dependants.Add(OutputsRegion);
            }
            regions.Add(ManageServiceInputViewModel);
            Regions = regions;
            return(regions);
        }
Example #5
0
        public override IList <IToolRegion> BuildRegions()
        {
            IList <IToolRegion> regions = new List <IToolRegion>();

            if (SourceRegion == null)
            {
                SourceRegion = new WcfSourceRegion(Model, ModelItem)
                {
                    SourceChangedAction = () => { OutputsRegion.IsEnabled = false; }
                };
                regions.Add(SourceRegion);
                ActionRegion = new WcfActionRegion(Model, ModelItem, SourceRegion)
                {
                    SourceChangedAction = () => { OutputsRegion.IsEnabled = false; }
                };
                ActionRegion.ErrorsHandler += (sender, list) =>
                {
                    var errorInfos = list.Select(error => new ActionableErrorInfo(new ErrorInfo {
                        ErrorType = ErrorType.Critical, Message = error
                    }, () => { })).ToList();
                    UpdateDesignValidationErrors(errorInfos);
                    Errors = new List <IActionableErrorInfo>(errorInfos);
                };
                regions.Add(ActionRegion);
                InputArea = new WcfInputRegion(ModelItem, ActionRegion);
                regions.Add(InputArea);
                OutputsRegion = new OutputsRegion(ModelItem, true);
                regions.Add(OutputsRegion);
                if (OutputsRegion.Outputs.Count > 0)
                {
                    OutputsRegion.IsEnabled = true;
                }
                ErrorRegion = new ErrorRegion();
                regions.Add(ErrorRegion);
                SourceRegion.Dependants.Add(ActionRegion);
                ActionRegion.Dependants.Add(InputArea);
                ActionRegion.Dependants.Add(OutputsRegion);
            }
            regions.Add(ManageServiceInputViewModel);
            Regions = regions;
            return(regions);
        }
        public override IList <IToolRegion> BuildRegions()
        {
            IList <IToolRegion> regions = new List <IToolRegion>();

            if (SourceRegion == null)
            {
                SourceRegion = new DotNetSourceRegion(Model, ModelItem)
                {
                    SourceChangedAction = () =>
                    {
                        if (OutputsRegion != null)
                        {
                            OutputsRegion.IsEnabled          = false;
                            OutputsRegion.IsObject           = true;
                            OutputsRegion.IsOutputsEmptyRows = true;
                        }
                        ClearToolRegionErrors();
                    }
                };
                regions.Add(SourceRegion);
                NamespaceRegion = new DotNetNamespaceRegion(Model, ModelItem, SourceRegion)
                {
                    SourceChangedNamespace = () =>
                    {
                        if (OutputsRegion != null)
                        {
                            OutputsRegion.IsEnabled          = true;
                            OutputsRegion.IsObject           = true;
                            OutputsRegion.IsOutputsEmptyRows = true;
                        }
                        ClearToolRegionErrors();
                    },
                    IsNewPluginNamespace = true
                };
                NamespaceRegion.SomethingChanged += (sender, args) =>
                {
                    if (args.Errors != null)
                    {
                        Errors = args.Errors.Select(e => new ActionableErrorInfo
                        {
                            ErrorType = ErrorType.Critical,
                            Message   = e
                        } as IActionableErrorInfo).ToList();
                    }
                    var dotNetNamespaceRegion = sender as DotNetNamespaceRegion;
                    var outputsRegion         = dotNetNamespaceRegion?.Dependants.Single(region => region is OutputsRegion) as OutputsRegion;
                    if (outputsRegion != null)
                    {
                        if (dotNetNamespaceRegion.SelectedNamespace != null)
                        {
                            outputsRegion.ObjectResult = dotNetNamespaceRegion.SelectedNamespace.JsonObject;
                        }
                    }
                    OnPropertyChanged("IsActionsVisible");
                };
                regions.Add(NamespaceRegion);
                ConstructorRegion = new DotNetConstructorRegion(Model, ModelItem, SourceRegion, NamespaceRegion)
                {
                    SourceChangedAction = () =>
                    {
                        if (OutputsRegion != null)
                        {
                            OutputsRegion.IsEnabled          = true;
                            OutputsRegion.IsObject           = true;
                            OutputsRegion.IsOutputsEmptyRows = !string.IsNullOrWhiteSpace(OutputsRegion.ObjectResult);
                        }

                        //ClearToolRegionErrors();
                    }
                };
                ConstructorRegion.SomethingChanged += (sender, args) =>
                {
                    OnPropertyChanged("IsConstructorVisible");
                };


                ConstructorRegion.ErrorsHandler += (sender, list) =>
                {
                    List <ActionableErrorInfo> errorInfos = list.Select(error => new ActionableErrorInfo(new ErrorInfo {
                        ErrorType = ErrorType.Critical, Message = error
                    }, () => { })).ToList();
                    UpdateDesignValidationErrors(errorInfos);
                    Errors = new List <IActionableErrorInfo>(errorInfos);
                };
                regions.Add(ConstructorRegion);

                InputArea = new DotNetConstructorInputRegion(ModelItem, ConstructorRegion);
                regions.Add(InputArea);
                OutputsRegion = new OutputsRegion(ModelItem, true)
                {
                    IsObject  = true,
                    IsEnabled = false
                };
                regions.Add(OutputsRegion);

                var pluginActions     = ModelItem.GetProperty <List <IPluginAction> >("MethodsToRun");
                var regionCollections = BuildRegionsFromActions(pluginActions);
                if (regionCollections.Any())
                {
                    MethodsToRunList = regionCollections;
                    CreateMethodRegion();
                }
                else
                {
                    CreateMethodRegion();
                }

                ErrorRegion = new ErrorRegion();
                regions.Add(ErrorRegion);
                SourceRegion.Dependants.Add(NamespaceRegion);
                NamespaceRegion.Dependants.Add(ConstructorRegion);
                NamespaceRegion.Dependants.Add(OutputsRegion);
                ConstructorRegion.Dependants.Add(InputArea);
                ConstructorRegion.Dependants.Add(OutputsRegion);
                OutputsRegion.Dependants.Add(ConstructorRegion);
            }
            Regions = regions;

            return(regions);
        }
Example #7
0
        public override IList <IToolRegion> BuildRegions()
        {
            IList <IToolRegion> regions = new List <IToolRegion>();

            if (SourceRegion == null)
            {
                SourceRegion = new ComSourceRegion(Model, ModelItem)
                {
                    SourceChangedAction = () =>
                    {
                        if (Regions != null)
                        {
                            foreach (var toolRegion in Regions)
                            {
                                toolRegion.Errors?.Clear();
                            }
                        }
                    }
                };
                regions.Add(SourceRegion);
                NamespaceRegion = new ComNamespaceRegion(Model, ModelItem, SourceRegion)
                {
                    SourceChangedNamespace = () =>
                    {
                        OutputsRegion.IsEnabled = false;
                        if (Regions != null)
                        {
                            foreach (var toolRegion in Regions)
                            {
                                toolRegion.Errors?.Clear();
                            }
                        }
                    }
                };
                NamespaceRegion.SomethingChanged += (sender, args) =>
                {
                    if (args.Errors != null)
                    {
                        Errors =
                            args.Errors.Select(e => new ActionableErrorInfo {
                            ErrorType = ErrorType.Critical, Message = e
                        } as IActionableErrorInfo)
                            .ToList();
                    }
                };
                regions.Add(NamespaceRegion);
                ActionRegion = new ComActionRegion(Model, ModelItem, SourceRegion, NamespaceRegion)
                {
                    SourceChangedAction = () =>
                    {
                        OutputsRegion.IsEnabled = false;
                        if (Regions != null)
                        {
                            foreach (var toolRegion in Regions)
                            {
                                toolRegion.Errors?.Clear();
                            }
                        }
                    }
                };
                ActionRegion.ErrorsHandler += (sender, list) =>
                {
                    var errorInfos = list.Select(error => new ActionableErrorInfo(new ErrorInfo {
                        ErrorType = ErrorType.Critical, Message = error
                    }, () => { })).ToList();
                    UpdateDesignValidationErrors(errorInfos);
                    Errors = new List <IActionableErrorInfo>(errorInfos);
                };
                regions.Add(ActionRegion);
                InputArea = new DotNetInputRegion(ModelItem, ActionRegion);
                regions.Add(InputArea);
                OutputsRegion = new OutputsRegion(ModelItem, true);
                regions.Add(OutputsRegion);
                if (OutputsRegion.Outputs.Count > 0)
                {
                    OutputsRegion.IsEnabled = true;
                }
                ErrorRegion = new ErrorRegion();
                regions.Add(ErrorRegion);
                SourceRegion.Dependants.Add(NamespaceRegion);
                NamespaceRegion.Dependants.Add(ActionRegion);
                ActionRegion.Dependants.Add(InputArea);
                ActionRegion.Dependants.Add(OutputsRegion);
            }
            regions.Add(ManageServiceInputViewModel);
            Regions = regions;
            return(regions);
        }