Exemplo n.º 1
0
 /// <summary>
 /// 更新上报状态
 /// </summary>
 /// <param name="isSuccess"></param>
 /// <param name="msg"></param>
 public void SetNewInfo(string msg, bool?isSuccess)
 {
     if ((CurrentUc is UCMain) == false)
     {
         return;
     }
     if (this.InvokeRequired)
     {
         SetNewInfoDelegate d = new SetNewInfoDelegate(SetNewInfo);
         this.Invoke(d, msg, isSuccess);
     }
     else
     {
         (CurrentUc as UCMain).SetSyncInfo(msg);
         //if (isSuccess != null)
         //{
         //    if ((bool)isSuccess)
         //        pnlNews.BackColor = Color.Lime;
         //    else
         //        pnlNews.BackColor = Color.Red;
         //}
         //lblNews.Text = string.Format("[{0}]{1}", DateTime.Now.ToString("HH:mm:ss"), msg);
         ////if (lblNews.Text.Length > 35)
         ////{
         ////    if (lblNews.Height == 18)
         ////    {
         ////        pnlAbout.Height += 18;
         ////        lblAbout.Top += 18;
         ////        lblNews.Height += 18;
         ////    }
         ////}
         ////else if (lblNews.Height > 18)
         ////{
         ////    pnlAbout.Height -= 18;
         ////    lblAbout.Top -= 18;
         ////    lblNews.Height -= 18;
         ////}
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 更新上报状态
 /// </summary>
 /// <param name="isSuccess"></param>
 /// <param name="msg"></param>
 public void SetNewInfo(string msg, bool?isSuccess)
 {
     if (this.InvokeRequired)
     {
         SetNewInfoDelegate d = new SetNewInfoDelegate(SetNewInfo);
         this.Invoke(d, msg, isSuccess);
     }
     else
     {
         if (isSuccess != null)
         {
             if ((bool)isSuccess)
             {
                 pnlNews.BackColor = Color.Lime;
             }
             else
             {
                 pnlNews.BackColor = Color.Red;
             }
         }
         lblNews.Text = string.Format("[{0}]{1}", DateTime.Now.ToString("HH:mm:ss"), msg);
         if (lblNews.Text.Length > 35)
         {
             if (lblNews.Height == 18)
             {
                 pnlAbout.Height += 18;
                 lblAbout.Top    += 18;
                 lblNews.Height  += 18;
             }
         }
         else if (lblNews.Height > 18)
         {
             pnlAbout.Height -= 18;
             lblAbout.Top    -= 18;
             lblNews.Height  -= 18;
         }
     }
 }