Beispiel #1
0
        /// <summary>
        /// Get event
        /// </summary>
        /// <param name="event_n">Number of event</param>
        /// <param name="el_name">element name</param>
        /// <param name="id">Event type</param>
        /// <param name="lparam">long value</param>
        /// <param name="dparam">double value</param>
        /// <param name="sparam">string value</param>
        public static void GetEvent(int event_n, ref string el_name, ref int id, ref long lparam, ref double dparam, ref string sparam)
        {
            GuiEvent e = m_global_events[event_n];

            el_name = e.el_name;
            id      = (int)e.id;
            lparam  = e.lparam;
            dparam  = e.dparam;
            sparam  = e.sparam;
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ex"></param>
        private static void SendExceptionEvent(Exception ex)
        {
            GuiEvent ex_event = new GuiEvent()
            {
                id     = (int)GuiEventType.Exception,
                sparam = ex.Message
            };

            m_global_events.Add(ex_event);
        }
Beispiel #3
0
        /// <summary>
        /// This method receives a change text event and sends it's to MetaTrader
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTextChange(Control control)
        {
            GuiEvent evnt = new GuiEvent
            {
                id      = GuiEventType.TextChange,
                el_name = control.Name,
                sparam  = control.Text
            };

            m_events.Add(evnt);
        }
Beispiel #4
0
        /// <summary>
        /// This method receives a click event and sends it's to MetaTrader
        /// </summary>
        /// <param name="sender">Any winform element</param>
        /// <param name="e"></param>
        private void OnClick(object sender, EventArgs e)
        {
            Control  control = (Control)sender;
            GuiEvent evnt    = new GuiEvent
            {
                id      = GuiEventType.ClickOnElement,
                el_name = control.Name
            };

            m_events.Add(evnt);
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDateTimePickerChanged(object sender, EventArgs e)
        {
            DateTimePicker picker = (DateTimePicker)sender;
            GuiEvent       evnt   = new GuiEvent
            {
                id      = GuiEventType.DateTimePickerChange,
                el_name = picker.Name,
                lparam  = MtConverter.ToMqlDateTime(picker.Value)
            };

            m_events.Add(evnt);
        }
Beispiel #6
0
        /// <summary>
        /// This method receives a change text event and sends it's to MetaTrader
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTextChange(object c, EventArgs e)
        {
            Control  control = (Control)c;
            GuiEvent evnt    = new GuiEvent
            {
                id      = GuiEventType.TextChange,
                el_name = control.Name,
                sparam  = control.Text
            };

            m_events.Add(evnt);
        }
Beispiel #7
0
        private void OnNumericChanged(object sender, EventArgs e)
        {
            NumericUpDown numeric = (NumericUpDown)sender;
            GuiEvent      evnt    = new GuiEvent
            {
                id      = GuiEventType.NumericChange,
                el_name = numeric.Name,
                dparam  = (double)numeric.Value
            };

            m_events.Add(evnt);
        }
Beispiel #8
0
        /// <summary>
        /// This method receives a click event and sends it's to MetaTrader
        /// </summary>
        /// <param name="sender">Any winform element</param>
        /// <param name="e"></param>
        private void OnChecked(object sender, EventArgs e)
        {
            CheckBox control = (CheckBox)sender;
            GuiEvent evnt    = new GuiEvent
            {
                id      = GuiEventType.CheckBoxChange,
                el_name = control.Name,
                sparam  = control.Text,
                lparam  = (long)control.CheckState
            };

            m_events.Add(evnt);
        }
Beispiel #9
0
        /// <summary>
        /// This method receives a click event and sends it's to MetaTrader
        /// </summary>
        /// <param name="sender">Any winform element</param>
        /// <param name="e"></param>
        private void OnTabChanged(object sender, EventArgs e)
        {
            TabControl control = (TabControl)sender;
            GuiEvent   evnt    = new GuiEvent
            {
                id      = GuiEventType.TabIndexChange,
                el_name = control.Name,
                lparam  = control.SelectedIndex,
                sparam  = control.SelectedTab.Name
            };

            m_events.Add(evnt);
        }
Beispiel #10
0
        /// <summary>
        /// This method receives the availability of the objec to MetaTrader
        /// </summary>
        /// <param name="sender">Any winform element</param>
        /// <param name="e"></param>
        private void OnEnableChange(object sender, EventArgs e)
        {
            Control  control = (Control)sender;
            GuiEvent evnt    = new GuiEvent
            {
                id      = GuiEventType.ElementEnable,
                el_name = control.Name,
                sparam  = control.Text,
                lparam  = control.Enabled ? 1 : 0,
            };

            m_events.Add(evnt);
        }
Beispiel #11
0
        private void OnRadioBtnCheckedChange(object sender, EventArgs e)
        {
            RadioButton control = (RadioButton)sender;
            GuiEvent    evnt    = new GuiEvent
            {
                id      = GuiEventType.RadioButtonChange,
                el_name = control.Name,
                sparam  = control.Text,
                lparam  = control.Checked ? 1 : 0
            };

            m_events.Add(evnt);
        }
Beispiel #12
0
        private void OnComboBoxChange(object sender, EventArgs e)
        {
            ComboBox control   = (ComboBox)sender;
            string   item_text = control.SelectedItem as string;
            GuiEvent evnt      = new GuiEvent
            {
                id      = GuiEventType.ComboBoxChange,
                el_name = control.Name,
                sparam  = item_text,
                lparam  = control.SelectedIndex
            };

            m_events.Add(evnt);
        }
Beispiel #13
0
        /// <summary>
        /// This method receives a scroll event and sends it's to MetaTrader
        /// </summary>
        /// <param name="sender">ScrollBar element</param>
        /// <param name="e">Params of scroll</param>
        private void OnScroll(object sender, EventArgs e)
        {
            Control         control     = (Control)sender;
            ScrollEventArgs scroll_args = (ScrollEventArgs)e;

            if (scroll_args.Type != ScrollEventType.SmallIncrement &&
                scroll_args.Type != ScrollEventType.SmallDecrement)
            {
                return;
            }
            GuiEvent evnt = new GuiEvent
            {
                id      = GuiEventType.ScrollChange,
                el_name = control.Name,
                lparam  = scroll_args.OldValue,
                dparam  = scroll_args.NewValue,
            };

            m_events.Add(evnt);
        }