Esempio n. 1
0
        //private readonly SystemTray _systemTray;

        public MainWindow()
        {
            InitializeComponent();
            // Handler for exceptions in threads behind forms.
            App.SplashScreen?.SetText("Initializing main window...");
            Application.ThreadException += GlobalThreadExceptionHandler;
            if (BasicTeraData.Instance.WindowData.InvisibleUi)
            {
                Visibility = Visibility.Hidden;
            }
            System.Windows.Application.Current.Resources["Scale"] = BasicTeraData.Instance.WindowData.Scale;
            if (BasicTeraData.Instance.WindowData.LowPriority)
            {
                Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;
            }
            Console.WriteLine("SuperUniqueStringEasilyDetectableToBeAbleToRandomizeTheProgramAndBypassSignatureBasedBlock");

            TeraSniffer.Instance.Enabled                        = true;
            TeraSniffer.Instance.Warning                       += PcapWarning;
            PacketProcessor.Instance.Connected                 += HandleConnected;
            PacketProcessor.Instance.TickUpdated               += Update;
            PacketProcessor.Instance.SetClickThrouAction       += SetClickThrou;
            PacketProcessor.Instance.UnsetClickThrouAction     += UnsetClickThrou;
            PacketProcessor.Instance.GuildIconAction           += InstanceOnGuildIconAction;
            PacketProcessor.Instance.PauseAction               += PauseState;
            PacketProcessor.Instance.MapChangedAction          += MapChanged;
            PacketProcessor.Instance.DisplayGeneralDataChanged += OnDisplayGeneralDataChanged;
            _dispatcherTimer          = new DispatcherTimer();
            _dispatcherTimer.Tick    += UpdateKeyboard;
            _dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            _dispatcherTimer.Start();
            if (BasicTeraData.Instance.WindowData.EnableOverlay)
            {
                DXrender = new D3D9Render.Renderer();
            }
            EntityStatsImage.Source       = BasicTeraData.Instance.ImageDatabase.EntityStats.Source;
            Chrono.Source                 = BasicTeraData.Instance.ImageDatabase.Chronobar.Source;
            Chrono.ToolTip                = LP.MainWindow_Only_boss;
            CloseWindow.Source            = BasicTeraData.Instance.ImageDatabase.Close.Source;
            History.Source                = BasicTeraData.Instance.ImageDatabase.History.Source;
            Config.Source                 = BasicTeraData.Instance.ImageDatabase.Config.Source;
            Chatbox.Source                = BasicTeraData.Instance.ImageDatabase.Chat.Source;
            BossGageImg.Source            = BasicTeraData.Instance.ImageDatabase.BossGage.Source;
            HideNamesImage.Source         = BasicTeraData.Instance.ImageDatabase.HideNicknames.Source;
            UserPauseBtn.Source           = BasicTeraData.Instance.ImageDatabase.Pause.Source;
            HideNames.ToolTip             = LP.Blur_player_names;
            ListEncounter.PreviewKeyDown += ListEncounterOnPreviewKeyDown;
            UpdateComboboxEncounter(new List <NpcEntity>(), null);
            Title = "Shinra Meter V" + UpdateManager.Version;
            BackgroundColor.Opacity = BasicTeraData.Instance.WindowData.MainWindowOpacity;
            Topmost            = BasicTeraData.Instance.WindowData.Topmost;
            ShowInTaskbar      = !BasicTeraData.Instance.WindowData.Topmost;
            Scroller.MaxHeight = BasicTeraData.Instance.WindowData.NumberOfPlayersDisplayed * 30;
            _entityStats       = new EntityStatsMain()
            {
                Scale = BasicTeraData.Instance.WindowData.DebuffsStatus.Scale, DontClose = true
            };
            _bossGageBar = new BossGageWindow()
            {
                Scale = BasicTeraData.Instance.WindowData.BossGageStatus.Scale, DontClose = true
            };
            _popupNotification = new PopupNotification()
            {
                DontClose = true
            };
            _windowHistory = new TeradpsHistory(new ConcurrentDictionary <UploadData, NpcEntity>())
            {
                Scale = BasicTeraData.Instance.WindowData.HistoryStatus.Scale, DontClose = true
            };
            KeyboardHook.Instance.SwitchTopMost += delegate { NotifyIcon.SwitchStayTop(); };
            SystemEvents.SessionEnding          += new SessionEndingEventHandler(SystemEvents_SessionEnding);
            NotifyIcon.Initialize(this);
            NotifyIcon.InitializeServerList(PacketProcessor.Instance.Initialize());
            if (BasicTeraData.Instance.WindowData.ClickThrou)
            {
                SetClickThrou();
            }
            GraphViewModel = new GraphViewModel();
        }