コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        public OutstationForm(IOutstation outstation, EventedOutstationApplication application, MeasurementCache cache, ProxyCommandHandler proxy, String alias)
        {
            InitializeComponent();

            this.outstation  = outstation;
            this.application = application;
            this.cache       = cache;
            this.proxy       = proxy;

            this.database = new MultiplexedDatabase(cache, outstation.GetDatabase());

            this.Text = String.Format("DNP3 Outstation ({0})", alias);
            this.comboBoxTypes.DataSource = System.Enum.GetValues(typeof(MeasType));

            this.commandHandlerControl1.Configure(proxy, database);

            this.comboBoxColdRestartMode.DataSource = System.Enum.GetValues(typeof(RestartMode));

            this.application.ColdRestart += application_ColdRestart;
            this.application.TimeWrite   += application_TimeWrite;

            this.CheckState();
        }