//public static event PropertyChangedEventHandler ClickThruChanged; //public static event PropertyChangedEventHandler TccVisibilityChanged; //public static event PropertyChangedEventHandler TccDimChanged; //public static bool ClickThru //{ // get => clickThru; // set // { // if (clickThru != value) // { // clickThru = value; // ClickThruChanged?.Invoke(null, new PropertyChangedEventArgs("ClickThruMode")); // } // } //} //public static bool IsTccVisible //{ // get // { // if (SessionManager.Logged && !SessionManager.LoadingScreen && IsFocused) // { // isTccVisible = true; // return isTccVisible; // } // else // { // isTccVisible = false || App.Debug; // return isTccVisible; // } // } // set // { // if (isTccVisible != value) // { // isTccVisible = value; // NotifyVisibilityChanged(); // } // } //} //public static bool IsFocused //{ // get => isFocused; // set // { // if (!FocusManager.Running) return; // //if (isFocused == value) // //{ // // //if(focusCount > 3) // // //{ // // // return; // // //} // // return; // //} // isFocused = value; // //if (isFocused) // //{ // // focusCount++; // //} // //else // //{ // // focusCount = 0; // //} // NotifyVisibilityChanged(); // } //} //public static bool SkillsEnded //{ // get => skillsEnded; // set // { // if (value == false) // { // _undimTimer.Stop(); // _undimTimer.Start(); // } // if (skillsEnded == value) return; // skillsEnded = value; // CombatChanged?.Invoke(); // NotifyDimChanged(); // } //} //public static bool IsTccDim //{ // get => SkillsEnded && !SessionManager.Encounter; // add more conditions here if needed //} public static void Init() { ForegroundManager = new ForegroundManager(); FocusManager.Init(); LoadWindows(); _contextMenu = new ContextMenu(); // ReSharper disable AssignNullToNotNullAttribute DefaultIcon = new Icon(Application.GetResourceStream(new Uri("resources/tcc-logo.ico", UriKind.Relative))?.Stream); ConnectedIcon = new Icon(Application.GetResourceStream(new Uri("resources/tcc-logo-on.ico", UriKind.Relative))?.Stream); // ReSharper restore AssignNullToNotNullAttribute TrayIcon = new NotifyIcon() { Icon = DefaultIcon, Visible = true }; TrayIcon.MouseDown += NI_MouseDown; TrayIcon.MouseDoubleClick += TrayIcon_MouseDoubleClick; var v = Assembly.GetExecutingAssembly().GetName().Version; TrayIcon.Text = $"TCC v{v.Major}.{v.Minor}.{v.Build}"; _contextMenu.Items.Add(new MenuItem() { Header = "Dashboard", Command = new RelayCommand(o => Dashboard.ShowWindow()) }); _contextMenu.Items.Add(new MenuItem() { Header = "Settings", Command = new RelayCommand(o => SettingsWindow.ShowWindow()) }); _contextMenu.Items.Add(new MenuItem() { Header = "Close", Command = new RelayCommand(o => App.CloseApp()) }); //_undimTimer.Elapsed += _undimTimer_Elapsed; //SettingsWindowOld = new SettingsWindowOld(); SettingsWindow = new SettingsWindow(); if (SettingsHolder.UseHotkeys) { KeyboardHook.Instance.RegisterKeyboardHook(); } //TccWindow.RecreateWindow += TccWindow_RecreateWindow; }
//public static bool ClickThru //{ // get => clickThru; // set // { // if (clickThru != value) // { // clickThru = value; // ClickThruChanged?.Invoke(null, new PropertyChangedEventArgs("ClickThruMode")); // } // } //} //public static bool IsTccVisible //{ // get // { // if (SessionManager.Logged && !SessionManager.LoadingScreen && IsFocused) // { // isTccVisible = true; // return isTccVisible; // } // else // { // isTccVisible = false || App.Debug; // return isTccVisible; // } // } // set // { // if (isTccVisible != value) // { // isTccVisible = value; // NotifyVisibilityChanged(); // } // } //} //public static bool IsFocused //{ // get => isFocused; // set // { // if (!FocusManager.Running) return; // //if (isFocused == value) // //{ // // //if(focusCount > 3) // // //{ // // // return; // // //} // // return; // //} // isFocused = value; // //if (isFocused) // //{ // // focusCount++; // //} // //else // //{ // // focusCount = 0; // //} // NotifyVisibilityChanged(); // } //} //public static bool SkillsEnded //{ // get => skillsEnded; // set // { // if (value == false) // { // _undimTimer.Stop(); // _undimTimer.Start(); // } // if (skillsEnded == value) return; // skillsEnded = value; // CombatChanged?.Invoke(); // NotifyDimChanged(); // } //} //public static bool IsTccDim //{ // get => SkillsEnded && !SessionManager.Encounter; // add more conditions here if needed //} public static void Init() { ForegroundManager = new ForegroundManager(); FocusManager.Init(); LoadWindows(); FloatingButton = new FloatingButtonWindow(); FloatingButton.Show(); _contextMenu = new ContextMenu(); DefaultIcon = new Icon(Application.GetResourceStream(new Uri("resources/tcc-logo.ico", UriKind.Relative)).Stream); ConnectedIcon = new Icon(Application.GetResourceStream(new Uri("resources/tcc-logo-on.ico", UriKind.Relative)).Stream); TrayIcon = new NotifyIcon() { Icon = DefaultIcon, Visible = true }; TrayIcon.MouseDown += NI_MouseDown; TrayIcon.MouseDoubleClick += TrayIcon_MouseDoubleClick; var v = Assembly.GetExecutingAssembly().GetName().Version; TrayIcon.Text = string.Format("TCC v{0}.{1}.{2}", v.Major, v.Minor, v.Build); var CloseButton = new MenuItem() { Header = "Close" }; CloseButton.Click += (s, ev) => App.CloseApp(); _contextMenu.Items.Add(CloseButton); //_undimTimer.Elapsed += _undimTimer_Elapsed; Settings = new SettingsWindow(); if (SettingsManager.UseHotkeys) { KeyboardHook.Instance.RegisterKeyboardHook(); } //TccWindow.RecreateWindow += TccWindow_RecreateWindow; FocusManager.FocusTimer.Start(); }
public static void Init() { CooldownWindow = new CooldownWindow(); CharacterWindow = new CharacterWindow(); BossGauge = new BossGageWindow(); BuffBar = new AbnormalitiesWindow(); ContextMenu = new ContextMenu(); TrayIcon = new System.Windows.Forms.NotifyIcon() { Icon = Icon.ExtractAssociatedIcon(Process.GetCurrentProcess().MainModule.FileName), Visible = true }; TrayIcon.MouseDown += NI_MouseDown; var v = Assembly.GetExecutingAssembly().GetName().Version; TrayIcon.Text = String.Format("TCC v{0}.{1}.{2}", v.Major, v.Minor, v.Build); var ForceShowButton = new MenuItem() { Header = "Force visibility on" }; ClickThruButton = new MenuItem() { Header = "Click through" }; var CloseButton = new MenuItem() { Header = "Close" }; CharacterWindowVisibilityButton = new MenuItem() { Header = "Unhide character window" }; CharacterWindowVisibilityButton.Click += (s, ev) => { CharacterWindow.Visibility = Visibility.Visible; }; CooldownWindowVisibilityButton = new MenuItem() { Header = "Unhide cooldowns bar" }; CooldownWindowVisibilityButton.Click += (s, ev) => { CooldownWindow.Visibility = Visibility.Visible; }; BossGaugeWindowVisibilityButton = new MenuItem() { Header = "Unhide boss bar" }; BossGaugeWindowVisibilityButton.Click += (s, ev) => { BossGauge.Visibility = Visibility.Visible; }; BuffBarWindowVisibilityButton = new MenuItem() { Header = "Unhide buffs bar" }; BuffBarWindowVisibilityButton.Click += (s, ev) => { BuffBar.Visibility = Visibility.Visible; }; CloseButton.Click += (s, ev) => App.CloseApp(); ClickThruButton.Click += (s, ev) => ToggleClickThru(); ForceShowButton.Click += (s, ev) => ForceShow(); ContextMenu.Items.Add(CooldownWindowVisibilityButton); ContextMenu.Items.Add(BuffBarWindowVisibilityButton); ContextMenu.Items.Add(BossGaugeWindowVisibilityButton); ContextMenu.Items.Add(CharacterWindowVisibilityButton); ContextMenu.Items.Add(new Separator()); ContextMenu.Items.Add(ClickThruButton); ContextMenu.Items.Add(CloseButton); FocusManager.FocusTimer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(1) }; FocusManager.FocusTimer.Tick += FocusManager.CheckForegroundWindow; FocusManager.ForegroundWindowChanged += FocusManager_ForegroundWindowChanged; }