예제 #1
0
        /// <summary>
        /// This function allows to convert the User Inut String before storing the data in the ringbuffer
        /// </summary>
        /// <param name="stringMessage"></param>
        public MsgData getRawMsgWithCurrentViewSettings(string stringMessage)
        {
            // Define the needed Variables
            MsgData message = new MsgData();

            message.setCurrentTimeStamp();

            // Variables for the Split
            string[] splitValues = new string[] { ",", " " };
            string[] splitedMsg  = stringMessage.Split(splitValues, 1024, StringSplitOptions.RemoveEmptyEntries);
            byte[]   rawData     = new byte[splitedMsg.Length];

            // Convert the User Input to the Current Settings
            // Return the Msg with the Current View Configuration
            switch (viewSettings.dataPresentation)
            {
            default:    // ASCII Encoded Strings

                message.value = Converty.specialAsciiStringToMsgData(stringMessage);
                break;

            case 1:    // HEX Values of the Bytes recived

                for (int i = 0; i <= splitedMsg.Length - 1; i++)
                {
                    rawData[i] = Convert.ToByte(splitedMsg[i], 16);
                }

                message.value = rawData;

                break;

            case 2:    // DEC Values of the Bytes recived

                for (int i = 0; i <= splitedMsg.Length - 1; i++)
                {
                    rawData[i] = Convert.ToByte(splitedMsg[i], 10);
                }

                message.value = rawData;

                break;

            case 3:    // BIN Values of the Bytes recived

                for (int i = 0; i <= splitedMsg.Length - 1; i++)
                {
                    rawData[i] = Convert.ToByte(splitedMsg[i], 2);
                }

                message.value = rawData;

                break;
            }

            return(message);
        }
예제 #2
0
        /// <summary>
        /// Send the Data to the Eventhandler.. To update the Main UI and send the Data to teh Connection
        /// </summary>
        private void SendData(string data)
        {
            // Set the User Hint to the TextBox
            MsgData _logMessage = new MsgData();

            _logMessage.value = Converty.specialAsciiStringToMsgData(data);
            _logMessage.type  = MsgData.messageType.send;

            // Set the Event that the User Changed an Input
            MsgSendRecivedEventArgs _msgLogEventArgs = new MsgSendRecivedEventArgs();

            _msgLogEventArgs.msgData = _logMessage;
            msgSendRecived(_msgLogEventArgs);
        }
예제 #3
0
        /// <summary>
        /// Click of the Quick Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QuickButton_Click(object sender, RoutedEventArgs e)
        {
            Button _quickButton = sender as Button;

            // Set the User Hint to the TextBox
            MsgData logMessage = new MsgData();

            logMessage.value = Converty.specialAsciiStringToMsgData((String)_quickButton.Resources["data"]);
            logMessage.type  = MsgData.messageType.send;

            // Set the Event that the User Changed an Input
            MsgSendRecivedEventArgs msgLogEventArgs = new MsgSendRecivedEventArgs();

            msgLogEventArgs.msgData = logMessage;
            msgSendRecived(msgLogEventArgs);
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputKey"></param>
        public void KeyInpuEvent(Key inputKey)
        {
            foreach (Button _button in buttonList)
            {
                if ((Key)_button.Resources["shortCut"] == inputKey)
                {
                    // Set the User Hint to the TextBox
                    MsgData logMessage = new MsgData();
                    logMessage.value = Converty.specialAsciiStringToMsgData((String)_button.Resources["data"]);
                    logMessage.type  = MsgData.messageType.send;

                    // Set the Event that the User Changed an Input
                    MsgSendRecivedEventArgs msgLogEventArgs = new MsgSendRecivedEventArgs();
                    msgLogEventArgs.msgData = logMessage;
                    msgSendRecived(msgLogEventArgs);
                }
            }
        }