public void ShowLagWindow(PlayWindow parent) { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(new Action(() => { ShowLagWindow(parent); })); return; } //double pwidth = 0; //double pheight = 0; //double pleft = 0; //double ptop = 0; //parent.Dispatcher.Invoke(new Action(() => //{ // pwidth = parent.Width; // pheight = parent.Height; // pleft = parent.Left; // ptop = parent.Top; //})); WindowInteropHelper helper = new WindowInteropHelper(this); helper.Owner = parent.Handle; RECT size; GetWindowRect(new HandleRef(this, parent.Handle), out size); //this.Owner = parent; this.Show(); this.Left = ((size.Left + (size.Right - size.Left) / 2d)) - (this.ActualWidth / 2); this.Top = ((size.Top + (size.Bottom - size.Top) / 2d)) - (this.ActualHeight / 2); }
internal void Start() { // Reset the InvertedTable flags if they were set and they are not used if (!Program.GameSettings.UseTwoSidedTable) foreach (var player in Play.Player.AllExceptGlobal) player.InvertedTable = false; // At start the global items belong to the player with the lowest id if (Player.GlobalPlayer != null) { var host = Player.AllExceptGlobal.OrderBy(p => p.Id).First(); foreach (var group in Player.GlobalPlayer.Groups) group.Controller = host; } var launcherWnd = Application.Current.MainWindow; var playWnd = new Octgn.Play.PlayWindow(); Application.Current.MainWindow = playWnd; launcherWnd.Hide(); playWnd.Show(); }
internal static void StartGame() { // Reset the InvertedTable flags if they were set and they are not used if (!Program.GameSettings.UseTwoSidedTable) foreach (Player player in Player.AllExceptGlobal) player.InvertedTable = false; // At start the global items belong to the player with the lowest id if (Player.GlobalPlayer != null) { Player host = Player.AllExceptGlobal.OrderBy(p => p.Id).First(); foreach (Octgn.Play.Group group in Player.GlobalPlayer.Groups) group.Controller = host; } if (Program.PlayWindow != null) return; Program.Client.Rpc.Start(); Program.PlayWindow = new PlayWindow(Program.Game.IsLocal); Program.PlayWindow.Show(); if(Program.PreGameLobbyWindow != null) Program.PreGameLobbyWindow.Close(); }