Automatak.Simulator.DNP3.ChannelNode.CreateMaster C# (CSharp) Method

CreateMaster() private method

private CreateMaster ( ISimulatorNodeCallbacks callbacks ) : ISimulatorNode
callbacks ISimulatorNodeCallbacks
return ISimulatorNode
        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;
                }
            }
        }