private void buttonOpenDocument_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(DataID) || string.IsNullOrEmpty(ModuleID)) { MessageBox.Show("没有获取到足够的依据来打开文档, 请稍后再试", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (Yqun.Common.ContextCache.ApplicationContext.Current.IsAdministrator) { ModuleViewer Viewer = new ModuleViewer(new Guid(DataID), new Guid(ModuleID), Yqun.Common.ContextCache.ApplicationContext.Current.InTestRoom.Code); Form Owner = Cache.CustomCache[SystemString.主窗口] as Form; Viewer.Location = Owner.PointToScreen(Owner.ClientRectangle.Location); Viewer.Size = Owner.ClientRectangle.Size; Viewer.ReadOnly = false; Viewer.isNewData = false; Viewer.viewControl = null; Viewer.ShowDialog(); } else { DataDialog Dialog = new DataDialog(new Guid(DataID), new Guid(ModuleID)); Form Owner = Cache.CustomCache[SystemString.主窗口] as Form; Dialog.Owner = Owner; Dialog.Location = Owner.PointToScreen(Owner.ClientRectangle.Location); Dialog.Size = Owner.ClientRectangle.Size; Dialog.ReadOnly = true; Dialog.ShowDialog(); } }
private void OpenDocument(SheetView sheet, int row) { var tagID = sheet.Rows[row].Tag == null ? "" : sheet.Rows[row].Tag.ToString(); if (string.IsNullOrEmpty(tagID)) { return; } var testRoomCode = sheet.Cells[row, 2].Tag as string; if (string.IsNullOrEmpty(testRoomCode)) { return; } var documentID = new Guid(tagID); var form = new ModuleViewer(documentID, SummaryModuleID, testRoomCode); form.ShowDialog(); }