private void OnEditDestination(object sender, CommandEventArgs e)
        {
            if (Grid.SelectedRows != null && Grid.SelectedRows.Count == 1)
            {
                try
                {
                    InstanceState dataItem        = (InstanceState)(Grid.SelectedRows[0].Cells[0].Tag as GridDataItem).DataItem;
                    Guid          currentObjectId = dataItem.PartialMonitoringObjectId;
                    if (currentObjectId == Guid.Empty && dataItem.ManagedEntityId != Guid.Empty)
                    {
                        currentObjectId = dataItem.ManagedEntityId;
                    }
                    if (currentObjectId == Guid.Empty)
                    {
                        currentObjectId = dataItem.GetPartialMonitoringObject(ManagementGroup).Id;
                    }
                    using (NewDestinationDialog newDestinationDialog = new NewDestinationDialog(ManagementGroup, currentObjectId))
                    {
                        newDestinationDialog.ShowDialog();
                    }

                    // emulate Refresh command
                    OnRefreshCommand(sender, e);
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"In {System.Reflection.MethodBase.GetCurrentMethod().Name} {ex.GetType().Name} said {ex.Message} at {ex.StackTrace}");
                }
            }
        }
 private void OnNewDestination(object sender, CommandEventArgs e)
 {
     using (NewDestinationDialog newDestinationDialog = new NewDestinationDialog(ManagementGroup, Guid.Empty))
     {
         newDestinationDialog.ShowDialog();
     }
     OnRefreshCommand(this, e);
 }