예제 #1
0
 protected override void OnStartup(StartupEventArgs e)
 {
     ThemeManager.BeginUpdate();
     try
     {
         ThemeManager.AreNativeThemesEnabled = true;
         ThemeManager.CurrentTheme           = ThemeName.MetroDark.ToString();
     }
     finally
     {
         ThemeManager.EndUpdate();
     }
     base.OnStartup(e);
 }
예제 #2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occurs when the application is starting up.
        /// </summary>
        /// <param name="e">A <see cref="StartupEventArgs"/> that contains data related to this event.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // Configure Actipro themes for native controls and set an Office theme that is similar to Word
            ThemeManager.BeginUpdate();
            try {
                ThemeManager.AreNativeThemesEnabled = true;
                ThemeManager.CurrentTheme           = ThemeNames.OfficeColorfulIndigo;
            }
            finally {
                ThemeManager.EndUpdate();
            }

            // Call the base method
            base.OnStartup(e);
        }
예제 #3
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // PUBLIC PROPERTIES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occurs when the application is starting up.
        /// </summary>
        /// <param name="e">A <see cref="StartupEventArgs"/> that contains data related to this event.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // Tell images to chromatically adapt for dark themes when needed
            ImageProvider.Default.ChromaticAdaptationMode     = ImageChromaticAdaptationMode.DarkThemes;
            ImageProvider.Default.UseMonochromeInHighContrast = true;

            // NOTE: This is the ideal place to set the application theme, load native styles, or set customized string resources
            ThemeManager.BeginUpdate();
            try {
                // The older Aero and Office 2010 themes are in a separate assembly and must be registered if you will use them in the application
                ThemesAeroThemeCatalogRegistrar.Register();

                // Register an optional "Custom (Slate)" theme definition (selectable from the Theme menu)
                ThemeManager.RegisterThemeDefinition(new ThemeDefinition("Custom")
                {
                    Intent = ThemeIntent.Dark,
                    BarItemBackgroundGradientKind = GradientKind.Mid,
                    BaseGrayscaleHue               = 210,
                    BaseGrayscaleSaturation        = 52,
                    ButtonBackgroundGradientKind   = GradientKind.Mid,
                    ButtonBorderContrastKind       = BorderContrastKind.Low,
                    ContainerBorderContrastKind    = BorderContrastKind.Low,
                    ListItemBackgroundGradientKind = GradientKind.Mid,
                    PopupBorderContrastKind        = BorderContrastKind.Low,
                    ScrollBarHasButtons            = true,
                    ScrollBarThumbCornerRadius     = 1.5,
                    ScrollBarThumbMargin           = 7,
                    WindowTitleBarBackgroundKind   = WindowTitleBarBackgroundKind.ThemeMinimum,
                });

                // Use the Actipro styles for native WPF controls that look great with Actipro's control products
                ThemeManager.AreNativeThemesEnabled = true;

                // Update the SyntaxEditor highlighting style registry and image set if the theme changes backgrounds from light to dark, or vice versa
                ThemeManager.CurrentThemeChanged += (sender, args) => {
                    ActiproSoftware.ProductSamples.SyntaxEditorSamples.Common.SyntaxEditorHelper.UpdateHighlightingStyleRegistryForThemeChange();
                    ActiproSoftware.ProductSamples.SyntaxEditorSamples.Common.SyntaxEditorHelper.UpdateImageSetForThemeChange();
                };

                // Set a Metro Light theme
                ThemeManager.CurrentTheme = ThemeNames.MetroLight;
            }
            finally {
                ThemeManager.EndUpdate();
            }

            // ------------------------------------------------------------------------------------------------------

            // If using SyntaxEditor with languages that support syntax/semantic parsing, use this line at
            //   app startup to ensure that worker threads are used to perform the parsing
            ActiproSoftware.Text.Parsing.AmbientParseRequestDispatcherProvider.Dispatcher =
                new ActiproSoftware.Text.Parsing.Implementation.ThreadedParseRequestDispatcher();

            // Create SyntaxEditor .NET Languages Add-on ambient assembly repository, which supports caching of
            //   reflection data and improves performance for the add-on...
            //   Be sure to replace the appDataPath with a proper path for your own application (if file access is allowed)
            var appDataPath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                                        "Actipro Software"), "WPF SampleBrowser Assembly Repository");

            ActiproSoftware.Text.Languages.DotNet.Reflection.AmbientAssemblyRepositoryProvider.Repository =
                new ActiproSoftware.Text.Languages.DotNet.Reflection.Implementation.FileBasedAssemblyRepository(appDataPath);

            // Create SyntaxEditor Python Languages Add-on ambient pacakge repository, which supports caching of
            //   reflection data... Be sure to replace the appDataPath with a proper path for your own application (if file access is allowed)
            appDataPath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                                    "Actipro Software"), "WPF SampleBrowser Python Package Repository");
            ActiproSoftware.Text.Languages.Python.Reflection.AmbientPackageRepositoryProvider.Repository =
                new ActiproSoftware.Text.Languages.Python.Reflection.Implementation.FileBasedPackageRepository(appDataPath);

            // ------------------------------------------------------------------------------------------------------

            // Call the base method
            base.OnStartup(e);
        }
예제 #4
0
        public MainWindow()
        {
            try
            {
                InitializeComponent();

                // update titles
#pragma warning disable CA1303 // Do not pass literals as localized parameters
                versionText.Text = VERSION;
#pragma warning restore CA1303 // Do not pass literals as localized parameters

                // used for setting menu icons based on open windows
                IconToWindow = new Dictionary <string, DockingWindow>()
                {
                    { npcIcon.Name, npcWindow }, { verifiedPlayersIcon.Name, verifiedPlayersWindow },
                    { verifiedPetsIcon.Name, verifiedPetsWindow }, { petMappingIcon.Name, petMappingWindow },
                    { playerParseIcon.Name, playerParseTextWindow }
                };

                // Clear/Reset
                DataManager.Instance.EventsClearedActiveData += Instance_EventsClearedActiveData;

                // verified pets table
                verifiedPetsGrid.ItemsSource = VerifiedPetsView;
                PlayerManager.Instance.EventsNewVerifiedPet += (sender, name) => Dispatcher.InvokeAsync(() =>
                {
                    Helpers.InsertNameIntoSortedList(name, VerifiedPetsView);
                    verifiedPetsWindow.Title = string.Format(CultureInfo.CurrentCulture, PETS_LIST_TITLE, VerifiedPetsView.Count);
                });

                // pet -> players
                petMappingGrid.ItemsSource = PetPlayersView;
                PlayerManager.Instance.EventsNewPetMapping += (sender, mapping) =>
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        var existing = PetPlayersView.FirstOrDefault(item => item.Pet.Equals(mapping.Pet, StringComparison.OrdinalIgnoreCase));
                        if (existing != null && existing.Owner != mapping.Owner)
                        {
                            existing.Owner = mapping.Owner;
                        }
                        else
                        {
                            PetPlayersView.Add(mapping);
                        }

                        petMappingWindow.Title = "Pet Owners (" + PetPlayersView.Count + ")";
                    });
                    CheckComputeStats();
                };

                PlayerManager.Instance.EventsRemoveVerifiedPet += (sender, name) => Dispatcher.InvokeAsync(() =>
                {
                    var found = VerifiedPetsView.FirstOrDefault(item => item.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
                    if (found != null)
                    {
                        VerifiedPetsView.Remove(found);
                        verifiedPetsWindow.Title = string.Format(CultureInfo.CurrentCulture, PETS_LIST_TITLE, VerifiedPetsView.Count);

                        var existing = PetPlayersView.FirstOrDefault(item => item.Pet.Equals(name, StringComparison.OrdinalIgnoreCase));
                        if (existing != null)
                        {
                            PetPlayersView.Remove(existing);
                            petMappingWindow.Title = "Pet Owners (" + PetPlayersView.Count + ")";
                        }
                        CheckComputeStats();
                    }
                });

                // verified player table
                verifiedPlayersGrid.ItemsSource = VerifiedPlayersProperty;
                PlayerManager.Instance.EventsNewVerifiedPlayer += (sender, name) => Dispatcher.InvokeAsync(() =>
                {
                    Helpers.InsertNameIntoSortedList(name, VerifiedPlayersProperty);
                    verifiedPlayersWindow.Title = string.Format(CultureInfo.CurrentCulture, PLAYER_LIST_TITLE, VerifiedPlayersProperty.Count);
                });

                PlayerManager.Instance.EventsRemoveVerifiedPlayer += (sender, name) => Dispatcher.InvokeAsync(() =>
                {
                    var found = VerifiedPlayersProperty.FirstOrDefault(item => item.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
                    if (found != null)
                    {
                        VerifiedPlayersProperty.Remove(found);
                        verifiedPlayersWindow.Title = string.Format(CultureInfo.CurrentCulture, PLAYER_LIST_TITLE, VerifiedPlayersProperty.Count);

                        var existing = PetPlayersView.FirstOrDefault(item => item.Owner.Equals(name, StringComparison.OrdinalIgnoreCase));
                        if (existing != null)
                        {
                            PetPlayersView.Remove(existing);
                            petMappingWindow.Title = "Pet Owners (" + PetPlayersView.Count + ")";
                        }
                        CheckComputeStats();
                    }
                });

                (npcWindow.Content as FightTable).EventsSelectionChange += (sender, data) => ComputeStats();
                DamageStatsManager.Instance.EventsUpdateDataPoint       += (sender, data) => HandleChartUpdateEvent(DamageChartWindow, sender, data);
                HealingStatsManager.Instance.EventsUpdateDataPoint      += (sender, data) => HandleChartUpdateEvent(HealingChartWindow, sender, data);
                TankingStatsManager.Instance.EventsUpdateDataPoint      += (sender, data) => HandleChartUpdateEvent(TankingChartWindow, sender, data);

                // Setup themes
                ThemeManager.BeginUpdate();
                ThemeManager.AreNativeThemesEnabled = true;
                SystemThemeCatalogRegistrar.Register();
                ThemeManager.CurrentTheme = ThemeNames.Dark;

                UpdateDeleteChatMenu();

                // Bane Damage
                IsBaneDamageEnabled             = ConfigUtil.IfSet("IncludeBaneDamage");
                enableBaneDamageIcon.Visibility = IsBaneDamageEnabled ? Visibility.Visible : Visibility.Hidden;

                // Damage Overlay
                enableDamageOverlayIcon.Visibility = OverlayUtil.LoadSettings() ? Visibility.Visible : Visibility.Hidden;

                // AoE healing
                IsAoEHealingEnabled             = ConfigUtil.IfSet("IncludeAoEHealing");
                enableAoEHealingIcon.Visibility = IsAoEHealingEnabled ? Visibility.Visible : Visibility.Hidden;

                // Hide window when minimized
                IsHideOnMinimizeEnabled             = ConfigUtil.IfSet("HideWindowOnMinimize");
                enableHideOnMinimizeIcon.Visibility = IsHideOnMinimizeEnabled ? Visibility.Visible : Visibility.Hidden;

                // Show Tanking Summary at startup
                ConfigUtil.IfSet("ShowTankingSummaryAtStartup", OpenTankingSummary);
                // Show Healing Summary at startup
                ConfigUtil.IfSet("ShowHealingSummaryAtStartup", OpenHealingSummary);
                // Show Healing Summary at startup
                ConfigUtil.IfSet("ShowDamageSummaryAtStartup", OpenDamageSummary, true);
                // Show Tanking Summary at startup
                ConfigUtil.IfSet("ShowTankingChartAtStartup", OpenTankingChart);
                // Show Healing Summary at startup
                ConfigUtil.IfSet("ShowHealingChartAtStartup", OpenHealingChart);
                // Show Healing Summary at startup
                ConfigUtil.IfSet("ShowDamageChartAtStartup", OpenDamageChart);
                LOG.Info("Initialized Components");

                if (ConfigUtil.IfSet("AutoMonitor"))
                {
                    enableAutoMonitorIcon.Visibility = Visibility.Visible;
                    var previousFile = ConfigUtil.GetSetting("LastOpenedFile");
                    if (File.Exists(previousFile))
                    {
                        OpenLogFile(LogOption.MONITOR, previousFile);
                    }
                }
                else
                {
                    enableAutoMonitorIcon.Visibility = Visibility.Hidden;
                }

                if (ConfigUtil.IfSet("Debug"))
                {
                    LOG.Info("Debug Enabled. Saving Unprocessed Lines to " + ConfigUtil.LogsDir);
                    ConfigUtil.Debug = true;
                }
            }
            catch (Exception e)
            {
                LOG.Error(e);
                throw;
            }
            finally
            {
                ThemeManager.EndUpdate();
            }
        }