Ejemplo n.º 1
0
    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);
        }
      });
    }
Ejemplo n.º 2
0
        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);
                    }
                }
            });
        }