Online Help - Region 3: [CORE HL7 API Dialogs] |
Available only in the .Net Framework platform
Parent: HL7DefinitionManager
Method: EditHL7Definition() - See Example Code Below
Returns: HL7DefinitionUpdateResult
Description:
private void EditDefinition() { try { //Use My HL7Controller object to create a HL7DefinitionManager HL7DefinitionManager vMg = new HL7DefinitionManager(LPInternals.MyController);
//Get the HL7Definiton the user has selected in the TreeView HL7Definition def = GetCurrentDefinition(); if (def == null) { UpdateDisplay(); return; } //To keep the user from renaming a defintion that would clash //with my other definitions we get a List<> of all of the //definitions to pass into the editing sub-system List<HL7Definition> ml = MyDefinitions;
//ReadOnly is always false but we'll declare a variable anyway bool rdonly = false; //We're going to tell the subsystem to display a file name //while they edit string fName = TXTDataFolder.Text + def.Tag.StringValue; vMg.ShowFileName = true; vMg.FileName = fName; //vMg.AllowDefinitionRename = false; //vMg.AllowHL7VersionChange = false; vMg.HelpURL = HelpURL; //Now Hide the Main Window and show the Dialog Hide(); HL7DefinitionUpdateResult newRes = vMg.EditHL7Definition(this, def, rdonly, ml); Show(); MouseOn();
//Interpret the results of the editing session if (vMg.UserCancelled) { MouseOff(); return; } if (!newRes.WasModified) { return; } //They modified the definition in some way. //The new HL7Definition is held in newRes.FinalDefinition fName = TXTDataFolder.Text + newRes.FinalDefinition.SuggestedFileTitle(); if (!newRes.FinalDefinition.SaveAs(fName, true)) { MouseOff(); FormResults.ErrorMsgBox(newRes.FinalDefinition.LastException.ExtendedErrorMessage); return; } //Show the results LoadData(newRes.FinalDefinition.VendorDisplayName); UpdateDisplay(); MouseOff(); } catch (Exception ex) {
MouseOff(); FormResults.ErrorMsgBox(ex.Message, "Error"); } }
|