private void OpenTankingSummary() { if (TankingWindow?.IsOpen == true) { TankingWindow.Close(); } else { #pragma warning disable CA2000 // Dispose objects before losing scope var tankingSummary = new TankingSummary(); #pragma warning restore CA2000 // Dispose objects before losing scope tankingSummary.EventsSelectionChange += TankingSummary_SelectionChanged; TankingWindow = new DocumentWindow(dockSite, "tankingSummary", "Tanking Summary", null, tankingSummary); IconToWindow[tankingSummaryIcon.Name] = TankingWindow; Helpers.OpenWindow(TankingWindow); if (DamageWindow?.IsOpen == true || HealingWindow?.IsOpen == true) { TankingWindow.MoveToPreviousContainer(); } RepositionCharts(TankingWindow); if (TankingStatsManager.Instance.GetGroupCount() > 0) { // keep chart request until resize issue is fixed. resetting the series fixes it at a minimum var tankingOptions = new GenerateStatsOptions() { RequestSummaryData = true }; Task.Run(() => TankingStatsManager.Instance.RebuildTotalStats(tankingOptions)); } } }
private bool OpenLineChart(DocumentWindow window, DocumentWindow other1, DocumentWindow other2, FrameworkElement icon, string title, List <string> choices, bool includePets, out DocumentWindow newWindow) { bool updated = false; newWindow = window; if (newWindow?.IsOpen == true) { newWindow.Close(); newWindow = null; } else { updated = true; var chart = new LineChart(choices, includePets); newWindow = new DocumentWindow(dockSite, title, title, null, chart); IconToWindow[icon.Name] = newWindow; Helpers.OpenWindow(newWindow); newWindow.CanFloat = true; newWindow.CanClose = true; if (other1?.IsOpen == true || other2?.IsOpen == true) { newWindow.MoveToNextContainer(); } else { newWindow.MoveToNewHorizontalContainer(); } } return(updated); }
private void OpenHealingSummary() { if (HealingWindow?.IsOpen == true) { HealingWindow.Close(); } else { var healingSummary = new HealingSummary(); healingSummary.EventsSelectionChange += HealingSummary_SelectionChanged; HealingWindow = new DocumentWindow(dockSite, "healingSummary", "Healing Summary", null, healingSummary); IconToWindow[healingSummaryIcon.Name] = HealingWindow; Helpers.OpenWindow(HealingWindow); if (DamageWindow?.IsOpen == true || TankingWindow?.IsOpen == true) { HealingWindow.MoveToPreviousContainer(); } Helpers.RepositionCharts(HealingWindow, DamageChartWindow, TankingChartWindow, HealingChartWindow); if (HealingStatsManager.Instance.GetGroupCount() > 0) { // keep chart request until resize issue is fixed. resetting the series fixes it at a minimum var healingOptions = new GenerateStatsOptions() { RequestSummaryData = true }; Task.Run(() => HealingStatsManager.Instance.RebuildTotalStats(healingOptions)); } } }
// Main Menu private void MenuItemWindowClick(object sender, RoutedEventArgs e) { if (e.Source == damageChartMenuItem) { OpenDamageChart(); } else if (e.Source == healingChartMenuItem) { OpenHealingChart(); } else if (e.Source == tankingChartMenuItem) { OpenTankingChart(); } else if (e.Source == damageSummaryMenuItem) { OpenDamageSummary(); } else if (e.Source == healingSummaryMenuItem) { OpenHealingSummary(); } else if (e.Source == tankingSummaryMenuItem) { OpenTankingSummary(); } else if (e.Source == chatMenuItem) { ChatWindow = Helpers.OpenWindow(dockSite, ChatWindow, typeof(ChatViewer), "chatWindow", "Chat Archive"); IconToWindow[chatIcon.Name] = ChatWindow; } else if (e.Source == eventMenuItem) { EventWindow = Helpers.OpenWindow(dockSite, EventWindow, typeof(EventViewer), "eventWindow", "Special Events"); IconToWindow[eventIcon.Name] = EventWindow; } else if (e.Source == playerLootMenuItem) { LootWindow = Helpers.OpenWindow(dockSite, LootWindow, typeof(LootViewer), "lootWindow", "Looted Items"); IconToWindow[playerLootIcon.Name] = LootWindow; } else if (e.Source == eqLogMenuItem) { EQLogWindow = Helpers.OpenWindow(dockSite, EQLogWindow, typeof(EQLogViewer), "eqLogWindow", "Full Log Search"); IconToWindow[eqLogIcon.Name] = EQLogWindow; } else if (e.Source == npcStatsMenuItem) { NpcStatsWindow = Helpers.OpenWindow(dockSite, NpcStatsWindow, typeof(NpcStatsViewer), "npcStatsWindow", "NPC Spell Stats"); IconToWindow[npcStatsIcon.Name] = NpcStatsWindow; } else { if ((sender as MenuItem)?.Icon is ImageAwesome icon && IconToWindow.ContainsKey(icon.Name)) { Helpers.OpenWindow(IconToWindow[icon.Name]); } } }
private void OpenLogFile(LogOption option, string previousFile = null, int lastMins = -1) { CurrentLogOption = option; try { string theFile; bool success = true; if (previousFile != null) { theFile = previousFile; } else { // WPF doesn't have its own file chooser so use Win32 Version Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog { // filter to txt files DefaultExt = ".txt", Filter = "eqlog_Player_server (.txt .txt.gz)|*.txt;*.txt.gz", }; // show dialog and read result success = dialog.ShowDialog() == true; theFile = dialog.FileName; } if (success) { if (!npcWindow.IsOpen) { Helpers.OpenWindow(IconToWindow[npcIcon.Name]); } StopProcessing(); CastProcessor = new ActionProcessor(CastLineParser.Process); DamageProcessor = new ActionProcessor(DamageLineParser.Process); HealingProcessor = new ActionProcessor(HealingLineParser.Process); MiscProcessor = new ActionProcessor(MiscLineParser.Process); fileText.Text = "-- " + theFile; StartLoadTime = DateTime.Now; FilePosition = LineCount = 0; DebugUtil.Reset(); string name = "You"; string server = "Uknown"; if (theFile.Length > 0) { LOG.Info("Selected Log File: " + theFile); string file = Path.GetFileName(theFile); MatchCollection matches = ParseFileName.Matches(file); if (matches.Count == 1) { if (matches[0].Groups.Count > 1) { name = matches[0].Groups[1].Value; } if (matches[0].Groups.Count > 2) { server = matches[0].Groups[2].Value; } } } var changed = ConfigUtil.ServerName != server; if (changed) { PetPlayersView.Clear(); VerifiedPetsView.Clear(); VerifiedPlayersProperty.Clear(); VerifiedPlayersProperty.Add(new SortableName { Name = Labels.UNASSIGNED }); verifiedPetsWindow.Title = string.Format(CultureInfo.CurrentCulture, PETS_LIST_TITLE, VerifiedPetsView.Count); verifiedPlayersWindow.Title = string.Format(CultureInfo.CurrentCulture, PLAYER_LIST_TITLE, VerifiedPlayersProperty.Count); PlayerManager.Instance.Save(); } ConfigUtil.ServerName = server; ConfigUtil.PlayerName = name; if (changed) { PlayerManager.Instance.Init(); } DataManager.Instance.Clear(); PlayerChatManager = new ChatManager(); CurrentLogFile = theFile; NpcDamageManager.ResetTime(); EQLogReader = new LogReader(theFile, FileLoadingCallback, CurrentLogOption == LogOption.MONITOR, lastMins); EQLogReader.Start(); UpdateLoadingProgress(); } } catch (Exception e) { if (!(e is InvalidCastException || e is ArgumentException || e is FormatException)) { throw; } else { LOG.Error("Problem During Initialization", e); } } }