Пример #1
0
 public void text(MainWindow con, TextBox tbw, ListBox lb, bool wart)
 {
     if (!tbw.CheckAccess() && !lb.CheckAccess())
     {
         con.Dispatcher.Invoke(DispatcherPriority.Send,
         (Action)delegate
         {
             Visibility stan;
             if (wart == true)
                 stan = System.Windows.Visibility.Hidden;
             else
                 stan = System.Windows.Visibility.Visible;
             lb.Visibility = stan;
             if (wart == false)
                 stan = System.Windows.Visibility.Hidden;
             else
                 stan = System.Windows.Visibility.Visible;
             tbw.Visibility = stan;
         });
     }
     else
     {
         Visibility stan;
         if (wart == true)
             stan = System.Windows.Visibility.Hidden;
         else
             stan = System.Windows.Visibility.Visible;
         lb.Visibility = stan;
         if (wart == false)
             stan = System.Windows.Visibility.Hidden;
         else
             stan = System.Windows.Visibility.Visible;
         tbw.Visibility = stan;
     }
 }
 public void write(MainWindow con, TextBox tbWiad, string text)
 {
     if (!tbWiad.CheckAccess())
     {
         con.Dispatcher.Invoke(DispatcherPriority.Send,
         (Action)delegate
         {
             tbWiad.Text += text + Environment.NewLine;
         });
     }
     else
         tbWiad.Text += text + Environment.NewLine;
 }