Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 private void UpdateInfo(string msg = "", MyUtil.UTIL.InfoType iType = MyUtil.UTIL.InfoType.message, bool async = false)
 {
     updateInfo?.Invoke(msg, iType, async);
 }