Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 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());
 }