private void ModifyItem(object sender, EventArgs e) { CreateIodDialog createIodDlg = new CreateIodDialog(_controlType); createIodDlg.ModifyExisting = true; ListViewItem lvItem = _listViewMaster.SelectedItems[0]; createIodDlg.Uid = lvItem.Text; //"1.1.1"; createIodDlg.Description = lvItem.SubItems[1].Text; //"Description"; DialogResult dr = createIodDlg.ShowDialog(); if (dr == DialogResult.OK) { lvItem.SubItems[1].Text = createIodDlg.Description; lvItem.EnsureVisible(); if (_controlType == StorageClassesControlType.StorageClasses) { _presentationContextList.UpdateUserDefinedIod(createIodDlg.Uid, createIodDlg.Description); LocalAuditLogQueue.AddAuditMessage(AuditMessages.StorageIodModified.Key, string.Format(AuditMessages.StorageIodModified.Message, createIodDlg.Uid, createIodDlg.Description)); } else { _presentationContextList._masterTransferSyntaxList.UpdateUserDefinedTransferSyntax(createIodDlg.Uid, createIodDlg.Description); LocalAuditLogQueue.AddAuditMessage(AuditMessages.TransferSyntaxModified.Key, string.Format(AuditMessages.TransferSyntaxModified.Message, createIodDlg.Uid, createIodDlg.Description)); } OnSetIsDirty(sender, e); } }
private void _buttonCreate_Click(object sender, EventArgs e) { CreateIodDialog createIodDlg = new CreateIodDialog(_controlType); createIodDlg.ModifyExisting = false; DialogResult dr = createIodDlg.ShowDialog(); if (dr == DialogResult.OK) { if (_presentationContextList.PresentationContextExists(createIodDlg.Uid) || _presentationContextList._masterTransferSyntaxList.TransferSyntaxExists(createIodDlg.Uid)) { string sMsg = string.Format("UID '{0}' aready exists! Please choose a different UID.", createIodDlg.Uid); MessageBox.Show(sMsg + createIodDlg.Uid, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ListViewItem item = _listViewMaster.Items.Add(createIodDlg.Uid); item.SubItems.Add(createIodDlg.Description); item.ImageIndex = 0; item.Selected = true; item.EnsureVisible(); if (_controlType == StorageClassesControlType.StorageClasses) { _presentationContextList.AddPresentationContextWithDefaultTransferSyntax(createIodDlg.Uid, createIodDlg.Description, true, false); LocalAuditLogQueue.AddAuditMessage(AuditMessages.StorageIodCreated.Key, string.Format(AuditMessages.StorageIodCreated.Message, createIodDlg.Uid, createIodDlg.Description)); } else { _presentationContextList._masterTransferSyntaxList.AddTransferSyntax(createIodDlg.Uid, createIodDlg.Description, true, false); LocalAuditLogQueue.AddAuditMessage(AuditMessages.TransferSyntaxCreated.Key, string.Format(AuditMessages.TransferSyntaxCreated.Message, createIodDlg.Uid, createIodDlg.Description)); } OnSetIsDirty(sender, e); } } }