コード例 #1
0
        /*
         * private void InitSerialPort()
         * {
         *  serialPort.DataReceived += SerialPort_DataReceived;
         * }
         */

        private void UpdateInfo(String msg = "", MyUtil.UTIL.InfoType iType = MyUtil.UTIL.InfoType.message)
        {
            if (updateInfo != null)
            {
                updateInfo(msg, iType);
            }
        }
コード例 #2
0
        private void UpdateInfo(string msg = "", MyUtil.UTIL.InfoType iType = MyUtil.UTIL.InfoType.message, bool async = false)
        {
            if (Dispatcher.FromThread(Thread.CurrentThread) == null)
            {
                if (async)
                {
                    Application.Current.Dispatcher.BeginInvoke(
                        System.Windows.Threading.DispatcherPriority.Normal,
                        (Action)(() => UpdateInfo(msg, iType, async)));
                    return;
                }
                else
                {
                    Application.Current.Dispatcher.Invoke(
                        System.Windows.Threading.DispatcherPriority.Normal,
                        (Action)(() => UpdateInfo(msg, iType, async)));
                    return;
                }
            }
            // Update UI is allowed here
            switch (iType)
            {
            case MyUtil.UTIL.InfoType.message:
                statusBar.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x7A, 0xCC));
                break;

            case MyUtil.UTIL.InfoType.alert:
                statusBar.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xCA, 0x51, 0x00));
                break;

            case MyUtil.UTIL.InfoType.error:
                statusBar.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));
                break;
            }
            statusInfoTextBlock.Text = msg;
        }
コード例 #3
0
 private void UpdateInfoCallback(string msg, MyUtil.UTIL.InfoType iType)
 {
     UpdateInfo(msg, iType, false);
 }
コード例 #4
0
 private void UpdateInfo(string msg = "", MyUtil.UTIL.InfoType iType = MyUtil.UTIL.InfoType.message, bool async = false)
 {
     MyUtil.UI.UpdateInfo(statusBar, statusInfoTextBlock, msg, iType, async);
 }
コード例 #5
0
 private void UpdateInfo(string msg = "", MyUtil.UTIL.InfoType iType = MyUtil.UTIL.InfoType.message, bool async = false)
 {
     updateInfo?.Invoke(msg, iType, async);
 }