Ejemplo n.º 1
0
 private void SetLblText(Label Lbl, string Txt)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (Lbl.InvokeRequired)
     {
         SetLblTextCallback d = new SetLblTextCallback(SetLblText);
         Lbl.Invoke(d, Lbl, Txt);
     }
     else
     {
         try
         {
             Lbl.Text = Txt;
         }
         catch (Exception ex)
         {
             if (!VarGlobal.LessVerbose)
             {
                 Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
             }
         }
     }
 }
Ejemplo n.º 2
0
 private static void SetTextOfLogin(string text)
 {
     try
     {
         if (LoginWinform.getForm().pingLbl.InvokeRequired)
         {
             SetLblTextCallback d = new SetLblTextCallback(SetTextOfLogin);
             LoginWinform.getForm().pingLbl.Invoke(d, new object[] { text });
         }
         else
         {
             LoginWinform.getForm().pingLbl.Text = text;
         }
     }
     catch (Exception ex)
     {
     }
 }