public DbActionRegion(IDbServiceModel model, ModelItem modelItem, ISourceToolRegion <IDbSource> source, IAsyncWorker worker)
        {
            try
            {
                Errors = new List <string>();

                LabelWidth                = 46;
                ToolRegionName            = "DbActionRegion";
                _modelItem                = modelItem;
                _model                    = model;
                _source                   = source;
                _worker                   = worker;
                _source.SomethingChanged += SourceOnSomethingChanged;
                Dependants                = new List <IToolRegion>();
                if (_source.SelectedSource != null)
                {
                    LoadActions(model);
                }

                RefreshActionsCommand = new DelegateCommand(o =>
                {
                    if (_source.SelectedSource != null)
                    {
                        _source.SelectedSource.ReloadActions = true;
                        LoadActions(model);
                    }
                }, o => CanRefresh());

                _modelItem = modelItem;
            }
            catch (Exception e)
            {
                Errors.Add(e.Message);
            }
        }
Exemple #2
0
 public WebPutInputRegion(ModelItem modelItem, ISourceToolRegion <IWebServiceSource> source)
 {
     ToolRegionName            = "PutInputRegion";
     _modelItem                = modelItem;
     _source                   = source;
     _source.SomethingChanged += SourceOnSomethingChanged;
     IsEnabled                 = false;
     SetupHeaders(modelItem);
     if (source?.SelectedSource != null)
     {
         RequestUrl = source.SelectedSource.HostName;
         IsEnabled  = true;
     }
 }
        public DbActionRegionOdbc(IDbServiceModel model, ModelItem modelItem, ISourceToolRegion <IDbSource> source)
        {
            Errors = new List <string>();

            LabelWidth                = 46;
            ToolRegionName            = "DbActionRegionODBC";
            _modelItem                = modelItem;
            _model                    = model;
            _source                   = source;
            _source.SomethingChanged += SourceOnSomethingChanged;
            Dependants                = new List <IToolRegion>();

            IsEnabled       = true;
            _modelItem      = modelItem;
            CommandText     = _modelItem.GetProperty <string>("CommandText") ?? "";
            IsActionEnabled = _source?.SelectedSource != null;
        }
Exemple #4
0
        public DotNetConstructorRegion(IPluginServiceModel model, ModelItem modelItem,
                                       ISourceToolRegion <IPluginSource> source, INamespaceToolRegion <INamespaceItem> namespaceItem)
        {
            try
            {
                Errors = new List <string>();

                LabelWidth     = 70;
                ToolRegionName = "DotNetConstructorRegion";
                _modelItem     = modelItem;
                _model         = model;
                _source        = source;
                _namespace     = namespaceItem;
                _namespace.SomethingChanged += SourceOnSomethingChanged;
                Dependants   = new List <IToolRegion>();
                IsRefreshing = false;
                if (_source.SelectedSource != null)
                {
                    Constructors = model.GetConstructors(_source.SelectedSource, _namespace.SelectedNamespace);
                }
                if (Method != null && Constructors != null)
                {
                    SelectedConstructor = Constructors.FirstOrDefault(constructor => constructor.ConstructorName == Method.ConstructorName);
                }
                RefreshConstructorsCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(() =>
                {
                    IsRefreshing = true;
                    if (_source.SelectedSource != null)
                    {
                        Constructors = model.GetConstructors(_source.SelectedSource, _namespace.SelectedNamespace);
                    }
                    IsRefreshing = false;
                }, CanRefresh);

                IsConstructorExpanded = false;
                IsEnabled             = true;
                _modelItem            = modelItem;
            }
            catch (Exception e)
            {
                Errors.Add(e.Message);
            }
        }
        public DotNetMethodRegion(IPluginServiceModel model, ModelItem modelItem, ISourceToolRegion <IPluginSource> source, INamespaceToolRegion <INamespaceItem> namespaceItem)
            : this(CustomContainer.Get <IShellViewModel>(), new ActionInputDatatalistMapper())
        {
            try
            {
                Errors = new List <string>();

                LabelWidth     = 70;
                ToolRegionName = "DotNetMethodRegion";
                _modelItem     = modelItem;
                _model         = model;
                _source        = source;
                _namespace     = namespaceItem;
                _namespace.SomethingChanged += SourceOnSomethingChanged;
                Dependants   = new List <IToolRegion>();
                IsRefreshing = false;
                if (_source.SelectedSource != null)
                {
                    MethodsToRun = model.GetActionsWithReturns(_source.SelectedSource, _namespace.SelectedNamespace);
                }
                if (Method != null && MethodsToRun != null)
                {
                    SelectedMethod = Method;
                }
                RefreshMethodsCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(() =>
                {
                    IsRefreshing = true;
                    if (_source.SelectedSource != null)
                    {
                        MethodsToRun = model.GetActionsWithReturns(_source.SelectedSource, _namespace.SelectedNamespace);
                    }
                    IsRefreshing = false;
                }, CanRefresh);

                IsMethodExpanded = false;
                IsEnabled        = true;
                _modelItem       = modelItem;
            }
            catch (Exception e)
            {
                Errors.Add(e.Message);
            }
        }
Exemple #6
0
        public ComActionRegion(IComPluginServiceModel model, ModelItem modelItem, ISourceToolRegion <IComPluginSource> source, INamespaceToolRegion <INamespaceItem> namespaceItem)
        {
            try
            {
                Errors = new List <string>();

                LabelWidth     = 70;
                ToolRegionName = "ComActionRegion";
                _modelItem     = modelItem;
                _model         = model;
                _source        = source;
                _namespace     = namespaceItem;
                _namespace.SomethingChanged += SourceOnSomethingChanged;
                Dependants   = new List <IToolRegion>();
                IsRefreshing = false;
                if (_source.SelectedSource != null)
                {
                    Actions = model.GetActions(_source.SelectedSource, _namespace.SelectedNamespace);
                }
                if (Method != null && Actions != null)
                {
                    IsActionEnabled = true;
                    SelectedAction  = Actions.FirstOrDefault(action => action.Method == Method.Method);
                }
                RefreshActionsCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(() =>
                {
                    IsRefreshing = true;
                    if (_source.SelectedSource != null)
                    {
                        Actions = model.GetActions(_source.SelectedSource, _namespace.SelectedNamespace);
                    }
                    IsRefreshing = false;
                }, CanRefresh);

                IsEnabled  = true;
                _modelItem = modelItem;
            }
            catch (Exception e)
            {
                Errors.Add(e.Message);
            }
        }
Exemple #7
0
        public WcfActionRegion(IWcfServiceModel model, ModelItem modelItem, ISourceToolRegion <IWcfServerSource> source)
        {
            try
            {
                Errors = new List <string>();

                LabelWidth                = 46;
                ToolRegionName            = "DbActionRegion";
                _modelItem                = modelItem;
                _model                    = model;
                _source                   = source;
                _source.SomethingChanged += SourceOnSomethingChanged;
                Dependants                = new List <IToolRegion>();
                IsRefreshing              = false;
                if (_source.SelectedSource != null)
                {
                    Actions = model.GetActions(_source.SelectedSource);
                }
                if (!string.IsNullOrEmpty(Method.FullName))
                {
                    IsActionEnabled = true;
                    SelectedAction  = Actions.FirstOrDefault(action => action.FullName == Method.FullName);
                }
                RefreshActionsCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(() =>
                {
                    IsRefreshing = true;
                    if (_source.SelectedSource != null)
                    {
                        Actions = model.GetActions(_source.SelectedSource);
                    }
                    IsRefreshing = false;
                }, CanRefresh);

                IsEnabled  = true;
                _modelItem = modelItem;
            }
            catch (Exception e)
            {
                Errors.Add(e.Message);
            }
        }
Exemple #8
0
        public DotNetNamespaceRegion(IPluginServiceModel model, ModelItem modelItem, ISourceToolRegion <IPluginSource> source)
        {
            try
            {
                Errors                    = new List <string>();
                LabelWidth                = 74;
                ToolRegionName            = "DotNetNamespaceRegion";
                _modelItem                = modelItem;
                _model                    = model;
                _source                   = source;
                _source.SomethingChanged += SourceOnSomethingChanged;
                Dependants                = new List <IToolRegion>();
                IsRefreshing              = false;
                UpdateBasedOnSource();
                if (Namespace != null)
                {
                    SelectedNamespace = Namespaces.FirstOrDefault(item => item.FullName == Namespace.FullName);
                }
                RefreshNamespaceCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(() =>
                {
                    IsRefreshing = true;
                    if (_source.SelectedSource != null)
                    {
                        Namespaces = _modelItem.ItemType == typeof(DsfEnhancedDotNetDllActivity) ? _model.GetNameSpacesWithJsonRetunrs(_source.SelectedSource) : _model.GetNameSpaces(_source.SelectedSource);
                    }

                    IsRefreshing = false;
                }, CanRefresh);

                IsEnabled  = true;
                _modelItem = modelItem;
            }
            catch (Exception e)
            {
                Errors.Add(e.Message);
            }
        }
Exemple #9
0
        public List <KeyValuePair <string, string> > BuildProperties(IDbActionToolRegion <IDbAction> actionToolRegion, ISourceToolRegion <IDbSource> sourceToolRegion, string type)
        {
            var properties    = new List <KeyValuePair <string, string> >();
            var sourceName    = sourceToolRegion?.SelectedSource == null ? "" : sourceToolRegion.SelectedSource.Name;
            var procedureName = actionToolRegion?.SelectedAction == null ? "" : actionToolRegion.SelectedAction.Name;

            if (!string.IsNullOrEmpty(sourceName))
            {
                properties.Add(new KeyValuePair <string, string>("Source :", sourceName));
            }

            if (!string.IsNullOrEmpty(type))
            {
                properties.Add(new KeyValuePair <string, string>("Type :", type));
            }
            if (string.IsNullOrEmpty(procedureName))
            {
                var dbActionRegion = (DbActionRegion)actionToolRegion;
                if (dbActionRegion != null)
                {
                    try
                    {
                        procedureName = dbActionRegion.ProcedureName;
                        properties.Add(new KeyValuePair <string, string>("Procedure :", procedureName));
                    }
                    catch (Exception)
                    {
                        //
                    }
                }
            }
            else
            {
                properties.Add(new KeyValuePair <string, string>("Procedure :", procedureName));
            }

            return(properties);
        }