// Decompiled with JetBrains decompiler
// Type: FiestaLauncher.Services.NoticeService
// Assembly: FiestaOnline, Version=2019.5.22.0, Culture=neutral, PublicKeyToken=null
// MVID: 2FD5EB61-BC25-469D-997E-88998E849F6A
// Assembly location: C:\Users\marbo\Documents\Gamigo 2020 Client\FiestaOnline.exe

using FiestaLauncher.gClasses;
using System;
using System.Threading;

namespace FiestaLauncher.Services
{
  internal static class NoticeService
  {
    internal static bool Enabled = true;

    internal static void Disable()
    {
      NoticeService.Enabled = false;
    }

    internal static void Enable()
    {
      NoticeService.Enabled = true;
    }

    internal static void Init()
    {
      while (NoticeService.Enabled)
      {
        foreach (Notice notice1 in gFiestaLauncher.Settings.Notices)
        {
          Notice notice = notice1;
          try
          {
            if (notice.Enabled == 1 && NoticeService.Enabled)
            {
              gFiestaLauncher.MainWindow.RunOnUiThread((Main.RunOnUiThreadDelegate) (() => gFiestaLauncher.MainWindow.SetNotification(notice.Title, notice.Text, notice.Type, notice.AutoShow)));
              Thread.Sleep(notice.Lifetime);
            }
          }
          catch (Exception ex)
          {
            gFiestaLauncher.onCrash(ex);
          }
        }
      }
    }
  }
}
