Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
            }
        }