private void comparer_Finished(object sender, EventArgs e) { this.Invoke((Action)(() => { if (this.comparer == null) { return; } XtraTabPage result = new XtraTabPage(); System.Windows.Forms.Integration.ElementHost elementHost1 = new System.Windows.Forms.Integration.ElementHost(); elementHost1.Dock = DockStyle.Fill; System.Windows.Controls.ContentControl contentCtrl = new System.Windows.Controls.ContentControl(); System.Windows.ResourceDictionary res = new System.Windows.ResourceDictionary(); res.BeginInit(); res.Source = new Uri("pack://application:,,,/Assistant;component/Template/ResultViewer.xaml"); res.EndInit(); contentCtrl.ContentTemplate = res["resultViewer"] as System.Windows.DataTemplate; contentCtrl.DataContext = this.comparer.Result; contentCtrl.Content = this.comparer.Result; elementHost1.Child = contentCtrl; result.Controls.Add(elementHost1); result.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True; result.Text = "网页元素对比结果"; this.tabPageControl.TabPages.Add(result); this.tabPageControl.SelectedTabPage = result; this.comparer.Finished -= comparer_Finished; this.comparer = null; if (_fillManager != null) { this._fillManager.EndFill(); this._fillManager = null; } })); }
private void carSelect_ItemClick(object sender, ItemClickEventArgs e) { System.Windows.Window wnd = new System.Windows.Window(); wnd.CommandBindings.Add(new System.Windows.Input.CommandBinding(Commands.OK, OnCompareCarSelect)); System.Windows.ResourceDictionary res = new System.Windows.ResourceDictionary(); res.BeginInit(); res.Source = new Uri("pack://application:,,,/Assistant;component/Template/CarTypeSelector.xaml"); res.EndInit(); wnd.Style = res["carTypeSelector"] as System.Windows.Style; wnd.ShowInTaskbar = false; wnd.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; CarTypeSelector selector = new CarTypeSelector(); if (selectedNode != null) { selector.SelectedItem = selectedNode.Header; } wnd.Content = selector; wnd.DataContext = selector; if (wnd.ShowDialog() == true) { selectedNode = selector.Tree.Children[0] as RuleCompareNode; comparer = new RuleComparer(selectedNode, mainWebBrowser); } }
private void ViewRecordHistory() { XtraTabPage result = new XtraTabPage(); System.Windows.Forms.Integration.ElementHost elementHost1 = new System.Windows.Forms.Integration.ElementHost(); elementHost1.Dock = DockStyle.Fill; System.Windows.Controls.ContentControl contentCtrl = new System.Windows.Controls.ContentControl(); System.Windows.ResourceDictionary res = new System.Windows.ResourceDictionary(); res.BeginInit(); res.Source = new Uri("pack://application:,,,/Assistant;component/Template/RecordViewer.xaml"); res.EndInit(); contentCtrl.ContentTemplate = res["recordViewer"] as System.Windows.DataTemplate; try { contentCtrl.DataContext = HistoryHelper.GetHistoryList(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } contentCtrl.Content = contentCtrl.DataContext; contentCtrl.CommandBindings.Add(new System.Windows.Input.CommandBinding(Commands.View, this.OnViewHistoryDetail)); elementHost1.Child = contentCtrl; result.Controls.Add(elementHost1); result.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True; result.Text = "历史记录"; this.tabPageControl.TabPages.Add(result); this.tabPageControl.SelectedTabPage = result; }
private void OpenAppManager_ItemClick(object sender, ItemClickEventArgs e) { foreach (XtraTabPage item in this.tabPageControl.TabPages) { if (item.Text == "应用程序管理") { this.tabPageControl.SelectedTabPage = item; return; } } XtraTabPage result = new XtraTabPage(); System.Windows.Forms.Integration.ElementHost elementHost1 = new System.Windows.Forms.Integration.ElementHost(); elementHost1.Dock = DockStyle.Fill; System.Windows.Controls.ContentControl contentCtrl = new System.Windows.Controls.ContentControl(); System.Windows.ResourceDictionary res = new System.Windows.ResourceDictionary(); res.BeginInit(); res.Source = new Uri("pack://application:,,,/Assistant;component/Template/AppManager.xaml"); res.EndInit(); contentCtrl.ContentTemplate = res["appManager"] as System.Windows.DataTemplate; contentCtrl.CommandBindings.Add(new System.Windows.Input.CommandBinding(Commands.Browser, OnOpenAppFile, CanOpenAppFile)); contentCtrl.CommandBindings.Add(new System.Windows.Input.CommandBinding(Commands.OK, OnUploadAppFile, CanUploadAppFile)); contentCtrl.CommandBindings.Add(new System.Windows.Input.CommandBinding(Commands.Add, OnAddAppFile)); contentCtrl.CommandBindings.Add(new System.Windows.Input.CommandBinding(Commands.Delete, OnDeleteAppFile, CanDeleteAppFiel)); contentCtrl.CommandBindings.Add(new System.Windows.Input.CommandBinding(Commands.Remove, OnRemoveAppFile, CanRemoveAppFiel)); try { contentCtrl.DataContext = new AppFileManager(); contentCtrl.Content = contentCtrl.DataContext; elementHost1.Child = contentCtrl; result.Controls.Add(elementHost1); result.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True; result.Text = "应用程序管理"; this.tabPageControl.TabPages.Add(result); this.tabPageControl.SelectedTabPage = result; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FillManager_Finished(object sender, EventArgs e) { FillManagerBase fillManager = sender as FillManagerBase; if (fillManager is CCCFillManager) { if (this.InvokeRequired) { this.Invoke((Action)(() => { End3CFill(); })); } else { End3CFill(); } } foreach (TabPageWithWebBrowser item in this.tabPageControl.TabPages) { if (item != null && item.FillManager == this._fillManager) { item.FillManager = null; } } this.Invoke((Action)(() => { XtraTabPage result = new XtraTabPage(); System.Windows.Forms.Integration.ElementHost elementHost1 = new System.Windows.Forms.Integration.ElementHost(); elementHost1.Dock = DockStyle.Fill; System.Windows.Controls.ContentControl contentCtrl = new System.Windows.Controls.ContentControl(); System.Windows.ResourceDictionary res = new System.Windows.ResourceDictionary(); res.BeginInit(); res.Source = new Uri("pack://application:,,,/Assistant;component/Template/FillResult.xaml"); res.EndInit(); contentCtrl.ContentTemplate = res["fillResult"] as System.Windows.DataTemplate; contentCtrl.DataContext = fillManager.FillRecords; contentCtrl.Content = fillManager.FillRecords; elementHost1.Child = contentCtrl; result.Controls.Add(elementHost1); result.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True; result.Text = "填报结果"; this.tabPageControl.TabPages.Add(result); this.tabPageControl.SelectedTabPage = result; })); if (fillManager != null) { fillManager.Finished -= FillManager_Finished; try { HistoryHelper.InsertList(fillManager.FillRecords, fillManager.FillType, Constants.CurrentUser == null ? "测试用户" : Constants.CurrentUser.userName); this._fillManager = null; } catch (Exception ex) { this.Invoke((Action)(() => { MessageBox.Show(ex.Message); })); } } }