private void Initializer(SettingObject setting) { Name = setting.Name; InitializeComponent(); OverlayName.Text = setting.Name; overlayGlobalHotkeyType.Items.Add(ShortcutModeNone); overlayGlobalHotkeyType.Items.Add(ShortcutModeHide); overlayGlobalHotkeyType.Items.Add(ShortcutModeClickthru); overlayGlobalHotkeyType.Items.Add(ShortcutModeToggleLock); overlayGlobalHotkeyType.Items.Add(ShortcutModeTakeScreenshot); OverlayWidth.ValueChanged += SaveSetting; OverlayHeight.ValueChanged += SaveSetting; OverlayX.ValueChanged += SaveSetting; OverlayY.ValueChanged += SaveSetting; OverlayNameChangeButton.Click += SaveSetting; OverlayLock.CheckedChanged += SaveSetting; OverlayClickthru.CheckedChanged += SaveSetting; OverlayShow.CheckedChanged += SaveSetting; OverlayFramerate.ValueChanged += SaveSetting; SiteURL.TextChanged += SaveSetting; overlayGlobalHotkeyType.SelectedIndexChanged += SaveSetting; OverlayEnableBeforeLogLineRead.CheckedChanged += SaveSetting; OverlayGlobalHotkey.CheckedChanged += SaveSetting; SiteURL.Text = setting.Url; Overlay = new OverlayForm(setting.Url) { Framerate = setting.Framerate, Name = setting.Name, Text = setting.Name, ShowInTaskbar = false }; if (!DesignMode) { LanguageLoader.LanguagePatch(this); } Overlay.LocationChanged += Overlay_LocationChanged; Overlay.SizeChanged += Overlay_SizeChanged; Overlay.Show(); Overlay.Location = new Point(setting.Left, setting.Top); Overlay.Size = new Size(setting.Width, setting.Height); OverlayClickthru.Checked = setting.Clickthru; OverlayGlobalHotkey.Checked = setting.UseGlobalHotkey; OverlayLock.Checked = setting.Locked; OverlayEnableBeforeLogLineRead.Checked = setting.BeforeLogLineRead; new Thread((ThreadStart) delegate { try { while (!Process.GetCurrentProcess().HasExited) { if (SettingManager.GlobalSetting.AutoHide) { var l = SettingManager.GlobalSetting.DetectProcessName.Split(','); for (var i = 0; i < l.Length; i++) { l[i] = l[i].ToLower().Trim(); } try { var hnd = NativeMethods.GetForegroundWindow(); NativeMethods.GetWindowThreadProcessId(hnd, out uint pid); if (!OverlayShow.Checked) { Overlay.Hide(); } else { Overlay.Visible = l.Contains(System.IO.Path.GetFileName(Process.GetProcessById((int)pid).MainModule.FileName).ToLower()); } } catch { // caution: if you running STEAM GAME with VAC, comming here } } else { Overlay.Visible = OverlayShow.Checked; } Thread.Sleep(1000); } } catch { } }).Start();
public AliapohDefaultConfig(SettingObject s) { Initializer(s); }