ISimulatorNode CreateMaster(ISimulatorNodeCallbacks callbacks) { using (var dialog = new Components.MasterDialog()) { dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { var cache = new MeasurementCache(); var masterConfig = dialog.Configuration; var alias = dialog.SelectedAlias; var master = channel.AddMaster(alias, cache, DefaultMasterApplication.Instance, masterConfig); if (master == null) { return(null); } else { master.Enable(); return(new MasterNode(cache, master, callbacks, alias)); } } else { return(null); } } }
ISimulatorNode CreateOutstation(ISimulatorNodeCallbacks callbacks, IOutstationModule module) { using (var dialog = new Components.OutstationDialog(config, module)) { if (dialog.ShowDialog() == DialogResult.OK) { var outstationConfig = dialog.Configuration; var alias = dialog.SelectedAlias; var factory = module.CreateFactory(); var outstation = channel.AddOutstation(alias, factory.CommandHandler, factory.Application, outstationConfig); if (outstation == null) { return(null); } else { var instance = factory.CreateInstance(outstation, alias, outstationConfig); outstation.Enable(); if (instance.ShowFormOnCreation) { instance.ShowForm(); } return(new OutstationNode(outstation, instance, callbacks)); } } else { return(null); } } }
ISimulatorNode CreateOutstation(ISimulatorNodeCallbacks callbacks) { using (var dialog = new Components.OutstationDialog(config)) { dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { var outstationConfig = dialog.Configuration; var alias = dialog.SelectedAlias; var cache = new MeasurementCache(outstationConfig.databaseTemplate); var handler = new ProxyCommandHandler(); var application = new EventedOutstationApplication(); var outstation = channel.AddOutstation(alias, handler, application, outstationConfig); if (outstation == null) { return(null); } else { outstation.Enable(); return(new OutstationNode(cache, handler, application, config, outstation, callbacks, alias)); } } else { return(null); } } }
public OutstationNode(IOutstation outstation, IOutstationInstance instance, ISimulatorNodeCallbacks callbacks) { this.outstation = outstation; this.instance = instance; this.callbacks = callbacks; this.openAction = new NodeAction("Open", () => OpenForm()); this.callbacks.ChangeImage(IconIndex.Outstation); }
public MasterNode(MeasurementCache cache, IMaster master, ISimulatorNodeCallbacks callbacks, string alias) { this.cache = cache; this.master = master; this.callbacks = callbacks; this.alias = alias; this.callbacks.ChangeImage(IconIndex.Master); this.openAction = new NodeAction("Open", () => OpenForm()); }
void ISimulatorNodeCallbacks.ChangeImage(int index) { if (control.InvokeRequired) { ISimulatorNodeCallbacks temp = this; control.BeginInvoke(new Action(() => { temp.ChangeImage(index); })); } else { node.ImageIndex = index; node.SelectedImageIndex = index; } }
void ISimulatorNodeCallbacks.ChangeState(NodeState state) { if (control.InvokeRequired) { ISimulatorNodeCallbacks temp = this; control.BeginInvoke(new Action(() => { temp.ChangeState(state); })); } else { node.ForeColor = GetForeColor(state); node.BackColor = GetBackColor(state); } }
public ChannelNode(IDNP3Config config, IChannel channel, ISimulatorNodeCallbacks callbacks, string alias) { this.config = config; this.channel = channel; this.callbacks = callbacks; this.alias = alias; this.callbacks.ChangeImage(IconIndex.Channel); this.masterFactory = new ActionNodeFactory("Add Master", cb => CreateMaster(cb)); this.outstationFactory = new ActionNodeFactory("Add Outstation", cb => CreateOutstation(cb)); this.channel.AddStateListener(state => callbacks.ChangeState(GetNodeState(state))); }
public OutstationNode(MeasurementCache cache, ProxyCommandHandler handler, EventedOutstationApplication application, IDNP3Config config, IOutstation outstation, ISimulatorNodeCallbacks callbacks, string alias) { this.cache = cache; this.handler = handler; this.application = application; this.config = config; this.outstation = outstation; this.callbacks = callbacks; this.alias = alias; this.callbacks.ChangeImage(IconIndex.Outstation); this.openAction = new NodeAction("Open", () => OpenForm()); }
ISimulatorNode CreateOutstation(ISimulatorNodeCallbacks callbacks) { using (var dialogModules = new Components.OutstationModuleDialog(config.OutstationModules)) { if (dialogModules.ShowDialog() == DialogResult.OK) { return(CreateOutstation(callbacks, dialogModules.SelectedModule)); } else { return(null); } } }
ISimulatorNode ISimulatorPlugin.Create(ISimulatorNodeCallbacks callbacks) { using (var dialog = new Components.ChannelDialog()) { dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { var channel = dialog.ChannelAction.Invoke(manager); return(new ChannelNode(config, channel, callbacks, dialog.SelectedAlias)); } else { return(null); } } }
ISimulatorNode ISimulatorPlugin.Create(ISimulatorNodeCallbacks callbacks) { using (var dialog = new Components.ChannelDialog()) { dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { var channel = dialog.ChannelAction.Invoke(manager); return new ChannelNode(config, channel, callbacks, dialog.SelectedAlias); } else { return null; } } }
ISimulatorNode CreateMaster(ISimulatorNodeCallbacks callbacks) { using (var dialog = new Components.MasterDialog()) { dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { var cache = new MeasurementCache(); var masterConfig = dialog.Configuration; var alias = dialog.SelectedAlias; var master = channel.AddMaster(alias, cache, DefaultMasterApplication.Instance, masterConfig); if (master == null) { return null; } else { master.Enable(); return new MasterNode(cache, master, callbacks, alias); } } else { return null; } } }
ISimulatorNode CreateOutstation(ISimulatorNodeCallbacks callbacks) { using (var dialogModules = new Components.OutstationModuleDialog(config.OutstationModules)) { if (dialogModules.ShowDialog() == DialogResult.OK) { return CreateOutstation(callbacks, dialogModules.SelectedModule); } else { return null; } } }
ISimulatorNode CreateOutstation(ISimulatorNodeCallbacks callbacks, IOutstationModule module) { using (var dialog = new Components.OutstationDialog(config, module)) { if (dialog.ShowDialog() == DialogResult.OK) { var outstationConfig = dialog.Configuration; var alias = dialog.SelectedAlias; var factory = module.CreateFactory(); var outstation = channel.AddOutstation(alias, factory.CommandHandler, factory.Application, outstationConfig); if (outstation == null) { return null; } else { var instance = factory.CreateInstance(outstation, alias, outstationConfig); outstation.Enable(); if (instance.ShowFormOnCreation) { instance.ShowForm(); } return new OutstationNode(outstation, instance, callbacks); } } else { return null; } } }
ISimulatorNode ISimulatorNodeFactory.Create(ISimulatorNodeCallbacks callbacks) { return(factory.Invoke(callbacks)); }
ISimulatorNode ISimulatorNodeFactory.Create(ISimulatorNodeCallbacks callbacks) { return factory.Invoke(callbacks); }