Inheritance: ATMLForm, IAtmlActionable
コード例 #1
0
 public void ProcessCommand(string command)
 {
     if (command.Contains("Add I"))
     {
         var form = new InstrumentForm();
         form.Show();
     }
 }
        private void btnEditObject_Click(object sender, EventArgs e)
        {
            TestStationDescriptionInstrument tsi =
                testStationDescriptionInstrumentControl1.TestStationDescriptionInstrument;

            if (tsi != null && tsi.Item != null)
            {
                var docRef = tsi.Item as DocumentReference;
                if (docRef != null)
                {
                    Document document = DocumentManager.GetDocument(docRef.uuid);
                    if (document == null)
                    {
                        MessageBox.Show(string.Format("Test Station Instrument \"{0}\" does not exist in the document database.", docRef.uuid));
                    }
                    else
                    {
                        InstrumentDescription instrument =
                            InstrumentDescription.Deserialize(Encoding.UTF8.GetString(document.DocumentContent));
                        var form = new InstrumentForm();
                        form.InstrumentDescription = instrument;
                        //form.TopMost = true;
                        Visible = false;
                        form.Closed += delegate
                        {
                            if (DialogResult.OK == form.DialogResult)
                            {
                                instrument = form.InstrumentDescription;
                                document.DocumentContent = Encoding.UTF8.GetBytes(instrument.Serialize());
                                PersistanceController.Save(document);
                            }
                            Visible = true;
                        };
                        form.Show(this);
                    }
                }
            }
        }
コード例 #3
0
 /*
  * 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();
         }
     }
 }
コード例 #4
0
 /*
  * 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();
     }
 }