private void init(object sender, EventArgs e) { ICurrentDocumentWindow currentDocumentWin = this.GetServiceForThisTypeKey <ICurrentDocumentWindow>(); if (currentDocumentWin == null) { return; } IFindControlService ser = this.GetService <IFindControlService>(); Control c; if (ser.TryGet("XdesignerGrid1XMO_AB_D2", out c)) { _dgGrid3 = c as DigiwinGrid; _dgGrid3.InnerGridView.MouseDown += new MouseEventHandler(InnerGridView_MouseDown); } Control d; if (ser.TryGet("XdesignerGrid1XMO_AB_D1", out d)) { _dgGrid1 = d as DigiwinGrid; _dgGrid1.InnerGridView.MouseDown += new MouseEventHandler(_dgGrid1_InnerGridView_MouseDown); } }
public override void Execute() { ICurrentDocumentWindow win = this.GetServiceForThisTypeKey <ICurrentDocumentWindow>(); ServiceControl serControl = win.EditController.EditorView as ServiceControl; DependencyObject entity = win.EditController.EditorView.DataSource as DependencyObject; DependencyObjectCollection XMO_AA_D2 = entity["XMO_AA_D2"] as DependencyObjectCollection; IFindControlService findSer = serControl.GetService <IFindControlService>(); if (XMO_AA_D2.Count == 0) { DigiwinMessageBox.ShowInfo("无导出数据!"); return; } Control control; if (findSer.TryGet("XdesignerGrid1XMO_AA_D1", out control)) { DigiwinGrid gridControl = control as DigiwinGrid; if (gridControl != null) { BindingSource bs = gridControl.DataSource as BindingSource; DependencyObjectCollection entityDColl = ((DependencyObjectCollectionView <DependencyObjectView>)bs.List).DependencyObjectCollection; using (var form = new ExportExcelForm(gridControl.InnerGridView, this.ResourceServiceProvider, this.ServiceCallContext)) { DialogResult log = form.ShowDialog(); if (log == DialogResult.OK) { DigiwinMessageBox.ShowInfo("资料导出成功!"); } form.Dispose(); } } } return; using (var form = new ExportExcelForm(entity, this.ResourceServiceProvider, this.ServiceCallContext)) { DialogResult log = form.ShowDialog(); if (log == DialogResult.OK) { DigiwinMessageBox.ShowInfo("资料导出成功!"); } form.Dispose(); } }