Example #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();
        }
Example #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();
        }
        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();
        }
        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();
        }
Example #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);
        }
        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;
            }
        }
Example #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;
        }
Example #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);
        }
        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;
        }
        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;
            }
        }