public override void Connect_To_Database(StorageConfig config) { myConfig = config as PLCConfig; _plcConnection = new PLCConnection(myConfig.Configuration); _plcConnection.AutoConnect = true; _plcConnection.Connect(); }
public override void Connect_To_Database(StorageConfig config) { myConfig = config as PLCConfig; _plcConnection = new PLCConnection(myConfig.Configuration); _plcConnection.AutoConnect = true; _plcConnection.Connect(); Logging.LogTextToLog4Net("Connect_To_Database() => \"" + _plcConnection.Name + "\" => Connect..."); }
private void cmdAddPLCStorage_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Be carefull, writing to the PLC as a Storrage is BETA and not much tested yet!"); string val = "Storage_" + (grdStorages.Items.Count + 1); if (DotNetSiemensPLCToolBoxLibrary.General.InputBox.Show("Storage-Name", "Name of the Storage", ref val) == DialogResult.OK) { foreach (var tmp in ProtokollerConfiguration.ActualConfigInstance.Storages) { if (tmp.Name.ToLower().Trim() == val.ToLower().Trim()) { MessageBox.Show("A Storage with this Name already Exists!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } } PLCConnectionConfiguration myIntConfig = new PLCConnectionConfiguration(val.Trim(), LibNodaveConnectionConfigurationType.ObjectSavedConfiguration); myIntConfig = DotNetSiemensPLCToolBoxLibrary.Communication.Configuration.ShowConfiguration(myIntConfig); if (myIntConfig != null) { var storage = new PLCConfig() {Name = val}; storage.Configuration = myIntConfig; ProtokollerConfiguration.ActualConfigInstance.Storages.Add(storage); } } }