diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 4e99429..362dc3b 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -14,6 +14,13 @@ namespace TFT_Overlay /// public partial class MainWindow : Window { + [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto, ExactSpelling = true)] + public static extern IntPtr GetForegroundWindow(); + [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetForegroundWindow")] + public static extern bool SetForegroundWindow(IntPtr hWnd); + public IntPtr myHandle; + private System.Timers.Timer tTop; + private readonly Cursor LoLNormal = CustomCursor.FromByteArray(Properties.Resources.LoLNormal); private readonly Cursor LoLPointer = CustomCursor.FromByteArray(Properties.Resources.LoLPointer); private readonly Cursor LoLHover = CustomCursor.FromByteArray(Properties.Resources.LoLHover); @@ -37,6 +44,17 @@ public MainWindow() InitializeComponent(); LoadStringResource(Settings.Default.Language); this.Cursor = LoLNormal; + + this.WindowState = System.Windows.WindowState.Normal; + this.ShowInTaskbar = false; + this.Topmost = OnTop; + myHandle = new System.Windows.Interop.WindowInteropHelper(this).Handle; + //... + tTop = new System.Timers.Timer(15000);//set Timer + tTop.Elapsed += new System.Timers.ElapsedEventHandler(theout); + tTop.AutoReset = true; + tTop.Enabled = true; + CanDrag = !Settings.Default.Lock; if (Settings.Default.AutoDim == true) @@ -50,6 +68,34 @@ public MainWindow() } } + public void theout(object source, System.Timers.ElapsedEventArgs e) + { + if (OnTop) + { + if (myHandle != GetForegroundWindow()) //let the win always on focus + { + SetForegroundWindow(myHandle); + } + try + { + this.Dispatcher.Invoke( + new Action( + delegate + { + this.Topmost = false; + this.Topmost = true; + + } + ) + ); + } + catch (System.Threading.Tasks.TaskCanceledException errMsg) + { + tTop.Stop(); + } + } + } + private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Settings.Default.Save(); @@ -62,12 +108,12 @@ private void MenuItem_Click(object sender, RoutedEventArgs e) private void MenuItem_Click_About(object sender, RoutedEventArgs e) { - MessageBox.Show("TFT Information Overlay V" + CurrentVersion + " by J2GKaze/Jinsoku#4019\n\nDM me on Discord if you have any questions\n\nLast Updated: July 23rd, 2019 @ 5:45PM PST", "About"); + MessageBox.Show("TFT Information Overlay V" + CurrentVersion + " by J2GKaze/Jinsoku#4019\n\nDM me on Discord if you have any questions\n\nLast Updated: July 24th, 2019 @ 4:25 PST", "About"); } private void MenuItem_Click_Credits(object sender, RoutedEventArgs e) { - MessageBox.Show("Big thanks to:\nChaoticoz: Lock Window, Always on Top, and Mouseover\nAsemco/Asemco#7390: Adding Origins and Classes\nAthenyx#9406: Designs\nTenebris: Auto-Updater\nOBJECT#3031: Items/Origins/Classes Strings Base\nJpgdev: Readme format\nKbphan\nEerilai\nꙅꙅɘᴎTqAbɘbᴎɘld#1175: Window Position/Size Saving, CPU Threading Fix\nNarcolic#6374: Item Builder\n\nShoutout to:\nAlexander321#7153 for the Discord Nitro Gift!\nAnonymous for Reddit Gold\nu/test01011 for Reddit Gold\n\nmac#0001 & bNatural#0001(Feel free to bug these 2 on Discord) ;)\nShamish#4895 (Make sure you bug this guy a lot)\nDekinosai#7053 (Buy this man tons of drinks)", "Credits"); + MessageBox.Show("Big thanks to:\nChaoticoz: Lock Window, Always on Top, and Mouseover\nAsemco/Asemco#7390: Adding Origins and Classes\nAthenyx#9406: Designs\nTenebris: Auto-Updater\nOBJECT#3031: Items/Origins/Classes Strings Base\nJpgdev: Readme format\nKbphan\nEerilai\nꙅꙅɘᴎTqAbɘbᴎɘld#1175: Window Position/Size Saving, CPU Threading Fix\nNarcolic#6374: Item Builder\nIzoyo: Fullscreen\n\nShoutout to:\nAlexander321#7153 for the Discord Nitro Gift!\nAnonymous for Reddit Gold\nu/test01011 for Reddit Gold\n\nmac#0001 & bNatural#0001(Feel free to bug these 2 on Discord) ;)\nShamish#4895 (Make sure you bug this guy a lot)\nDekinosai#7053 (Buy this man tons of drinks)", "Credits"); } private void MenuItem_Click_Lock(object sender, RoutedEventArgs e) diff --git a/README.md b/README.md index 812cb27..145b55a 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,12 @@ - [Click Here for instructions](https://github.com/Just2good/TFT-Overlay/blob/master/Localization.md) ## Version History +- **7.24.2019** + -[2.0.1](https://github.com/Just2good/TFT-Overlay/releases/tag/V2.0.1) + - Fullscreen by Izoyo + - Updated for 9.14B + - IT & FR Updated + - **7.23.2019** - [1.9.9](https://github.com/Just2good/TFT-Overlay/releases/tag/V1.9.9) - Added Player Damage Chart diff --git a/Utilities/Version.cs b/Utilities/Version.cs index 843967b..bb43c3f 100644 --- a/Utilities/Version.cs +++ b/Utilities/Version.cs @@ -2,6 +2,6 @@ { class Version { - public static string version = "1.9.9"; + public static string version = "2.0.1"; } } diff --git a/Version.cs b/Version.cs index 56ddf6b..c682322 100644 --- a/Version.cs +++ b/Version.cs @@ -2,6 +2,6 @@ { class Version { - public static string version = "1.9.9"; + public static string version = "2.0.1"; } }