Esempio n. 1
0
        private bool EditPlcConfig(Utils.Operation operation, ConfigClass.PlcSettingSource model)
        {
            using (SettingsPlcFm plcEditFm = new SettingsPlcFm(operation, model))
            {
                if (plcEditFm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    settingsSplashManager.ShowWaitForm();

                    int return_DeviceId = plcEditFm.Return();

                    deviceTree.Nodes.Clear();

                    settingsService = Program.kernel.Get <ISettingsService>();
                    ConfigClass.Instance.ConfigLoad(settingsService);

                    CreateDeviceNodes(deviceTree);

                    deviceTree.ExpandAll();

                    settingsSplashManager.CloseWaitForm();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Esempio n. 2
0
        private bool FindDeviceNameDuplicate(ConfigClass.PlcSettingSource item)
        {
            bool result = false;

            if (ConfigClass.Instance.PlcSettingList != null)
            {
                var source = (ConfigClass.Instance.PlcSettingList).FirstOrDefault(s => s.Name == item.Name);

                if (source != null)
                {
                    result = (source.DeviceId != item.DeviceId) ? true : false;
                }
            }

            return(result);
        }
Esempio n. 3
0
        public SettingsPlcEditFm(Utils.Operation operation, ConfigClass.PlcSettingSource source)
        {
            InitializeComponent();

            _operation = operation;

            plcSettingsBS.DataSource = Item = source;

            nameTBox.DataBindings.Add("EditValue", plcSettingsBS, "Name");
            ipTBox.DataBindings.Add("EditValue", plcSettingsBS, "Ip");
            rackTBox.DataBindings.Add("EditValue", plcSettingsBS, "Rack");
            slotTBox.DataBindings.Add("EditValue", plcSettingsBS, "Slot");

            cpuTypeEdit.Properties.DataSource  = Enum.GetValues(typeof(S7.Net.CpuType));
            cpuTypeEdit.Properties.ValueMember = "Column";
            cpuTypeEdit.DataBindings.Add("EditValue", plcSettingsBS, "CpuType");
        }