Пример #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            DevUc      = new DevUc();
            DevUc.Game = this.Game;

            if (this.Game != null)
            {
                this.Game.AfterPaste             += new EventHandler(Game_AfterPaste);
                this.Game.BeforeNewGame          += new EventHandler <NewGameEventArgs>(Game_BeforeNewGame);
                this.Game.AfterNewGame           += new EventHandler(Game_AfterNewGame);
                this.Game.SaveDocking            += new EventHandler(Game_SaveDocking);
                this.Game.CreateDocking          += new EventHandler(Game_CreateDocking);
                this.Game.BeforeFinish           += new EventHandler(Game_BeforeFinish);
                this.Game.AfterFinish            += new EventHandler(Game_AfterFinish);
                this.Game.Book.BookLoaded        += new EventHandler(Book_BookLoaded);
                this.Game.Book.BookClosed        += new EventHandler(Book_BookClosed);
                this.Game.BeforeSetFen           += new EventHandler(Game_BeforeSetFen);
                this.Game.AfterSetFen            += new EventHandler(Game_AfterSetFen);
                this.Game.AfterSwapPlayers       += new EventHandler(Game_AfterSwapPlayers);
                this.Game.AfterAddMove           += new EventHandler(Game_AfterAddMove);
                this.Game.BeforeMoveTo           += new EventHandler <MoveToEventArgs>(Game_BeforeMoveTo);
                this.Game.AfterMoveTo            += new EventHandler <MoveToEventArgs>(Game_AfterMoveTo);
                this.Game.AfterSendMovesToEngine += new Game.AfterSendMovesToEngineEventHandler(Game_AfterSendMovesToEngine);
                this.Game.BeforeLoadGame         += new EventHandler(Game_BeforeLoadGame);
                this.Game.AfterLoadGame          += new EventHandler(Game_AfterLoadGame);
            }

            Ap.Eco.EcoReceived += new EventHandler <EcoMoveEventArgs>(Eco_EcoReceived);
        }
        protected override void LoadPanels()
        {
            #region Load from xml

            string fileName = Ap.FileDock(base.Game.GameMode);
            if (LoadFromFile(fileName))
            {
                return;
            }

            string defaultFileName = Ap.FileDockDefault(base.Game.GameMode);
            LoadFromFile(defaultFileName);

            #endregion

            #region Load Manually

            ChessBoard.Show(dp, DockState.Document);

            if (Config.IsDev)
            {
                DevUc.Show(ChessBoard.Pane, null);
            }
            ClockUc.Show(dp, DockState.DockRight);

            NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85);

            GameInfoUc.Visible     = Ap.Options.ShowGameInfo;
            CapturePieceUc.Visible = Ap.Options.ShowCapturedPieces;

            ChessBoard.TabText     = "Board";
            ChessBoard.HideOnClose = true;

            if (Config.IsDev)
            {
                DevUc.TabText     = "DevUc";
                DevUc.HideOnClose = true;
            }

            DockContent chatParent = NotationUc;

            switch (base.Game.GameMode)
            {
            case GameMode.None:
                break;

            case GameMode.Kibitzer:
                NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85);
                ScoringUc.Show(NotationUc.Pane, null);
                BookUc.Show(NotationUc.Pane, null);

                chatParent = NotationUc;
                break;

            case GameMode.OnlineHumanVsHuman:
                NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85);
                chatParent = NotationUc;
                break;

            case GameMode.OnlineHumanVsEngine:
            case GameMode.OnlineEngineVsEngine:
                NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85);
                AnalysisUc1.Show(NotationUc.Pane, DockAlignment.Bottom, 0.60);

                chatParent = AnalysisUc1;
                break;
            }

            ChatUc.Show(chatParent.Pane, DockAlignment.Bottom, 0.50);
            AudienceUc.Show(ChatUc.Pane, null);

            #endregion
        }
        protected override void LoadPanels()
        {
            #region Load from xml

            string fileName = Ap.FileDock(base.Game.GameMode);
            if (LoadFromFile(fileName))
            {
                return;
            }

            string defaultFileName = Ap.FileDockDefault(base.Game.GameMode);
            if (LoadFromFile(defaultFileName) && base.Game.GameMode == GameMode.EngineVsEngine)
            {
                return;
            }
            #endregion

            #region Load Manually

            ChessBoard.Show(dp, DockState.Document);

            if (Config.IsDev)
            {
                DevUc.Show(ChessBoard.Pane, null);
            }

            ClockUc.Show(dp, DockState.DockRight);

            GameInfoUc.Visible                    = Ap.Options.ShowGameInfo;
            CapturePieceUc.Visible                = Ap.Options.ShowCapturedPieces;
            gameInfoToolStripMenuItem.Checked     = Ap.Options.ShowGameInfo;
            capturePieceToolStripMenuItem.Checked = Ap.Options.ShowCapturedPieces;

            if (base.Game.GameMode == GameMode.EngineVsEngine)
            {
                //NotationUc.Show(ChessBoard.Pane, DockAlignment.Bottom, 0.70);
                NotationUc.Show(dp, DockState.DockBottom);
            }
            else
            {
                NotationUc.Show(ClockUc.Pane, DockAlignment.Bottom, 0.85);
                ScoringUc.Show(NotationUc.Pane, null);
                BookUc.Show(NotationUc.Pane, null);
            }

            switch (base.Game.GameMode)
            {
            case GameMode.None:
                break;

            case GameMode.HumanVsHuman:
                break;

            case GameMode.HumanVsEngine:
                AnalysisUc.Show(NotationUc.Pane, DockAlignment.Bottom, 0.40);
                break;

            case GameMode.EngineVsEngine:
                base.AnalysisUc1.SetEngine(base.Game.Player1.Engine);
                AnalysisUc1.Show(ClockUc.Pane, DockAlignment.Bottom, 0.40);

                base.AnalysisUc2.SetEngine(base.Game.Player2.Engine);
                AnalysisUc2.Show(AnalysisUc1.Pane, DockAlignment.Bottom, 0.45);
                break;
            }

            #endregion
        }