コード例 #1
0
ファイル: DiagnosticView.cs プロジェクト: Brzobohaty/Robot
        /// <summary>
        /// Zobrazí chybovou hlášku týkající se sběrnice
        /// </summary>
        /// <param name="type">typ hlášky</param>
        /// <param name="message">text chyby</param>
        public void showDisgnosticMessage(MessageTypeEnum type, string message)
        {
            switch (type)
            {
            case MessageTypeEnum.error:
                //MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                labelMessage.ForeColor = Color.Red;
                break;

            case MessageTypeEnum.success:
                labelMessage.ForeColor = Color.Green;
                break;

            case MessageTypeEnum.progress:
                labelMessage.ForeColor = Color.Blue;
                break;
            }
            if (labelMessage.InvokeRequired)
            {
                ShowDisagnosticMessageCallback cb = new ShowDisagnosticMessageCallback(showDisgnosticMessage);
                this.Invoke(cb, new object[] { type, message });
            }
            else
            {
                labelMessage.Text = message;
            }
        }
コード例 #2
0
ファイル: DiagnosticView.cs プロジェクト: Brzobohaty/Robot
 /// <summary>
 /// Zobrazí chybovou hlášku týkající se sběrnice
 /// </summary>
 /// <param name="type">typ hlášky</param>
 /// <param name="message">text chyby</param>
 public void showDisgnosticMessage(MessageTypeEnum type, string message)
 {
     switch (type)
     {
         case MessageTypeEnum.error:
             //MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             labelMessage.ForeColor = Color.Red;
             break;
         case MessageTypeEnum.success:
             labelMessage.ForeColor = Color.Green;
             break;
         case MessageTypeEnum.progress:
             labelMessage.ForeColor = Color.Blue;
             break;
     }
     if (labelMessage.InvokeRequired)
     {
         ShowDisagnosticMessageCallback cb = new ShowDisagnosticMessageCallback(showDisgnosticMessage);
         this.Invoke(cb, new object[] { type, message });
     }
     else
     {
         labelMessage.Text = message;
     }
     
 }