示例#1
0
        private void SaveData()
        {
            DeviceSettings ds = new DeviceSettings();
            DeviceSettingsArgs device = new DeviceSettingsArgs();

            device.Exist = true;
            device.Name = textBoxNameDevice.Text;
            device.Object = comboBoxObjects.SelectedIndex;
            device.Port = comboBoxCOMPorts.SelectedIndex;
            device.TimeZone = comboBoxTimeZone.SelectedIndex;
            device.Number = numericUpDownNumber.Value;
            device.Invert = checkBoxInvert.Checked;
            device.Zoom = checkBoxZoom.Checked;
            device.ZoomNumber = numericUpDownZoom.Value;

            ds.SaveDevicesSettings(device, _nameSelectedNode);

            if (MessageBox.Show("Настройки успешно сохранены") == DialogResult.OK)
            {
                buttonSave.Enabled = false;
                buttonCancel.Enabled = false;

                chengedSettingsIndicator = false;
            }
        }
示例#2
0
 /// <summary>
 /// удаление устройства
 /// </summary>
 /// <param name="nameDevice"></param>
 private void DeleteNodeInTree(string nameDevice)
 {
     DeviceSettingsArgs dsa = new DeviceSettingsArgs();
     DeviceSettings ds = new DeviceSettings();
     dsa.Exist = false;
     ds.SaveDevicesSettings(dsa, nameDevice);
     RemoveTree();
     CreatTree();
 }
示例#3
0
        /// <summary>
        /// заполнение полей настроек устройства
        /// </summary>
        /// <param name="nameDevice"></param>
        private void CreateControls(string nameDevice)
        {
            DeviceSettings ds = new DeviceSettings();
            var device = ds.ReturnDevicesSettings(nameDevice);

            textBoxNameDevice.Text = device.Name;

            CreateComboBoxCOMPorts(device.Port);
            CreateComboBoxObjects(device.Object);
            CreateComboBoxTimeZone(device.TimeZone);
            numericUpDownNumber.Value = device.Number;
            checkBoxInvert.Checked = device.Invert;
            checkBoxZoom.Checked = device.Zoom;
            if (device.Zoom)
                groupBoxZoom.Enabled = true;
            numericUpDownZoom.Value = device.ZoomNumber;

            buttonSave.Enabled = false;
            buttonCancel.Enabled = false;
            chengedSettingsIndicator = false;
        }
示例#4
0
 /// <summary>
 /// создания дерева используя данные из настроек
 /// </summary>
 private void CreatTree()
 {
     DeviceSettings ds = new DeviceSettings();
     var list = ds.ReturnAllDevicesSettings(2);
     foreach (var deviceArgs in list)
     {
         if (deviceArgs.Exist)
             AddNodeInTree(deviceArgs.Name);
     }
     treeViewDevice.ExpandAll();
 }
示例#5
0
 /// <summary>
 /// контекстное меню добавления нового устройства
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void contextMenuStripOnNodeObject_Click(object sender, EventArgs e)
 {
     AddNodeInTree();
     DeviceSettingsArgs dsa = new DeviceSettingsArgs();
     DeviceSettings ds = new DeviceSettings();
     dsa.Exist = true;
     ds.SaveDevicesSettings(dsa, "Device" + _countNode.ToString());
 }