internal static void ShowPlayerInfo(Models.Player player) { if (frmMain.Instance.InvokeRequired) { frmMain.Instance.BeginInvoke(new Action <Models.Player>(ShowPlayerInfo), player); } else { if (PlayerInfoForm != null) { PlayerInfoForm.Dispose(); } PlayerInfoForm = new frmPlayerInfo(player); PlayerInfoForm.Show(); } }
public frmPlayerInfo(Models.Player player) { if (Instance != null) { Instance.Close(); Instance = null; } Instance = this; int baseWidth = 154; int baseHeight = 113; int baseX = 252; int baseY = 594; double xPercentage = (double)baseX / 1280 * 100; double yPercentage = (double)baseY / 720 * 100; double widthPercentage = (double)baseWidth / 1280 * 100; double heightPercentage = (double)baseHeight / 720 * 100; double yScale = Program.SC2WindowRect.Height / 720; double xScale = Program.SC2WindowRect.Width / 1280; InitializeComponent(); Animator = new FormAnimator(this, FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Right, 1000); this.Left = (int)(Program.SC2WindowRect.Left + ((double)Program.SC2WindowRect.Width / 100 * xPercentage)); this.Top = (int)(Program.SC2WindowRect.Top + ((double)Program.SC2WindowRect.Height / 100 * yPercentage)); this.Height = (int)((double)Program.SC2WindowRect.Height / 100 * heightPercentage); this.Width = (int)((double)Program.SC2WindowRect.Width / 100 * widthPercentage); _player = player; if (Configuration.Instance.OpponentInfoOverlayTimeout > 0) { tmrClose.Interval = Configuration.Instance.OpponentInfoOverlayTimeout * 1000; tmrClose.Start(); } }