private void WindowClosed(object sender, EventArgs e) { ConfigUtil.SetSetting("ShowDamageSummaryAtStartup", (DamageWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture)); ConfigUtil.SetSetting("ShowHealingSummaryAtStartup", (HealingWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture)); ConfigUtil.SetSetting("ShowTankingSummaryAtStartup", (TankingWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture)); ConfigUtil.SetSetting("ShowDamageChartAtStartup", (DamageChartWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture)); ConfigUtil.SetSetting("ShowHealingChartAtStartup", (HealingChartWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture)); ConfigUtil.SetSetting("ShowTankingChartAtStartup", (TankingChartWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture)); StopProcessing(); OverlayUtil.CloseOverlay(); taskBarIcon?.Dispose(); PlayerChatManager?.Dispose(); ConfigUtil.Save(); PlayerManager.Instance?.Save(); Application.Current.Shutdown(); }
private void UpdateLoadingProgress() { Dispatcher.InvokeAsync(() => { if (EQLogReader != null) { Busy(true); OverlayUtil.CloseOverlay(); var seconds = Math.Round((DateTime.Now - StartLoadTime).TotalSeconds, 1); double filePercent = EQLogReader.FileSize > 0 ? Math.Min(Convert.ToInt32((double)FilePosition / EQLogReader.FileSize * 100), 100) : 100; StatusText = (CurrentLogOption == LogOption.ARCHIVE ? "Archiving" : "Reading Log... ") + filePercent + "% in " + seconds + " seconds"; StatusBrush = LOADING_BRUSH; if (EQLogReader.FileLoadComplete) { if ((filePercent >= 100 && CurrentLogOption != LogOption.ARCHIVE) || CurrentLogOption == LogOption.MONITOR) { StatusBrush = GOOD_BRUSH; StatusText = "Monitoring Active"; } else if (filePercent >= 100 && CurrentLogOption == LogOption.ARCHIVE) { StatusBrush = GOOD_BRUSH; StatusText = "Archiving Complete"; } } if (((filePercent >= 100 && CastProcessor.GetPercentComplete() >= 100 && DamageProcessor.GetPercentComplete() >= 100 && HealingProcessor.GetPercentComplete() >= 100 && MiscProcessor.GetPercentComplete() >= 100) || CurrentLogOption == LogOption.MONITOR || CurrentLogOption == LogOption.ARCHIVE) && EQLogReader.FileLoadComplete) { OverlayUtil.OpenIfEnabled(Dispatcher); LOG.Info("Finished Loading Log File in " + seconds + " seconds."); EventsLogLoadingComplete?.Invoke(this, true); } else { _ = Task.Delay(500).ContinueWith(task => UpdateLoadingProgress(), TaskScheduler.Default); } Busy(false); } }); }
private void UpdateLoadingProgress() { Dispatcher.InvokeAsync(() => { if (EQLogReader != null) { OverlayUtil.CloseOverlay(); var seconds = Math.Round((DateTime.Now - StartLoadTime).TotalSeconds); double filePercent = EQLogReader.FileSize > 0 ? Math.Min(Convert.ToInt32((double)FilePosition / EQLogReader.FileSize * 100), 100) : 100; statusText.Text = string.Format(CultureInfo.CurrentCulture, "Reading Log... {0}% in {1} seconds", filePercent, seconds); statusText.Foreground = LOADING_BRUSH; if (EQLogReader.FileLoadComplete) { if (filePercent >= 100 || CurrentLogOption == LogOption.MONITOR) { statusText.Foreground = GOOD_BRUSH; statusText.Text = "Monitoring Active"; } ConfigUtil.SetSetting("LastOpenedFile", CurrentLogFile); } if (((filePercent >= 100 && CastProcessor.GetPercentComplete() >= 100 && DamageProcessor.GetPercentComplete() >= 100 && HealingProcessor.GetPercentComplete() >= 100 && MiscProcessor.GetPercentComplete() >= 100) || CurrentLogOption == LogOption.MONITOR) && EQLogReader.FileLoadComplete) { OverlayUtil.OpenIfEnabled(Dispatcher); LOG.Info("Finished Loading Log File in " + seconds.ToString(CultureInfo.CurrentCulture) + " seconds."); EventsLogLoadingComplete?.Invoke(this, true); } else { _ = Task.Delay(500).ContinueWith(task => UpdateLoadingProgress(), TaskScheduler.Default); } } }); }