Exemple #1
0
 private void updateStatus(string text)
 {
     if (!InvokeRequired)
     {
         string nuevaLinea = System.DateTime.Now + " - " + text;
         statusLabel.Text = nuevaLinea;
     }
     else
     {
         // Show progress asynchronously
         updateStatusDelegate logOp = new updateStatusDelegate(updateStatus);
         this.Invoke(logOp, new object[] { text });
     }
 }
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        updateStatusDelegate usd = new updateStatusDelegate(
            progressBar.SetValue);

        Dispatcher.Invoke(usd,
                          System.Windows.Threading.DispatcherPriority.Background,
                          new object[] {
            System.Windows.Controls.ProgressBar.ValueProperty,
            Convert.ToDouble(perc)
        });
        var dbl = Convert.ToDouble(perc);

        perc = (dbl + .1).ToString();
    }