public DeviceSettingsForm(GXDeviceManufacturerCollection manufacturers, GXDevice device) { Device = device; Manufacturers = new GXDeviceManufacturerCollection(); InitializeComponent(); AddManufacturers(manufacturers, Manufacturers); SettingsPanel.Dock = PropertyGrid.Dock = PresetList.Dock = CustomDeviceProfile.Dock = DockStyle.Fill; //Device type can not be changed after creation. This is for secure reasons. PresetCB.Enabled = CustomRB.Enabled = PresetList.Enabled = CustomDeviceProfile.Enabled = Device == null; CustomDeviceProfile.Visible = false; if (Device != null) { NameTB.Text = Device.Name; RefreshRateTp.Value = new DateTime(((long)Device.UpdateInterval) * 10000000 + RefreshRateTp.MinDate.Ticks); UpdateResendCnt(Device.ResendCount); UpdateWaitTime(Device.WaitTime); } else { RefreshRateTp.Value = new DateTime(((long)1) * 10000000 + RefreshRateTp.MinDate.Ticks); } //Add disabled actions. m_DisActions = new DisabledAction(Device == null ? DisabledActions.None : Device.DisabledActions); tabControl1.TabPages.Add(m_DisActions.DisabledActionsTB); this.Text = Gurux.DeviceSuite.Properties.Resources.DeviceSettingsTxt; this.GeneralTab.Text = Gurux.DeviceSuite.Properties.Resources.GeneralTxt; //Update helps from the resources. this.helpProvider1.SetHelpString(this.NameTB, Gurux.DeviceSuite.Properties.Resources.DeviceNameHelp); this.helpProvider1.SetHelpString(this.MediaCB, Gurux.DeviceSuite.Properties.Resources.MediaListHelp); this.helpProvider1.SetHelpString(this.RefreshRateTp, Gurux.DeviceSuite.Properties.Resources.RefreshRateHelp); this.helpProvider1.SetHelpString(this.OkBtn, Gurux.DeviceSuite.Properties.Resources.OKHelp); this.helpProvider1.SetHelpString(this.CancelBtn, Gurux.DeviceSuite.Properties.Resources.CancelHelp); }
/// <summary> /// Initializes a new instance of the DeviceListDialog class. /// </summary> /// <param name="resources">The resource manager object.</param> /// <param name="list">The device list object.</param> public GXDeviceListDialog(GXDeviceList list) { m_List = list; InitializeComponent(); CancelBtn.Text = Gurux.DeviceSuite.Properties.Resources.CancelTxt; OKBtn.Text = Gurux.DeviceSuite.Properties.Resources.OKTxt; label1.Text = Gurux.DeviceSuite.Properties.Resources.NameTxt; this.Text = Gurux.DeviceSuite.Properties.Resources.DeviceListSettingsTxt; this.GeneralTab.Text = Gurux.DeviceSuite.Properties.Resources.GeneralTxt; NameTB.Text = list.Name; //Add disabled actions. m_DisActions = new DisabledAction(m_List.DisabledActions); tabControl1.TabPages.Add(m_DisActions.DisabledActionsTB); }
/// <summary> /// Constructor. /// </summary> /// <param name="group"></param> /// <param name="target"></param> public GXDeviceGroupDialog(GXDeviceGroup group, object target) { InitializeComponent(); FindParentGroups(target); Target = group; NameTB.Text = group.Name; this.GeneralTab.Text = Gurux.DeviceSuite.Properties.Resources.GeneralTxt; this.Text = Gurux.DeviceSuite.Properties.Resources.DeviceGroupSettingsTxt; //Update help strings from the resource. this.helpProvider1.SetHelpString(this.NameTB, Gurux.DeviceSuite.Properties.Resources.DeviceGroupNameHelp); this.helpProvider1.SetHelpString(this.btnOK, Gurux.DeviceSuite.Properties.Resources.OKHelp); this.helpProvider1.SetHelpString(this.btnCancel, Gurux.DeviceSuite.Properties.Resources.CancelHelp); //Add disabled actions. m_DisActions = new DisabledAction(Target.DisabledActions); tabControl1.TabPages.Add(m_DisActions.DisabledActionsTB); }
public PropertyGroupDlg(object group) { InitializeComponent(); Target = group; if (Target is Gurux.Device.GXCategory) { NameTB.Text = ((Gurux.Device.GXCategory)Target).Name; //Add disabled actions. m_DisActions = new DisabledAction((Target as GXCategory).DisabledActions); this.Text = Gurux.DeviceSuite.Properties.Resources.CategoryPropertiesTxt; } else { NameTB.Text = (Target as GXTable).Name; //Add disabled actions. m_DisActions = new DisabledAction((Target as GXTable).DisabledActions); this.Text = Gurux.DeviceSuite.Properties.Resources.TablePropertiesTxt; } this.Text = Gurux.DeviceSuite.Properties.Resources.CategorySettingsTxt; this.GeneralTab.Text = Gurux.DeviceSuite.Properties.Resources.GeneralTxt; tabControl1.TabPages.Add(m_DisActions.DisabledActionsTB); }
public ModifyValueDialog(Gurux.Device.GXProperty property, bool editable, bool uiValue) { try { Type type = property.ValueType; m_TmpProperty = property.Clone(); m_UIValue = uiValue; InitializeComponent(); btnCancel.Text = Gurux.DeviceSuite.Properties.Resources.CancelTxt; btnOK.Text = Gurux.DeviceSuite.Properties.Resources.OKTxt; lblValue.Text = Gurux.DeviceSuite.Properties.Resources.ValueTxt; this.GeneralTab.Text = Gurux.DeviceSuite.Properties.Resources.GeneralTxt; this.Text = Gurux.DeviceSuite.Properties.Resources.EditValueTxt + " - " + property.Name; m_Property = property; // Check th eproperty type, i.e. do we use the textbox or dropdown list. m_UseBitMask = m_Property.BitMask; m_UseCombobox = !m_UseBitMask; if (!m_UseBitMask && type == typeof(bool) || property.Values.Count != 0) { m_UseCombobox = true; } //Disable OK Btn if property is not settable. Gurux.Device.AccessMode Mode = property.AccessMode; bool readOnly = (property.Device.Status & Gurux.Device.DeviceStates.Connected) == 0 || (Mode & Gurux.Device.AccessMode.Write) == 0; txtValue.ReadOnly = readOnly; ValueLB.Enabled = cbValue.Enabled = !readOnly; ValueLB.Visible = m_UseBitMask; if (m_UseCombobox) { if (type == typeof(bool)) { cbValue.Items.Add(bool.FalseString); cbValue.Items.Add(bool.TrueString); } else { foreach (object it in m_Property.Values) { cbValue.Items.Add(it.ToString()); } } string str = Convert.ToString(property.GetValue(m_UIValue)); cbValue.SelectedIndex = cbValue.FindStringExact(str); if (m_Property.ForcePresetValues || type == typeof(bool)) { cbValue.DropDownStyle = ComboBoxStyle.DropDownList; } else { cbValue.DropDownStyle = ComboBoxStyle.DropDown; cbValue.Text = Convert.ToString(property.GetValue(m_UIValue)); } } else { if (m_UseBitMask) { txtValue.ReadOnly = true; /* TODO: long val = Convert.ToInt64(m_Property.GetValue(true)); foreach (Gurux.Device.GXValue it in m_Property.LocalizedValueItems) { long tmp = Convert.ToInt64(it.DeviceValue); ListViewItem item = ValueLB.Items.Add(it.UIValue.ToString()); item.Checked = (val & tmp) != 0; item.Tag = tmp; } * */ } //If data type is string show multiline textbox. txtValue.Multiline = type == typeof(string); HexCB.Checked = (m_Property.DisplayType != DisplayTypes.None && type != typeof(string)) || type.IsArray; txtValue.Text = HexCB.Checked ? property.GetValueAsHex(m_UIValue) : Convert.ToString(property.GetValue(m_UIValue)); } // Hide the textbox and show the combo box. cbValue.Visible = m_UseCombobox; ValueLB.Visible = m_UseBitMask; txtValue.Visible = !m_UseCombobox; HexCB.Visible = !m_UseBitMask && !m_UseCombobox;//TODO: && m_Property.IsTypeNumeric; //Add disabled actions. //TODO: if (!m_Property.IsNotify) { m_DisActions = new DisabledAction(property.DisabledActions); tabControl1.TabPages.Add(m_DisActions.DisabledActionsTB); } } catch (Exception Ex) { GXCommon.ShowError(Ex); } }