示例#1
0
        public Form1()
        {
            string errorMsg = string.Empty;
            int    seats    = -1;

            if (Environment.GetCommandLineArgs().Length > 1)
            {
                ServerOptions.ReadFile();
                String portString = Environment.GetCommandLineArgs()[1];
                ServerOptions.PortNumber = Int32.Parse(portString);
                ServerOptions.WriteFile();
            }
            else
            {
                ServerConfigDialog d = new ServerConfigDialog();
                d.DialogMessage = "Configure the server port:";
                if (d.ShowDialog(this) == DialogResult.Cancel)
                {
                    MessageBox.Show(this, "Closing DDD", "User Requested Shutdown", MessageBoxButtons.OK);
                    this.Close();
                    return;
                }
                while (!SimCoreServer.SimCoreServer.CheckNetworkSettings())
                {
                    d.DialogMessage = "The specified port is not available.\nPlease shutdown any other application\nusing the port or choose a different one.";
                    d.ShowDialog(this);
                }
            }
            InitializeComponent();
            server = new SimCoreServer.SimCoreServer();
            LoadServerOptions();



            eventClient = new SimulationEventDistributorClient();
            SimCoreServer.SimCoreServer.simEngine.simCore.distributor.RegisterClient(ref eventClient);
            eventClient.Subscribe("ServerState");
            eventClient.Subscribe("PauseScenario");
            eventClient.Subscribe("ResumeScenario");
            serverState = "SCENARIO_STOPPED";

            comboBoxReplaySpeed.SelectedIndex     = 4;
            comboBoxReplaySpeed.Enabled           = false;
            toolStripStatusLabelServerStatus.Text = "Server: STOPPED";
            toolStripStatusLabelSimStatus.Text    = "Simulation: STOPPED";



            DMInfo = new DMInfoManager(this);


            UpdateScenarioNameLabel();
            updateTimer.Start();
            UpdateVoiceServerButton();
        }
示例#2
0
文件: Form1.cs 项目: wshanshan/DDD
        public Form1()
        {
            
            string errorMsg = string.Empty;
            int seats = -1;

            if (Environment.GetCommandLineArgs().Length > 1)
            {
                ServerOptions.ReadFile();
                String portString = Environment.GetCommandLineArgs()[1];
                ServerOptions.PortNumber = Int32.Parse(portString);
                ServerOptions.WriteFile();
            }
            else
            {
                ServerConfigDialog d = new ServerConfigDialog();
                d.DialogMessage = "Configure the server port:";
                if (d.ShowDialog(this) == DialogResult.Cancel)
                {
                    MessageBox.Show(this, "Closing DDD", "User Requested Shutdown", MessageBoxButtons.OK);
                    this.Close();
                    return;
                }
                while (!SimCoreServer.SimCoreServer.CheckNetworkSettings())
                {
                    d.DialogMessage = "The specified port is not available.\nPlease shutdown any other application\nusing the port or choose a different one.";
                    d.ShowDialog(this);
                }
            }
            InitializeComponent();
            server = new SimCoreServer.SimCoreServer();
            LoadServerOptions();
            
                    
  
            eventClient = new SimulationEventDistributorClient();
            SimCoreServer.SimCoreServer.simEngine.simCore.distributor.RegisterClient(ref eventClient);
            eventClient.Subscribe("ServerState");
            eventClient.Subscribe("PauseScenario");
            eventClient.Subscribe("ResumeScenario");
            serverState = "SCENARIO_STOPPED";

            comboBoxReplaySpeed.SelectedIndex = 4;
            comboBoxReplaySpeed.Enabled = false;
            toolStripStatusLabelServerStatus.Text = "Server: STOPPED";
            toolStripStatusLabelSimStatus.Text = "Simulation: STOPPED";



            DMInfo = new DMInfoManager(this);

            
            UpdateScenarioNameLabel();
            updateTimer.Start();
            UpdateVoiceServerButton();
        }