예제 #1
0
        //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;
        }
예제 #2
0
        //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();
        }
예제 #3
0
        public static void Init()
        {
            ForegroundManager = new ForegroundManager();
            ScreenSize        = new Size(SystemParameters.VirtualScreenWidth, SystemParameters.VirtualScreenHeight);
            ScreenCorrection  = new Size(1, 1);
            UpdateScreenCorrection();
            FocusManager.Init();
            LoadWindows();
            _contextMenu = new ContextMenu();
            var defaultIconStream = Application.GetResourceStream(new Uri("resources/tcc-logo.ico", UriKind.Relative))?.Stream;

            if (defaultIconStream != null)
            {
                DefaultIcon = new Icon(defaultIconStream);
            }
            var connectedIconStream = Application.GetResourceStream(new Uri("resources/tcc-logo-on.ico", UriKind.Relative))?.Stream;

            if (connectedIconStream != null)
            {
                ConnectedIcon = new Icon(connectedIconStream);
            }
            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 =>
                {
                    _contextMenu.Closed += (_, __) => App.Close();
                    _contextMenu.IsOpen  = false;
                })
            });

            SettingsWindow = new SettingsWindow();

            if (SettingsHolder.UseHotkeys)
            {
                KeyboardHook.Instance.RegisterKeyboardHook();
            }

            SystemEvents.DisplaySettingsChanged += SystemEventsOnDisplaySettingsChanged;
            //t = new System.Timers.Timer();
            //t.Interval = 1000;
            //t.Elapsed += (_, __) => PrintDispatcher();
            //t.Start();
        }