public void PopulateDocuments() { this.Cursor = Cursors.WaitCursor; try { _docViewer = null; InitializeDocumentViewer(); _docViewer.ReadOnly = this.ReadOnly; btnEdit.Enabled = btnDelete.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False; _docViewer.btnDownload.Enabled = _docViewer.btnEmail.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False; _documents = (new ServiceMASTERS()).GetDocumentsOfEntityForID(this.ENTITY, this.SelectedEntityID); listDocuments.DataSource = _documents; listDocuments.ValueMember = "ID"; listDocuments.DisplayMember = "Description"; } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ctrlAttachments::PopulateDocuments", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Cursor = Cursors.Default; }
public void InitializeDocumentViewer() { try { if (_docViewer == null) { _docViewer = new ctrlDocumentViewer(_ServerFilePath, this.ENTITY, this.SelectedEntityID, this.SelectedAttachmentID); } _docViewer.FileTitle = _FileTitle; splitContainerMain.Panel2.Controls.Clear(); splitContainerMain.Panel2.Controls.Add(_docViewer); _docViewer.Dock = DockStyle.Fill; } catch (Exception ex) { MessageBox.Show(ex.Message, "ctrlAttachment::InitializeDocumentViewer", MessageBoxButtons.OK, MessageBoxIcon.Error); } }