Beispiel #1
0
        public WinForm_Splash(IGameControl game_control, ICommand commands)
            : base(game_control)
        {
            _background_color_material.Diffuse = _background_color;
            _background_window_material.Diffuse = Window.BackgroundColor;

            _commands = commands;
            _game_control = game_control;
            _dm_dialog = new DM_Dialog(_commands);
        }
        private void MainWindow_Load(object sender, EventArgs e)
        {
            ChangeMenuState(chatWindowToolStripMenuItem, false);
            ChangeMenuState(whiteboardWindowToolStripMenuItem, false);

            //try
            //{
            //    DDD_Global.Instance.HostName = System.Configuration.ConfigurationSettings.AppSettings["Hostname"];
            //    DDD_Global.Instance.Port = Int32.Parse(System.Configuration.ConfigurationSettings.AppSettings["Port"]);
            //}
            //catch (Exception)
            //{
            //}
            LoadConfigDocument();

            if (DDD_Global.Instance.HostName == null)
            {
                LoginDialog();
            }
            else
            {
                if (DDD_Global.Instance.Connect(DDD_Global.Instance.HostName, DDD_Global.Instance.Port))
                {
                    ReadSimulationModel(DDD_Global.Instance.HostName);
                    //ReadSimulationModel();
                    SubscribeToEvents();
                    GameFramework.Instance().Run(this, (IGameControl)this);
                    _ControllerThread = new Thread(new ParameterizedThreadStart(Controller_Thread));
                    _ControllerThread.Start(this);
                    _DecisionMakerDialog = new DM_Dialog(_Controller);
                    Authenticate();
                }
                else
                {
                    MessageBox.Show(
                        string.Format("Host ({0}) is unavailable.  If the problem persists, contact your system administrator", DDD_Global.Instance.HostName),
                        "Connect Error");
                    Application.Exit();
                }
            }

            _customAttributesDialog = new CustomAttributesDialog(this);
            //_customAttributesDialog.Show(this);

        }
        private void LoginDialog()
        {
            bool Continue = true;

            _LoginDialog = new ConnectDialog();
            while (Continue)
            {
                _LoginDialog.ShowDialog();
                switch (_LoginDialog.DialogResult)
                {
                    case DialogResult.Cancel:
                        Continue = false;
                        QuitApplication();
                        return;
                    case DialogResult.OK:
                        Continue = false;
                        ReadSimulationModel(DDD_Global.Instance.HostName);
                        //ReadSimulationModel();
                        SubscribeToEvents();
                        GameFramework.Instance().Run(this, (IGameControl)this);
                        _ControllerThread = new Thread(new ParameterizedThreadStart(Controller_Thread));
                        _ControllerThread.Start(this);
                        _DecisionMakerDialog = new DM_Dialog(_Controller);
                        Authenticate();

                        break;
                }
            }
        }