public void NewDeviceGroup()
 {
     try
     {
         object target = DeviceListTree.SelectedNode.Tag;
         GXDeviceGroupDialog dlg = new GXDeviceGroupDialog(new GXDeviceGroup(), target);
         dlg.ShowDialog(ParentComponent);
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(ParentComponent, ex);
     }
 }
        public void ShowProperties()
        {
            try
            {
                if (DeviceListTree.Focused)
                {
                    object target = DeviceListTree.SelectedNode.Tag;
                    //If device list is selected.
                    if (target is GXDeviceList)
                    {
                        GXDeviceListDialog dlg = new GXDeviceListDialog(target as GXDeviceList);
                        dlg.ShowDialog(ParentComponent);
                    }
                    //If device is selected.
                    else if (target is GXDevice)
                    {
                        DeviceSettingsForm dlg = new DeviceSettingsForm(Manufacturers, target as GXDevice);
                        dlg.ShowDialog(ParentComponent);
                    }
                    //If deviceGroup is selected.
                    else if (target is GXDeviceGroup)
                    {
                        GXDeviceGroup deviceGroup = target as GXDeviceGroup;
                        GXDeviceGroupDialog dlg = new GXDeviceGroupDialog(deviceGroup, deviceGroup.Parent);
                        dlg.ShowDialog(ParentComponent);

                    }
                    //If Property is selected.
                    else if (target is GXProperty)
                    {
                        ModifyValueDialog dlg = new ModifyValueDialog(target as GXProperty, true, true);
                        dlg.ShowDialog(ParentComponent);
                    }
                    //If Category is selected.
                    else if (target is GXCategory)
                    {
                        PropertyGroupDlg dlg = new PropertyGroupDlg(target);
                        dlg.ShowDialog(ParentComponent);
                    }
                    //If Table is selected.
                    else if (target is GXTable)
                    {
                        PropertyGroupDlg dlg = new PropertyGroupDlg(target);
                        dlg.ShowDialog(ParentComponent);
                    }
                    else
                    {
                        throw new Exception("Unknown type: " + target.GetType().ToString());
                    }
                }
                else if (Schedules.Focused)
                {
                    ScheduleOptionsMenu_Click(null, null);
                }
            }
            catch (Exception Ex)
            {
                GXCommon.ShowError(ParentComponent, Ex);
            }
        }