Esempio n. 1
0
        public ActionBuilderForm(Framework.Interfaces.IPlugin owner, Framework.Interfaces.ICore core)
            : base(owner, core)
        {
            InitializeComponent();

            ActionBuilderFormInstance = this;

            var p = PluginSettings.Instance.WindowPos;
            if (p != null && !p.IsEmpty)
            {
                this.Bounds = p;
                this.StartPosition = FormStartPosition.Manual;
            }

            actionBuilderEditor1.ShowConnectionLabels(PluginSettings.Instance.ShowConnectionLabel);

            loadFlowsFile();

            splitContainer1.SplitterDistance = PluginSettings.Instance.LeftPanelWidth;
            if (splitContainer2.Width > PluginSettings.Instance.RightPanelWidth)
            {
                splitContainer2.SplitterDistance = splitContainer2.Width - PluginSettings.Instance.RightPanelWidth;
            }

            _sizeInitializing = false;

            try
            {
                Assembly asm = Assembly.GetExecutingAssembly();
                Type[] types = asm.GetTypes();
                foreach (Type t in types)
                {
                    if (t.IsClass && (t.BaseType == typeof(ActionImplementationCondition)))
                    {
                        ConstructorInfo constructor = t.GetConstructor(new Type[]{typeof(Framework.Interfaces.ICore)});
                        object[] parameters = new object[]{core};
                        ActionImplementationCondition obj = (ActionImplementationCondition)constructor.Invoke(parameters);

                        //exception for the start
                        if (obj is ActionStart)
                        {
                            //skip. auto
                        }
                        else
                        {
                            Button b = new Button();
                            b.Dock = DockStyle.Top;
                            b.Tag = obj;
                            b.Height = 25;
                            b.Click += new EventHandler(b_Click);
                            b.MouseDown += new MouseEventHandler(b_MouseDown);
                            b.MouseMove += new MouseEventHandler(b_MouseMove);
                            panel3.Controls.Add(b);

                            core.LanguageItems.Add(new Framework.Data.LanguageItem(obj.Name));
                        }
                    }
                }
                foreach (Type t in types)
                {
                    if (t.IsClass && (t.BaseType == typeof(ActionImplementationExecuteOnce)))
                    {
                        ConstructorInfo constructor = t.GetConstructor(new Type[] { typeof(Framework.Interfaces.ICore) });
                        object[] parameters = new object[] { core };
                        ActionImplementationExecuteOnce obj = (ActionImplementationExecuteOnce)constructor.Invoke(parameters);

                        Button b = new Button();
                        b.Dock = DockStyle.Top;
                        b.Tag = obj;
                        b.Height = 25;
                        b.Click += new EventHandler(b_Click);
                        b.MouseDown += new MouseEventHandler(b_MouseDown);
                        b.MouseMove += new MouseEventHandler(b_MouseMove);
                        panel5.Controls.Add(b);

                        core.LanguageItems.Add(new Framework.Data.LanguageItem(obj.Name));
                    }
                }
                Label la = new Label();
                la.AutoSize = false;
                la.TextAlign = ContentAlignment.MiddleCenter;
                la.Dock = DockStyle.Top;
                la.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_EXECUTEONCE);
                panel5.Controls.Add(la);
                _executeOnceLabel = la;
                foreach (Type t in types)
                {
                    if (t.IsClass && (t.BaseType == typeof(ActionImplementationAction)))
                    {
                        ConstructorInfo constructor = t.GetConstructor(new Type[] { typeof(Framework.Interfaces.ICore) });
                        object[] parameters = new object[] { core };
                        ActionImplementationAction obj = (ActionImplementationAction)constructor.Invoke(parameters);

                        //exception for the start
                        Button b = new Button();
                        b.Dock = DockStyle.Top;
                        b.Tag = obj;
                        b.Height = 25;
                        b.Click += new EventHandler(b_Click);
                        b.MouseDown += new MouseEventHandler(b_MouseDown);
                        b.MouseMove += new MouseEventHandler(b_MouseMove);
                        panel5.Controls.Add(b);

                        core.LanguageItems.Add(new Framework.Data.LanguageItem(obj.Name));
                    }
                }
            }
            catch
            {
            }

            SelectedLanguageChanged(this, EventArgs.Empty);
        }
Esempio n. 2
0
        public ActionBuilderForm(Framework.Interfaces.IPlugin owner, Framework.Interfaces.ICore core)
            : base(owner, core)
        {
            InitializeComponent();

            ActionBuilderFormInstance = this;

            var p = PluginSettings.Instance.WindowPos;

            if (p != null && !p.IsEmpty)
            {
                this.Bounds        = p;
                this.StartPosition = FormStartPosition.Manual;
            }

            actionBuilderEditor1.ShowConnectionLabels(PluginSettings.Instance.ShowConnectionLabel);

            loadFlowsFile();

            splitContainer1.SplitterDistance = PluginSettings.Instance.LeftPanelWidth;
            if (splitContainer2.Width > PluginSettings.Instance.RightPanelWidth)
            {
                splitContainer2.SplitterDistance = splitContainer2.Width - PluginSettings.Instance.RightPanelWidth;
            }

            _sizeInitializing = false;

            try
            {
                Assembly asm   = Assembly.GetExecutingAssembly();
                Type[]   types = asm.GetTypes();
                foreach (Type t in types)
                {
                    if (t.IsClass && (t.BaseType == typeof(ActionImplementationCondition)))
                    {
                        ConstructorInfo constructor       = t.GetConstructor(new Type[] { typeof(Framework.Interfaces.ICore) });
                        object[]        parameters        = new object[] { core };
                        ActionImplementationCondition obj = (ActionImplementationCondition)constructor.Invoke(parameters);

                        //exception for the start
                        if (obj is ActionStart)
                        {
                            //skip. auto
                        }
                        else
                        {
                            Button b = new Button();
                            b.Dock       = DockStyle.Top;
                            b.Tag        = obj;
                            b.Height     = 25;
                            b.Click     += new EventHandler(b_Click);
                            b.MouseDown += new MouseEventHandler(b_MouseDown);
                            b.MouseMove += new MouseEventHandler(b_MouseMove);
                            panel3.Controls.Add(b);

                            core.LanguageItems.Add(new Framework.Data.LanguageItem(obj.Name));
                        }
                    }
                }
                foreach (Type t in types)
                {
                    if (t.IsClass && (t.BaseType == typeof(ActionImplementationExecuteOnce)))
                    {
                        ConstructorInfo constructor         = t.GetConstructor(new Type[] { typeof(Framework.Interfaces.ICore) });
                        object[]        parameters          = new object[] { core };
                        ActionImplementationExecuteOnce obj = (ActionImplementationExecuteOnce)constructor.Invoke(parameters);

                        Button b = new Button();
                        b.Dock       = DockStyle.Top;
                        b.Tag        = obj;
                        b.Height     = 25;
                        b.Click     += new EventHandler(b_Click);
                        b.MouseDown += new MouseEventHandler(b_MouseDown);
                        b.MouseMove += new MouseEventHandler(b_MouseMove);
                        panel5.Controls.Add(b);

                        core.LanguageItems.Add(new Framework.Data.LanguageItem(obj.Name));
                    }
                }
                Label la = new Label();
                la.AutoSize  = false;
                la.TextAlign = ContentAlignment.MiddleCenter;
                la.Dock      = DockStyle.Top;
                la.Text      = Utils.LanguageSupport.Instance.GetTranslation(STR_EXECUTEONCE);
                panel5.Controls.Add(la);
                _executeOnceLabel = la;
                foreach (Type t in types)
                {
                    if (t.IsClass && (t.BaseType == typeof(ActionImplementationAction)))
                    {
                        ConstructorInfo            constructor = t.GetConstructor(new Type[] { typeof(Framework.Interfaces.ICore) });
                        object[]                   parameters  = new object[] { core };
                        ActionImplementationAction obj         = (ActionImplementationAction)constructor.Invoke(parameters);

                        //exception for the start
                        Button b = new Button();
                        b.Dock       = DockStyle.Top;
                        b.Tag        = obj;
                        b.Height     = 25;
                        b.Click     += new EventHandler(b_Click);
                        b.MouseDown += new MouseEventHandler(b_MouseDown);
                        b.MouseMove += new MouseEventHandler(b_MouseMove);
                        panel5.Controls.Add(b);

                        core.LanguageItems.Add(new Framework.Data.LanguageItem(obj.Name));
                    }
                }
            }
            catch
            {
            }

            SelectedLanguageChanged(this, EventArgs.Empty);
        }