/*
  * Handler for the Edit Button click event
  */
 private void lvInstruments_OnEdit()
 {
     if (lvInstruments.HasSelected)
     {
         var document = lvInstruments.SelectedObject as Document;
         var form = new InstrumentForm();
         InstrumentDescription instrumentDescription =
             InstrumentDescription.Deserialize( Encoding.UTF8.GetString( document.DocumentContent ) );
         form.InstrumentDescription = instrumentDescription;
         if (DialogResult.OK == form.ShowDialog())
         {
             instrumentDescription = form.InstrumentDescription;
             SaveInstrumentDescriptionDocument( instrumentDescription, document, BASEBean.eDataState.DS_EDIT );
             UpdateExistingDocumentInList( document, instrumentDescription.uuid );
             LoadInstrumentPreview();
         }
     }
 }
 /*
  * Handler for the Add Button click event
  */
 private void lvInstruments_OnAdd()
 {
     var form = new InstrumentForm();
     var instrumentDescription = new InstrumentDescription();
     form.InstrumentDescription = instrumentDescription;
     if (DialogResult.OK == form.ShowDialog())
     {
         instrumentDescription = form.InstrumentDescription;
         var document = new Document();
         SaveInstrumentDescriptionDocument( instrumentDescription, document, BASEBean.eDataState.DS_ADD );
         AddDocumentToInstrumentList( document );
         LoadInstrumentPreview();
     }
 }