示例#1
0
 private void btnAddAction_Click(object sender, EventArgs e)
 {
     using (ActionForm af = new ActionForm())
     {
         af.plug = plug;
         af.wmp  = wmp;
         af.tts  = tts;
         af.trvTrigger.ImageList = imgs;
         af.trvTrigger.Nodes.Add((TreeNode)trv.Nodes[0].Clone());
         CloseTree(af.trvTrigger.Nodes[0]);
         af.trvFolder.ImageList = imgs;
         af.trvFolder.Nodes.Add((TreeNode)trv.Nodes[0].Clone());
         RemoveTriggerNodesFromTree(af.trvFolder.Nodes[0]);
         CloseTree(af.trvFolder.Nodes[0]);
         af.SettingsFromAction(null);
         if (panel5.Visible == true)
         {
             af.SetReadOnly();
         }
         af.Text       = I18n.Translate("internal/TriggerForm/addnewaction", "Add new action");
         af.btnOk.Text = I18n.Translate("internal/TriggerForm/add", "Add");
         if (af.ShowDialog() == DialogResult.OK)
         {
             Action a = new Action();
             af.SettingsToAction(a);
             a._Enabled = true;
             Actions.Add(a);
             a.OrderNumber       = Actions.Count;
             dgvActions.RowCount = Actions.Count;
             dgvActions.ClearSelection();
             dgvActions.Rows[dgvActions.RowCount - 1].Selected = true;
         }
     }
 }
示例#2
0
        private void btnEditAction_Click(object sender, EventArgs e)
        {
            Context ctx = new Context();

            ctx.plug = plug;
            ctx.trig = fakectx.trig;
            using (ActionForm af = new ActionForm())
            {
                Action a = Actions[dgvActions.SelectedRows[0].Index];
                af.plug = plug;
                af.wmp  = wmp;
                af.trvTrigger.ImageList = imgs;
                af.trvTrigger.Nodes.Add((TreeNode)trv.Nodes[0].Clone());
                CloseTree(af.trvTrigger.Nodes[0]);
                af.trvFolder.ImageList = imgs;
                af.trvFolder.Nodes.Add((TreeNode)trv.Nodes[0].Clone());
                RemoveTriggerNodesFromTree(af.trvFolder.Nodes[0]);
                CloseTree(af.trvFolder.Nodes[0]);
                af.SettingsFromAction(a);
                if (panel5.Visible == true)
                {
                    af.SetReadOnly();
                }
                af.tts        = tts;
                af.Text       = I18n.Translate("internal/TriggerForm/editaction", "Edit action '{0}'", a.GetDescription(ctx));
                af.btnOk.Text = I18n.Translate("internal/TriggerForm/savechanges", "Save changes");
                if (af.ShowDialog() == DialogResult.OK)
                {
                    af.SettingsToAction(a);
                    dgvActions.Refresh();
                }
            }
        }