public void ChangeMainEngine(UCIEngine engine) { this.Game.DefaultEngine.Pause(); this.Game.SwapPlayersIfNeeded(); if (this.Game.IsDefaultEngine(engine)) { this.Game.DefaultEngine.Resume(); return; } this.Game.Clock.Stop(); this.Game.PreviousPonderMove = ""; this.Game.DefaultEngine.Close(); this.Game.DefaultEngine = engine; AnalysisUc.ChangeEngine(engine); AnalysisUc.TabText = engine.EngineTitle; if (this.Game.GameMode == App.Model.GameMode.HumanVsEngine) { if (this.Game.CurrentPlayer.IsWhite) { this.Game.Player2.Engine = this.Game.DefaultEngine; } else { this.Game.Player1.Engine = this.Game.DefaultEngine; } ChessBoardUc.SetEvents(); this.Game.GameData.Black1 = this.Game.DefaultEngine.EngineName; this.RefreshGameInfo(); } }
protected void RemoveKibitzer() { AnalysisUc analysisUc = KibitzerManager.RemoveEngine(); if (analysisUc != null) { analysisUc.Close(); } }
public AnalysisUc RemoveEngine() { AnalysisUc tempKibitzer = null; if (kibitzersList != null) { foreach (AnalysisUc kibitzer in kibitzersList) { tempKibitzer = kibitzer; } if (tempKibitzer != null) { RemoveItem(tempKibitzer); } } return(tempKibitzer); }
public bool RemoveEngineByName(string engineName) { if (kibitzersList != null) { AnalysisUc tempKibitzer = null; foreach (AnalysisUc kibitzer in kibitzersList) { if (kibitzer.UCIEngine.EngineName == engineName) { tempKibitzer = kibitzer; } } if (tempKibitzer != null) { RemoveItem(tempKibitzer); } } return(true); }
public void AddKibitzerPanel(AnalysisUc analysisUc) { if (dp.InvokeRequired) { dp.BeginInvoke(new MethodInvoker(delegate() { AddKibitzerPanel(analysisUc); })); } else { analysisUc.TabText = analysisUc.UCIEngine.Id; if (KibitzerManager.KibitzersList.Count == 1) { //analysisUc.Show(ChessBoard.Pane, DockAlignment.Bottom, 0.25); analysisUc.Show(dp, DockState.DockBottom); } else { AnalysisUc parent = KibitzerManager.KibitzersList[0]; analysisUc.Show(parent.Pane, null); } } }
public AnalysisUc RemoveEngine(string guid) { AnalysisUc tempKibitzer = null; if (kibitzersList != null) { foreach (AnalysisUc kibitzer in kibitzersList) { if (kibitzer.KibitzerGuid == guid) { tempKibitzer = kibitzer; break; } } if (tempKibitzer != null) { RemoveItem(tempKibitzer); } } return(tempKibitzer); }
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 }
private void RemoveItem(AnalysisUc kibitzer) { kibitzer.UCIEngine.Close(); kibitzersList.Remove(kibitzer); }