Beispiel #1
0
 private void _toggleScan()
 {
     if (!_client.IsScaning)
     {
         _client.ClientPath = Config.Instance.ClientFilePath;
         if (!File.Exists(_client.ClientPath))
         {
             if (Config.Instance.IsAutoDetect)
             {
                 _client.ClientPath = _getClientPath();
                 if (!File.Exists(_client.ClientPath))
                 {
                     MessageBox.Show("Please run Path of Exile game for detect Client.txt.",
                                     "Cannot running scanning Client.txt",
                                     MessageBoxButton.OK, MessageBoxImage.Information);
                     return;
                 }
                 Config.Instance.ClientFilePath = _client.ClientPath;
             }
             else
             {
                 MessageBox.Show($"File {_client.ClientPath} not found. Please set file path or enable auto-detection in settings.",
                                 "Cannot running scanning Client.txt",
                                 MessageBoxButton.OK, MessageBoxImage.Error);
                 return;
             }
         }
         _client.Scan();
         Indicator.Background = Brushes.DarkRed;
         Indicator.ToolTip    = "Scanning Client.txt is running...\nPress to stop.";
     }
     else
     {
         _media.Stop();
         _client.Stop();
         Indicator.Background = Brushes.LightSlateGray;
         Indicator.ToolTip    = "Scanning Client.txt is stoped!\nPress to start.";
     }
     _updateTrayIcon();
 }
Beispiel #2
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (!_isForseClose && Config.Instance.IsMinimizeToTrayWhenClosing)
            {
                _hideToTray();
                e.Cancel = true;
                return;
            }

            _poe?.Stop();
            _client?.Stop();

            // Save Config
            if (cbxFilterGlobal.IsChecked != null)
            {
                Config.Instance.Filters[MessageType.Global].IsEnabled = (bool)cbxFilterGlobal.IsChecked;
            }
            if (cbxFilterParty.IsChecked != null)
            {
                Config.Instance.Filters[MessageType.Party].IsEnabled = (bool)cbxFilterParty.IsChecked;
            }
            if (cbxFilterWhisper.IsChecked != null)
            {
                Config.Instance.Filters[MessageType.Whisper].IsEnabled = (bool)cbxFilterWhisper.IsChecked;
            }
            if (cbxFilterTrade.IsChecked != null)
            {
                Config.Instance.Filters[MessageType.Trade].IsEnabled = (bool)cbxFilterTrade.IsChecked;
            }
            if (cbxFilterGuild.IsChecked != null)
            {
                Config.Instance.Filters[MessageType.Guild].IsEnabled = (bool)cbxFilterGuild.IsChecked;
            }

            Config.Instance.Save();

            Application.Current.Shutdown();
        }