예제 #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);
 }
 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);
 }