Пример #1
0
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public DialogEvent(SystemEvent ev)
        {
            InitializeComponent();

            Control = new DialogEventControl(ev.CreateCopy());
            ViewModelBindingSource.DataSource = Control;

            // Timers
            GraphicFrameTimer.Interval = 150;
            GraphicFrameTimer.Start();
            CommandUnderscoreTimer.Interval = 250;

            // Radios trigger
            RadiosTrigger[EventTrigger.ActionButton]    = radioButtonActionButton;
            RadiosTrigger[EventTrigger.PlayerTouch]     = radioButtonPlayerTouch;
            RadiosTrigger[EventTrigger.EventTouch]      = radioButtonEventTouch;
            RadiosTrigger[EventTrigger.Detection]       = radioButtonDetection;
            RadiosTrigger[EventTrigger.Autorun]         = radioButtonAutorun;
            RadiosTrigger[EventTrigger.ParallelProcess] = radioButtonParallelProcess;

            // Update pages
            UpdatePage(0);
            for (int i = 0; i < Control.Model.Pages.Count - 1; i++)
            {
                TabPage tabPage = new TabPage((i + 2).ToString());
                tabPage.Margin    = new Padding(3);
                tabPage.Padding   = new Padding(3);
                tabPage.BackColor = Color.White;
                tabControl1.TabPages.Add(tabPage);
            }
            buttonDeletePage.Enabled = tabControl1.TabPages.Count > 1;


            // Speed & frequency
            numericUpDownSpeed.DecimalPlaces     = 2;
            numericUpDownSpeed.Minimum           = (decimal)0.1;
            numericUpDownSpeed.Maximum           = (decimal)999.0;
            numericUpDownSpeed.Increment         = (decimal)0.5;
            numericUpDownSpeed.Value             = (decimal)1.0;
            numericUpDownFrequency.DecimalPlaces = 2;
            numericUpDownFrequency.Minimum       = (decimal)0.1;
            numericUpDownFrequency.Maximum       = (decimal)999.0;
            numericUpDownFrequency.Increment     = (decimal)0.5;
            numericUpDownFrequency.Value         = (decimal)1.0;

            // CommandsView
            CommandsView.ExpandAll();
            TableLayoutListCommandsPanel.AutoSize = true;
            TableLayoutListCommandsPanel.Hide();
            CommandsView.Controls.Add(TableLayoutListCommandsPanel);

            // Event name
            textBoxEventName.Select();
            textBoxEventName.Focus();

            // Events
            graphicControl1.ClosingDialogEvent += graphicControl1_ClosingDialogEvent;
            GraphicFrameTimer.Elapsed          += graphicFrameTimer_Elapsed;
            graphicControl1.GetComboBox().SelectedIndexChanged += DialogEvent_SelectedIndexChanged;
            CommandsView.LostFocus                 += CommandsView_LostFocus;
            CommandUnderscoreTimer.Tick            += CommandUnderscoreTimer_Tick;
            TableLayoutListCommandsPanel.CellPaint += TableLayoutListCommandsPanel_CellPaint;

            // Trigger
            foreach (EventTrigger trigger in Enum.GetValues(typeof(EventTrigger)))
            {
                RadiosTrigger[trigger].GroupName = "trigger";
                RadiosTrigger[trigger].AutoCheck = false;
                RadiosTrigger[trigger].Click    += radioTrigger_Clicked;
            }

            InitializeDataBindings();
        }
Пример #2
0
        // -------------------------------------------------------------------
        // Constructors
        // -------------------------------------------------------------------

        public DialogEventControl(SystemEvent ev)
        {
            Model = ev;
        }