using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.VisualBasic.Devices;

namespace GFATask
{
    class SystemApps
    {
        public static void Restart(out bool conditions)
        {
            XObjects.Restart("-restart");
            conditions = true;
        }

        public static void Kill(out bool conditions)
        {
            Environment.Exit(Environment.ExitCode);
            conditions = true;
        }

        public static void Backup(out bool conditions)
        {
            ConfigBackupClass.Save();
            conditions = true;
        }

        public static void LoadBackup(out bool conditions)
        {
            ConfigBackupClass.Load();
            conditions = true;
        }

        public static void Settings(out bool conditions)
        {
            Forms.Main.Invoke(new MethodInvoker(delegate { Accessor.OpenForm("Settings"); }));
            conditions = true;
        }

        public static void Administration(out bool conditions)
        {
            Forms.Main.Invoke(new MethodInvoker(delegate { Forms.Administration.Login(); }));
            conditions = true;
        }

        public static void Info(out bool conditions)
        {
            if (Forms.Main.InvokeRequired)
                Forms.Main.Invoke(new MethodInvoker(delegate { Accessor.OpenForm("Info"); }));
            else
                Accessor.OpenForm("Info", closeifopen: true);

            conditions = true;
        }
    }
}
