// -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public DialogChangeSwitches(EventCommandOther model)
        {
            InitializeComponent();
            Model = (EventCommandOther)model.CreateCopy();
            // Paint groupBox
            groupBox1.Paint += MainForm.PaintBorderGroupBox;
            groupBox2.Paint += MainForm.PaintBorderGroupBox;

            // Updating infos
            textBoxVariables1.InitializeSwitch((int)Model.Command[1]);
        }
Пример #2
0
        // -------------------------------------------------------------------
        // OpenLabelDialogCommand
        // -------------------------------------------------------------------

        public void OpenLabelDialogCommand()
        {
            if (ListCommandsSelectedLabel != null)
            {
                EventCommandKind kind         = (EventCommandKind)ListCommandsSelectedLabel.Tag;
                EventCommand     eventCommand = null;
                switch (kind)
                {
                case EventCommandKind.None:
                    eventCommand = new EventCommandOther();
                    break;

                case EventCommandKind.ChangeSwitches:
                    eventCommand = new EventCommandOther(EventCommandKind.ChangeSwitches, new List <object>(new object[] { 0, 1, 0 }));
                    break;

                case EventCommandKind.Conditions:
                    eventCommand = new EventCommandConditions();
                    break;

                default:
                    break;
                }
                ModelForm dialog = (ModelForm)GetDialogEventCommand(eventCommand);
                if (kind == EventCommandKind.None)
                {
                    WANOK.ShowActionMessage();
                }
                else
                {
                    DontLooseFocus = true;
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        ((NTree <EventCommand>)CommandsView.SelectedNode.Tag).Data = dialog.GetModel();
                        CommandsView.SelectedNode.Text = WANOK.ListBeginning + dialog.GetModel().ToString();
                        TreeNode             node        = CommandsView.Nodes.Add(WANOK.ListBeginning);
                        NTree <EventCommand> commandTree = Control.Model.GetCurrentPage().CommandsTree.AddChildData(new EventCommandOther());
                        node.Tag = commandTree;
                        UpdateTreeCommandsSelection();
                    }
                    DontLooseFocus = false;
                }
            }
        }