Z
zequion1
Guest
In the structure variable Enum StTransfer.StProp.Invoke I indicate whether I use control.Dispatcher.Invoke or control.Dispatcher.BeginInvoke and the block of code that is executed is the same in both cases.Can I create a function to which I can pass that block of code so that it can be executed in a standard way?I mean a block of code like this:
if (StTransfer_ProgressBar != null)
{ if (StTransfer.StProp.Invoke == Name_Invoke.Invoke.Invoke) StTransfer_ProgressBar.Dispatcher.Invoke(() => { StTransfer_ProgressBar.Minimum = indexIni;
StTransfer_ProgressBar.Maximum = indexFin;
StTransfer_ProgressBar.Value = indexIni;
StTransfer_ProgressBar.Visibility = System.Windows.Visibility.Visible;
StTransfer_ProgressBar.IsEnabled = true; });
else StTransfer_ProgressBar.Dispatcher.BeginInvoke((System.Action)(() => { StTransfer_ProgressBar.Minimum = indexIni;
StTransfer_ProgressBar.Maximum = indexFin;
StTransfer_ProgressBar.Value = indexIni;
StTransfer_ProgressBar.Visibility = System.Windows.Visibility.Visible;
StTransfer_ProgressBar.IsEnabled = true; } ));
}
Continue reading...
if (StTransfer_ProgressBar != null)
{ if (StTransfer.StProp.Invoke == Name_Invoke.Invoke.Invoke) StTransfer_ProgressBar.Dispatcher.Invoke(() => { StTransfer_ProgressBar.Minimum = indexIni;
StTransfer_ProgressBar.Maximum = indexFin;
StTransfer_ProgressBar.Value = indexIni;
StTransfer_ProgressBar.Visibility = System.Windows.Visibility.Visible;
StTransfer_ProgressBar.IsEnabled = true; });
else StTransfer_ProgressBar.Dispatcher.BeginInvoke((System.Action)(() => { StTransfer_ProgressBar.Minimum = indexIni;
StTransfer_ProgressBar.Maximum = indexFin;
StTransfer_ProgressBar.Value = indexIni;
StTransfer_ProgressBar.Visibility = System.Windows.Visibility.Visible;
StTransfer_ProgressBar.IsEnabled = true; } ));
}
Continue reading...