Exemplo n.º 1
0
        /// <summary>
        /// 提示信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Instance_Notify(object sender, USe.Common.USeNotifyEventArgs e)
        {
            try
            {
                if (this.InvokeRequired)
                {
                    this.BeginInvoke(new EventHandler <USeNotifyEventArgs>(Instance_Notify), sender, e);
                    return;
                }

                this.richTextBox_Log.AppendText(e.Message + '\n');
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void OnNotifyEventArrived(object sender, USe.Common.USeNotifyEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new EventHandler <USeNotifyEventArgs>(OnNotifyEventArrived), sender, e);
                return;
            }

            if (m_verboseFlag == false && e.Level == USeNotifyLevel.Verbose)
            {
                return;
            }

            ErrorNoticeViewModel log = new ErrorNoticeViewModel();

            log.Level   = e.Level;
            log.LogTime = e.Time;
            log.Message = e.Message;
            switch (e.Level)
            {
            case USeNotifyLevel.Critical:
            case USeNotifyLevel.Error:
                log.LevelIcon = global::MarketDataStore.Properties.Resources.error;
                break;

            case USeNotifyLevel.Warning:
                log.LevelIcon = global::MarketDataStore.Properties.Resources.warning;
                break;

            case USeNotifyLevel.Information:
            case USeNotifyLevel.Verbose:
            default:
                log.LevelIcon = global::MarketDataStore.Properties.Resources.information;
                break;
            }
            m_dataSource.Insert(0, log);
        }