Ejemplo n.º 1
0
        public void RefreshTrigger(CodeTrigger trigger)
        {
            this.tbGroup.TextChanged     -= this.tbGroup_TextChanged;
            this.tbName.TextChanged      -= this.tbName_TextChanged;
            this.cbActive.CheckedChanged -= this.cbActive_CheckedChanged;
            this.tbCode.TextChanged      -= this.tbCode_TextChanged;

            if (trigger == null)
            {
                tbGroup.Text     = null;
                tbName.Text      = null;
                tbCode.Text      = null;
                cbActive.Checked = false;
            }
            else
            {
                tbGroup.Text     = trigger.Group;
                tbName.Text      = trigger.Name;
                tbCode.Text      = trigger.Code;
                cbActive.Checked = trigger.Active;
            }
            this.tbGroup.TextChanged     += this.tbGroup_TextChanged;
            this.tbName.TextChanged      += this.tbName_TextChanged;
            this.cbActive.CheckedChanged += this.cbActive_CheckedChanged;
            this.tbCode.TextChanged      += this.tbCode_TextChanged;
        }
Ejemplo n.º 2
0
 private void CreateTrigger()
 {
     currentTrigger = new CodeTrigger {
         Name = $"#{nbTriggers++:00}", Group = "Default"
     };
     triggers.Add(currentTrigger);
 }
 private void tsbCloneTrigger_Click(object sender, System.EventArgs e)
 {
     foreach (int idx in dlvTriggers.SelectedIndices)
     {
         CodeTrigger trig    = triggers[idx];
         var         newTrig = trig.Clone();
         triggers.Add(newTrig);
     }
     RefreshTriggers();
 }
 private void tsbDeleteTrigger_Click(object sender, System.EventArgs e)
 {
     foreach (int idx in dlvTriggers.SelectedIndices)
     {
         CodeTrigger trig = triggers[idx];
         triggers.Remove(trig);
         if (trig == currentTrigger)
         {
             currentTrigger = null;
             Reset();
         }
     }
     RefreshTriggers();
 }
Ejemplo n.º 5
0
        private void dlvTriggers_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            currentTrigger = dlvTriggers.SelectedObject as CodeTrigger;

            if (currentTrigger != null)
            {
                tbGroup.Text     = currentTrigger.Group;
                tbName.Text      = currentTrigger.Name;
                tbCode.Text      = currentTrigger.Code;
                cbActive.Checked = currentTrigger.Active;
            }
            else
            {
                Reset();
            }
        }
Ejemplo n.º 6
0
        public CodeTriggersControl()
        {
            InitializeComponent();

            dlvTriggers.CheckStatePutter = (rowObject, value) =>
            {
                CodeTrigger codeTrigger = rowObject as CodeTrigger;
                codeTrigger.Active = (value == CheckState.Checked);
                if (currentTrigger != null)
                {
                    cbActive.Checked = currentTrigger.Active;
                }
                return(value);
            };
            dlvTriggers.CheckStateGetter = rowObject => ((CodeTrigger)rowObject).Active ? CheckState.Checked : CheckState.Unchecked;
            dlvTriggers.InitColumns <CodeTrigger>();
            InitCodeSyntax();
            Reset();
        }
Ejemplo n.º 7
0
        public void RefreshTrigger(CodeTrigger trigger)
        {
            this.tbGroup.TextChanged -= this.tbGroup_TextChanged;
            this.tbName.TextChanged -= this.tbName_TextChanged;
            this.cbActive.CheckedChanged -= this.cbActive_CheckedChanged;
            this.tbCode.TextChanged -= this.tbCode_TextChanged;

            if (trigger == null) {
                tbGroup.Text = null;
                tbName.Text = null;
                tbCode.Text = null;
                cbActive.Checked = false;
            } else
            {
                tbGroup.Text = trigger.Group;
                tbName.Text = trigger.Name;
                tbCode.Text = trigger.Code;
                cbActive.Checked = trigger.Active;
            }
            this.tbGroup.TextChanged += this.tbGroup_TextChanged;
            this.tbName.TextChanged += this.tbName_TextChanged;
            this.cbActive.CheckedChanged += this.cbActive_CheckedChanged;
            this.tbCode.TextChanged += this.tbCode_TextChanged;
        }
Ejemplo n.º 8
0
        private void dlvTriggers_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            currentTrigger = dlvTriggers.SelectedObject as CodeTrigger;

            if (currentTrigger != null)
            {
                tbGroup.Text = currentTrigger.Group;
                tbName.Text = currentTrigger.Name;
                tbCode.Text = currentTrigger.Code;
                cbActive.Checked = currentTrigger.Active;
            }
            else
            {
                Reset();
            }
        }
Ejemplo n.º 9
0
 private void tsbDeleteTrigger_Click(object sender, System.EventArgs e)
 {
     ListView.SelectedIndexCollection selectedTriggers = dlvTriggers.SelectedIndices;
     foreach (int idx in selectedTriggers)
     {
         CodeTrigger trig = triggers[idx];
         triggers.Remove(trig);
         if( trig == currentTrigger)
         {
             currentTrigger = null;
             Reset();
         }
     }
     RefreshTriggers();
 }
Ejemplo n.º 10
0
 private void CreateTrigger()
 {
     currentTrigger = new CodeTrigger { Name = $"#{nbTriggers++:00}", Group = "Default" };
     triggers.Add(currentTrigger);
 }