Пример #1
0
        /// <summary>
        /// Starts up a TCPServer
        /// </summary>
        private void StartServer()
        {
            Server = new TCPServer(this);


            // let the host connect as a client so he will be treated as one of the judges
            JudgeDiveView hostJudgeView = new JudgeDiveView();

            // set up the the host judge's judging window
            HeadJudgeWindow = new BlankWindow()
            {
                StartPosition = FormStartPosition.CenterScreen,
                Text          = "Bedömning: " + window.CurrentJudge.GetFullName()
            };

            JudgeDivePresenter hostJudgePres = new JudgeDivePresenter(hostJudgeView, window, Server.GetIp().ToString());

            HeadJudgeWindow.Controls.Add(hostJudgeView);

            HeadJudgeWindow.Show();

            // mark head judge as host
            foreach (var jClient in Server.ClientList)
            {
                if (jClient.ClientName == window.CurrentJudge.GetFullName())
                {
                    jClient.IsHost = true;
                }
            }
        }
        private void GotoJudgeContest()
        {
            ServerBrowser serverBrowser = new ServerBrowser();

            if (serverBrowser.ShowDialog() == DialogResult.OK)
            {
                JudgeDiveView      judgeView = new JudgeDiveView();
                JudgeDivePresenter presenter = new JudgeDivePresenter(judgeView, window, serverBrowser.ChosenIp);
                window.ChangePanel(judgeView, (PanelViewControl)View);
            }
        }
        public JudgeDivePresenter(JudgeDiveView view, ProjectMainWindow window, string serverIp)
        {
            ServerIp    = serverIp;
            JudgeName   = window.CurrentJudge.GetFullName();
            View        = view;
            this.window = window;

            View.EventGiveScore          += GiveScore;
            View.EventPointSliderChanged += SetPoints;

            threadClient = new Thread(RunClient);
            threadClient.IsBackground = true;
            threadClient.Start();
        }