private void CanUploadFillRule(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { Windows.DependencyObject d = sender as Windows.DependencyObject; RuleFileManager manager = (d == null ? null : d.GetValue(Windows.FrameworkElement.DataContextProperty) as RuleFileManager); e.CanExecute = manager != null && manager.IsUploading == false; }
private void OnUploadFillRule(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { Windows.DependencyObject d = sender as Windows.DependencyObject; RuleFileManager manager = (d == null ? null : d.GetValue(Windows.FrameworkElement.DataContextProperty) as RuleFileManager); System.Threading.ThreadPool.QueueUserWorkItem(RuleFileUploadWorker, manager); }
private static void RuleFileUploadWorker(object state) { try { RuleFileManager manager = state as RuleFileManager; System.Threading.ThreadPool.QueueUserWorkItem((param) => { manager.Upload(); }, null); } catch (Exception ex) { WebBrowserUtils.HtmlUtils.Fillers.WebFillManager.ShowMessageBox(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }