private void EditInstrument_Click(object sender, RoutedEventArgs e)
 {
     Row selectedRow = this.MonitorGrid.Rows.SingleOrDefault(r => r.IsSelected);
     if (selectedRow != null)
     {
         VmInstrument vmInstrument = (VmInstrument)selectedRow.Data;
         XamDialogWindow window;
         if(vmInstrument.IsDerivative)
         {
             window = new DerivedInstrumentWindow(EditMode.Modify, vmInstrument);
         }
         else
         {
             window = new InstrumentWindow(EditMode.Modify, vmInstrument);
         }
         App.MainFrameWindow.MainFrame.Children.Add(window);
         window.IsModal = true;
         window.Show();
     }
 }
 private void AddInstrument_Click(object sender, RoutedEventArgs e)
 {
     InstrumentWindow window = new InstrumentWindow(EditMode.AddNew);
     App.MainFrameWindow.MainFrame.Children.Add(window);
     window.IsModal = true;
     window.Show();
 }