Esempio n. 1
0
        //
        //
        //
        #endregion//Public Methods


        #region no Private Methods
        // *****************************************************************
        // ****                     Private Methods                     ****
        // *****************************************************************
        //
        //
        //
        //
        #endregion//Private Methods


        #region Event Handlers
        // *****************************************************************
        // ****                     Event Handlers                     ****
        // *****************************************************************
        //
        //
        // ****         textBox_KeyUp     ****
        //
        /// <summary>
        /// Handles when a user types into the textbox.
        /// </summary>
        private void textBox_KeyUp(object sender, KeyEventArgs e)
        {
            TextBox tb = (TextBox)sender;       // sender of this event is text box

            if (e.KeyCode == Keys.Enter)
            {   // "enter key" was pressed!
                // Generate a parameter change request for our associated engine.
                string newValue = tb.Text;
                //m_ParameterInfo.EngineHub.HubEventEnqueue(EngineEventArgs.RequestParameterChange(m_ParameterInfo, newValue));//, hubID));
                m_RemoteEngineHub.HubEventEnqueue(EngineEventArgs.RequestParameterChange(m_ParameterInfo, newValue));//, hubID));
            }
            else if (e.KeyCode == Keys.Escape)
            {   // "escape key"
                tb.Text           = m_Memory.ToString();
                IsUserInputActive = false;
                tb.ForeColor      = TextColorDefault;
            }
            else
            {                                 // the key pressed was NOT the enter key.
                if (!IsUserInputActive)
                {                             // first time we started typing here.
                    // tb.Clear();
                    IsUserInputActive = true; // flag that user is typing.
                    tb.ForeColor      = TextColorHiLite;
                }
            }
        }//end textBox_KeyUp()
Esempio n. 2
0
 private void bParameter_Click(object sender, EventArgs e)
 {
     if (!IsBoolReadOnly)
     {   // Assume that user wants to toggle the current result.
         bool newValue = !(bool)m_Memory;
         m_RemoteEngineHub.HubEventEnqueue(EngineEventArgs.RequestParameterChange(m_ParameterInfo, newValue));
     }
 }
Esempio n. 3
0
        //
        //
        #endregion//public methods



        #region Public Methods
        // *****************************************************************
        // ****                     Public Methods                      ****
        // *****************************************************************
        //
        //
        private void checkBox_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox tb       = (CheckBox)sender;
            bool     newValue = !tb.Checked;   // a user click is an attempt to toggle the state.

            //
            m_RemoteEngineHub.HubEventEnqueue(EngineEventArgs.RequestParameterChange(m_ParameterInfo, newValue));
        }
Esempio n. 4
0
        //
        //
        private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cb     = (ComboBox)sender;
            string   newStr = cb.SelectedItem.ToString();
            string   oldStr = m_Memory.ToString();

            if (!oldStr.Equals(newStr))
            {
                object newValue = Enum.Parse(m_ParameterInfo.ValueType, newStr);
                m_RemoteEngineHub.HubEventEnqueue(EngineEventArgs.RequestParameterChange(m_ParameterInfo, newValue));
            }
        }
Esempio n. 5
0
        }// TryGetParameter()

        //
        // *********************************************
        // ****         TrySetParameter()           ****
        // *********************************************
        public bool TrySetParameter(string parameterName, object newValue)
        {
            int parameterId;

            if (m_ParameterNameTable.TryGetValue(parameterName, out parameterId))
            {
                m_ParameterValueTable[parameterId] = newValue;
                m_RemoteEngineHub.HubEventEnqueue(EngineEventArgs.RequestParameterChange(m_PInfo[parameterId], newValue));
                return(true);
            }
            // Exit
            return(false);
        }// TryGetParameter()
Esempio n. 6
0
        //
        //
        //
        #endregion//Public Methods


        #region no Private Methods
        // *****************************************************************
        // ****                     Private Methods                     ****
        // *****************************************************************
        //
        //
        //
        //
        #endregion//Private Methods


        #region Event Handlers
        // *****************************************************************
        // ****                     Event Handlers                     ****
        // *****************************************************************
        //
        //
        // ****         textBox_KeyUp     ****
        //
        /// <summary>
        /// Handles when a user types into the textbox.
        /// </summary>
        private void textBox_KeyUp(object sender, KeyEventArgs e)
        {
            TextBox tb = (TextBox)sender;       // sender of this event is text box

            if (e.KeyCode == Keys.Enter)
            {   // "enter key" was pressed!
                // Generate a parameter change request for our associated engine.
                string newValueStr = tb.Text;
                try
                {
                    // Test the format!
                    int newValue = Convert.ToInt32(tb.Text);
                    //int hubID = 1;  // id of the display hub that holds this
                    m_RemoteEngineHub.HubEventEnqueue(EngineEventArgs.RequestParameterChange(m_ParameterInfo, newValue)); //, hubID));
                    ParameterName.Focus();                                                                                // take focus from textbox.
                }
                catch (Exception)
                {   // Failed restore old value
                    tb.Text           = m_Memory.ToString();
                    IsUserInputActive = false;
                    tb.ForeColor      = TextColorDefault;
                }
                IsUserInputActive = false;
            }
            else if (e.KeyCode == Keys.Escape)
            {   // "escape key"
                tb.Text           = m_Memory.ToString();
                IsUserInputActive = false;
                tb.ForeColor      = TextColorDefault;
            }
            else
            {                                 // the key pressed was NOT the enter key.
                if (!IsUserInputActive)
                {                             // first time we started typing here.
                    // tb.Clear();
                    IsUserInputActive = true; // flag that user is typing.
                    tb.ForeColor      = TextColorHiLite;
                }
            }
        }//end textBox_KeyUp()