コード例 #1
0
        private void BUT_Add_Click(object sender, EventArgs e)
        {
            var newcw = new CustomWarning();

            newcw.SetSource(MainV2.comPort.MAV.cs);
            newcw.SetField(newcw.GetOptions()[0]);

            lock (WarningEngine.warnings)
            {
                WarningEngine.warnings.Add(newcw);
            }

            reload();
        }
コード例 #2
0
        private void BUT_Add_Click(object sender, EventArgs e)
        {
            var newcw = new CustomWarning();

            CustomWarning.defaultsrc = MainV2.comPort.MAV.cs;
            newcw.SetField(newcw.GetOptions()[0]);

            lock (WarningEngine.warnings)
            {
                WarningEngine.warnings.Add(newcw);
            }

            reload();
        }
コード例 #3
0
        public WarningControl(CustomWarning item)
        {
            InitializeComponent();

            item.SetSource(MainV2.comPort.MAV.cs);
            item.SetField(item.Name);

            CMB_condition.DataSource = Enum.GetNames(typeof(CustomWarning.Conditional));

            CMB_Source.DataSource = item.GetOptions();

            custwarning = item;

            updateDisplay();
        }
コード例 #4
0
        public WarningControl(CustomWarning item)
        {
            InitializeComponent();

            CustomWarning.defaultsrc = MainV2.comPort.MAV.cs;
            item.SetField(item.Name);

            CMB_condition.DataSource = Enum.GetNames(typeof(CustomWarning.Conditional));

            CMB_Source.DataSource = item.GetOptions();


            custwarning = item;

            updateDisplay();
        }
コード例 #5
0
        static bool checkCond(CustomWarning item)
        {
            // if there is a child go recursive
            if (item.Child != null)
            {
                if (item.CheckValue() && checkCond(item.Child))
                {
                    return(true);
                }
            }
            else
            {
                // is no child then simple check
                if (item.CheckValue())
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #6
0
        void removewarning(CustomWarning lookin, CustomWarning removeme)
        {
            // depth first check children
            if (lookin.Child != null)
            {
                removewarning(lookin.Child, removeme);
            }

            if (lookin.Child == removeme)
            {
                if (lookin.Child.Child != null)
                {
                    lookin.Child = lookin.Child.Child;
                }
                else
                {
                    lookin.Child = null;
                }
                return;
            }
        }
コード例 #7
0
        WarningControl addwarningcontrol(int x, int y, CustomWarning item, bool hideforchild = false)
        {
            WarningControl wrnctl = new WarningControl(item);

            wrnctl.ReloadList += wrnctl_ChildAdd;

            wrnctl.Location = new Point(x, y);

            if (hideforchild)
                wrnctl.TXT_warningtext.Visible = false;

            panel1.Controls.Add(wrnctl);

            y = wrnctl.Bottom;

            if (item.Child != null)
            {
                wrnctl = addwarningcontrol(x += 5, y, item.Child, true);
            }

            return wrnctl;
        }
コード例 #8
0
        WarningControl addwarningcontrol(int x, int y, CustomWarning item, bool hideforchild = false)
        {
            WarningControl wrnctl = new WarningControl(item);

            wrnctl.ReloadList += wrnctl_ChildAdd;

            wrnctl.Location = new Point(x, y);

            if (hideforchild)
            {
                wrnctl.TXT_warningtext.Visible = false;
            }

            panel1.Controls.Add(wrnctl);

            y = wrnctl.Bottom;

            if (item.Child != null)
            {
                wrnctl = addwarningcontrol(x += 5, y, item.Child, true);
            }

            return(wrnctl);
        }
コード例 #9
0
        static bool checkCond(CustomWarning item)
        {
            // if there is a child go recursive
            if (item.Child != null) 
            {
                if (item.CheckValue() && checkCond(item.Child))
                    return true;
            } 
            else 
            {
                // is no child then simple check
                if (item.CheckValue())
                    return true;
            }

            return false;
        }
コード例 #10
0
        void removewarning(CustomWarning lookin, CustomWarning removeme)
        {
            // depth first check children
            if (lookin.Child != null)
                removewarning(lookin.Child, removeme);

            if (lookin.Child == removeme)
            {
                if (lookin.Child.Child != null)
                {
                    lookin.Child = lookin.Child.Child;
                }
                else
                {
                    lookin.Child = null;
                }
                return;
            }
        }