private BusinessObjects()
 {
     ScheduleManager = new ScheduleManager();
     HelpManager     = new HelpManager();
     OutputManager   = new OutputManager();
     ThemeManager    = new ThemeManager();
 }
示例#2
0
        public async override Task PerformAction(SocketReaction option)
        {
            switch (option.Emote.ToString())
            {
            case ReactionHandler.UP_STR:
                await CursorDown();     // these are swapped because I messed something up. They should remain swapped (CursorDown under the UP_STR case and vice versa)

                break;

            case ReactionHandler.DOWN_STR:
                await CursorUp();

                break;

            case ReactionHandler.SELECT_STR:
                if (HelpManager.GetDirList(Path, Admin, Mod).Length < 1)
                {
                    return;
                }
                await Select(HelpManager.GetDirList(Path, Admin, Mod)[Cursor]);

                break;

            case GoBack:
                await Back();

                break;
            }
        }
示例#3
0
    private void Awake()
    {
        Instance = this;

        if (File.Exists(Application.persistentDataPath + "/help_" + DataManager.saveVersion + ".txt"))
        {
            string[] helpNames = File.ReadAllLines(Application.persistentDataPath + "/help_" + DataManager.saveVersion + ".txt");
            try
            {
                CurrentStep = (TutorialStep)System.Enum.Parse(typeof(TutorialStep), helpNames[0]);
                for (int i = 1; i < helpNames.Length; i++)
                {
                    shownHelp.Add(helpNames[i]);
                }
            }
            catch (System.Exception)
            {
                shownHelp.AddRange(helpNames);
            }
        }
        if (firstStep > CurrentStep)
        {
            CurrentStep = firstStep;
        }
    }
示例#4
0
        private async Task Back()
        {
            Path      = HelpManager.BackDir(Path);
            FileCount = HelpManager.GetDirList(Path, Admin, Mod).Length;

            await UpdateEmbed();
        }
		private BusinessObjects()
		{
			ScheduleManager = new ScheduleManager();
			HelpManager = new HelpManager();
			OutputManager = new OutputManager();
			ThemeManager = new ThemeManager();
		}
示例#6
0
        /// <summary>
        /// Displays the help section for the current command
        /// </summary>
        internal void DisplayHelp()
        {
            DefaultCommandWarning();
            HelpManager help = new HelpManager(this);

            help.Output();
        }
    // Start is called before the first frame update
    void Start()
    {
        Escena = SceneManager.GetActiveScene().name;

        BtnAyuda  = Resources.Load <GameObject>("Prefabs/BtnPAyuda");
        MenuPausa = Resources.Load <GameObject>("Prefabs/Menu");
        //(GameObject)Resources.Load("Assets/Menu/Prefabs/Menu", typeof(GameObject)); ;
        comps = GetComponents <MonoBehaviour>();

        BA = Instantiate(BtnAyuda, new Vector2(-830, 240), Quaternion.identity) as GameObject;//280 -450
        BA.transform.SetParent(GameObject.Find("Canvas").transform, false);
        BtnID = BA.GetComponent <Button>();
        //Debug.Log(Escena);
        bool ExisteAyuda = GlobalVariables.ExisteAyuda;
        bool Aparezco    = true;

        if (GlobalVariables.Caso == 0 || GlobalVariables.ElFinal == true)
        {
            Aparezco = false;
        }

        if (ExisteAyuda && GlobalVariables.VecesAyuda == 1 && Aparezco)
        {
            string ayuda = HelpManager.Ask4Help();
            Label         = BA.GetComponentInChildren <Text>();
            Label.text    = "¡" + ayuda + " te ayudó!";
            Label.enabled = false;
        }
        else
        {
            BA.SetActive(false);
        }
    }
        private void ToolStripMenuItemHelp_Click(object sender, EventArgs e)
        {
            // We should only be here if one item is selected, we dont do multi-help
            if (GridViewAlerts.SelectedRows.Count != 1)
            {
                log.DebugFormat("Can only launch help for 1 alert at a time (Attempted to launch {0}). Launching for the clicked item.", GridViewAlerts.SelectedRows.Count);
            }

            DataGridViewRow clickedRow = FindAlertRow(sender as ToolStripMenuItem);

            if (clickedRow == null)
            {
                return;
            }

            Alert alert = (Alert)clickedRow.Tag;

            if (alert == null)
            {
                return;
            }

            if (alert.HelpID == null)
            {
                log.ErrorFormat("Attempted to launch help for alert {0} ({1}) but no helpID available. Not launching.", alert.Title, alert.uuid);
                return;
            }
            HelpManager.Launch(alert.HelpID);
        }
示例#9
0
 private void Hide()
 {
     HelpManager.Hide();
     Helping    = false;
     LastHelper = null;
     Inside     = false;
 }
    // Reiniciar el juego
    public void ResetGame()
    {
        GlobalVariables.lives  = 5;
        GlobalVariables.score  = 0;
        GlobalVariables.sumPos = -20;
        GlobalVariables.pairAnswerSlot.Clear();
        GlobalVariables.items.Clear();
        GlobalVariables.ExisteAyuda = false;
        GlobalVariables.VecesAyuda  = 1;
        GlobalVariables.ElFinal     = false;
        string Escena = SceneManager.GetActiveScene().name;

        int Rand = Random.Range(1, 11);

        while (Rand == GlobalVariables.Caso)
        {
            Rand = Random.Range(1, 11);
        }

        //
        //Rand = 1;
        //
        GameMind.setStarted(Rand);
        GameMind.saveData();
        GlobalVariables.Caso = Rand;
        HelpManager.ExisteAyuda(Rand.ToString());
        //Debug.Log("Nuevo Caso");
        //Debug.Log(Rand);
        //Debug.Log(SiguentePregunta);

        ProximaMission.SetActive(true);

        switch (Rand)
        {
        case 1: SiguentePregunta.text = "Mision 1: Reparar el rodillo dañado"; break;

        case 2: SiguentePregunta.text = "Mision 2: Inspeccionar avería de Acoplamiento"; break;

        case 3: SiguentePregunta.text = "Mision 3: Prevenir el sobrecalentamiento"; break;

        case 4: SiguentePregunta.text = "Mision 4: Inspeccionar los sensores de proximidad"; break;

        case 5: SiguentePregunta.text = "Mision 5: Inspeccionar sobrecarga de motor"; break;

        case 6: SiguentePregunta.text = "Mision 6: Inspeccionar niveles de aceite"; break;

        case 7: SiguentePregunta.text = "Mision 7: La emergencia PM10 "; break;

        case 8: SiguentePregunta.text = "Mision 8: El PM11 programado PM11"; break;

        case 9: SiguentePregunta.text = "Mision 9: Contestar aviso M3"; break;

        case 10: SiguentePregunta.text = "Mision 10:Contestar aviso M6"; break;

        default:
            break;
        }

        StartCoroutine(EsperarMin(Rand));
    }
示例#11
0
    public void JugarMisionIndex(int index)
    {
        StartCoroutine(EsperarMin(index));

        GlobalVariables.Caso = index;
        HelpManager.ExisteAyuda(index.ToString());

        /* TODO: Add animation to start of selection of case
         * switch (index)
         * {
         *  case 1: SiguentePregunta.text = "Mision 1: Reparar el rodillo dañado"; break;
         *  case 2: SiguentePregunta.text = "Mision 2: Inspeccionar avería de Acoplamiento"; break;
         *  case 3: SiguentePregunta.text = "Mision 3: Prevenir el sobrecalentamiento"; break;
         *  case 4: SiguentePregunta.text = "Mision 4: Inspeccionar los sensores de proximidad"; break;
         *  case 5: SiguentePregunta.text = "Mision 5: Inspeccionar sobrecarga de motor"; break;
         *  case 6: SiguentePregunta.text = "Mision 6: Inspeccionar niveles de aceite, "; break;
         *  case 7: SiguentePregunta.text = "Mision 7: La emergencia PM10 "; break;
         *  case 8: SiguentePregunta.text = "Mision 8: El PM11 programado PM11"; break;
         *  case 9: SiguentePregunta.text = "Mision 9: Contestar aviso M3"; break;
         *  case 10: SiguentePregunta.text = "Mision 10:Contestar aviso M6"; break;
         *
         *  default:
         *      break;
         * }
         */
    }
 private AppManager()
 {
     SlideManager          = new SlideManager();
     HelpManager           = new HelpManager();
     PowerPointManager     = new PowerPointManager <SlideTemplateViewerPowerPointHelper>();
     ImageResourcesManager = new ImageResourcesManager();
     TextResourcesManager  = new TextResourcesManager();
 }
示例#13
0
        internal AlfaManager()
        {
            this.TourManager  = new TourManager();
            this.HelpManager  = new HelpManager();
            this.BullyManager = new BullyManager();

            this.moduleWatch = new Stopwatch();
            this.moduleWatch.Start();
        }
示例#14
0
 public HelpEmbed(SocketCommandContext ctx, bool mod = false, bool admin = false)
 {
     AddMenuOptions(ReactionHandler.SELECT, ReactionHandler.UP, ReactionHandler.DOWN, new MenuOptionNode(GoBack, "Go back"));
     SetCtx(ctx);
     Path      = @"Help";
     Cursor    = 0;
     Admin     = admin;
     Mod       = mod;
     FileCount = HelpManager.GetDirList(Path, Admin, mod).Length;
 }
示例#15
0
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(this);
         throw new System.Exception("Attempted to create a second HelpManager Instance");
     }
     else
     {
         Instance = this;
     }
 }
    private void OnEnable()
    {
        if (mensajeBienvenida != null)
        {
            if (Database.getCurrentAchivements() == 0)
            {
                mensajeBienvenida.text = "¡Bonito día, " + GlobalVariables.username + "! Aún no has completado misiones a la perfección, ¡Intentalo, son 10 en total!";
            }
            else if (Database.getCurrentAchivements() == 1)
            {
                mensajeBienvenida.text = "¡Bonito día, " + GlobalVariables.username + "! Has completado a la perfección " + Database.getCurrentAchivements().ToString() + " misión de 10";
            }
            else if (Database.getCurrentAchivements() < 11 && Database.getCurrentAchivements() > 1)
            {
                mensajeBienvenida.text = "¡Bonito día, " + GlobalVariables.username + "! Has completado a la perfección " + Database.getCurrentAchivements().ToString() + " misiones de 10";
            }
            else
            {
                mensajeBienvenida.text = "¡Bonito día, " + GlobalVariables.username + "!";
            }
        }

        // mensajeBienvenida.text = "Bonito día, " + GlobalVariables.username + "! Te faltan ganar" + GlobalVariables.getTrophies().ToString() + " de 10 trofeos";

        // El checar que los botones sean presionados, y que pasa si lo son
        Jugar.onClick.AddListener(delegate {
            //Jugar.enabled = false;
            if (FirstClick)
            {
                FirstClick = false;
                if (GameMind.getTutorial() == true)
                {
                    int i = 1;
                    SiguentePregunta.text = "Mision 1: Reparar el rodillo dañado";
                    ProximaMission.SetActive(true);
                    StartCoroutine(EsperarMin(0));
                    GameMind.setStarted(i);
                    //GameMind.saveData();
                    HelpManager.ExisteAyuda(i.ToString());
                    GlobalVariables.Caso = i;
                }
                else
                {
                    JugarMision();
                }
            }
        });
        //Historial.onClick.AddListener(delegate { CambiarScene(""); });
        Trofeos.onClick.AddListener(delegate { CambiarScene("Achivements"); });
        Historial.onClick.AddListener(delegate { CambiarScene("Historial"); });
        Salir.onClick.AddListener(delegate { CambiarScene("No"); });
    }
示例#17
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != null)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
    public void JugarMision()
    {
        int Rand = Random.Range(1, 11);

        //-------------------------------------------------------------------------------
        //Aqui pueden modificarle para llegar a un Caso especial

        //Rand = 9;

        //-------------------------------------------------------------------------------
        //Ok, estas listo leecto?, porque nos pidieron que hicieramos un fix, que tomaria mucho rework a la hora de conectar
        //asi que estoy a punto de aventarme lo mas clandestino del mundo



        //Set mision as Started
        GameMind.setStarted(Rand);
        GameMind.saveData();
        HelpManager.ExisteAyuda(Rand.ToString());
        GlobalVariables.Caso = Rand;

        switch (Rand)
        {
        case 1: SiguentePregunta.text = "Mision 1: Reparar el rodillo dañado"; break;

        case 2: SiguentePregunta.text = "Mision 2: Inspeccionar avería de Acoplamiento"; break;

        case 3: SiguentePregunta.text = "Mision 3: Prevenir el sobrecalentamiento"; break;

        case 4: SiguentePregunta.text = "Mision 4: Inspeccionar los sensores de proximidad"; break;

        case 5: SiguentePregunta.text = "Mision 5: Inspeccionar sobrecarga de motor"; break;

        case 6: SiguentePregunta.text = "Mision 6: Inspeccionar niveles de aceite"; break;

        case 7: SiguentePregunta.text = "Mision 7: La emergencia PM10 "; break;

        case 8: SiguentePregunta.text = "Mision 8: El PM11 programado PM11"; break;

        case 9: SiguentePregunta.text = "Mision 9: Contestar aviso M3"; break;

        case 10: SiguentePregunta.text = "Mision 10:Contestar aviso M6"; break;

        default:
            break;
        }
        StartCoroutine(EsperarMin(Rand));
        ProximaMission.SetActive(true);
    }
示例#19
0
    void Start()
    {
        fm = GetComponent <FloorManager>();

        //Create Ground
        fm.Create();
        fm.Instantiate();

        arrowBase = GameObject.Find("ArrowBase");
        arrowBody = GameObject.Find("ArrowBody").GetComponent <LineRendererArrow>();
        arrowBase.SetActive(false);
        arrowBody.gameObject.SetActive(false);

        hm = gameObject.GetComponent <HelpManager>();
    }
示例#20
0
 void Awake()
 {
     instance = this;
     GetComponent <CanvasScaler>().referenceResolution = new Vector2(Screen.currentResolution.width, Screen.currentResolution.height);
     miniMap        = Instantiate(miniMap, transform);
     datePanel      = Instantiate(datePanel, transform);
     saveLoadPanel  = Instantiate(saveLoadPanel, transform);
     statisticPanel = Instantiate(statisticPanel, transform);
     gameMenu       = Instantiate(gameMenu, transform);
     codePanel      = Instantiate(codePanel, transform);
     // battlePanel = Instantiate(battlePanel, transform);
     provincePanel          = Instantiate(provincePanel, transform);
     armyPanel              = Instantiate(armyPanel, transform);
     HelpManager            = Instantiate(HelpManager, transform);
     saveLoadPanel.prevMenu = gameMenu.gameObject;
 }
        public void Init()
        {
            OutputManager.Init();
            PowerPointManager.Instance.SettingsChanged += (o, e) => OutputManager.UpdateColors();

            HelpManager.LoadHelpLinks();

            ThemeManager.Load();
            PowerPointManager.Instance.SettingsChanged += (o, e) => ThemeManager.Load();

            TabPageManager  = new TabPageManager(Core.AdSchedule.ResourceManager.Instance.TabsConfigFile);
            ActivityManager = ActivityManager.OpenStorage();
            Gallery1Manager = new GalleryManager(Core.AdSchedule.ResourceManager.Instance.Gallery1ConfigFile);
            Gallery2Manager = new GalleryManager(Core.AdSchedule.ResourceManager.Instance.Gallery2ConfigFile);
            RateCardManager = new RateCardManager(Core.Common.ResourceManager.Instance.RateCardFolder);
            RateCardManager.LoadRateCards();
        }
示例#22
0
        private BusinessObjects()
        {
            OutputManager            = new OutputManager();
            ScheduleManager          = new MediaScheduleManager();
            ScheduleTemplatesManager = new ScheduleTemplatesManager();
            SolutionsManager         = new SolutionsManager();
            SlideManager             = new SlideManager();
            HelpManager           = new HelpManager();
            ThemeManager          = new ThemeManager();
            ConfigManager         = new ConfigManager();
            TextResourcesManager  = new TextResourcesManager();
            ImageResourcesManager = new ImageResourcesManager();
            PowerPointManager     = new PowerPointManager <PowerPointSingletonProcessor>();
            BrowserManager        = new BrowserManager();
            IdleManager           = new ApplicationIdleManager();

            AdditionalInitializator = new AdditionalInitializationDispatcher();
        }
        public async Task Init()
        {
            await AppProfileManager.Instance.LoadProfile();

            await Business.Dashboard.Configuration.ResourceManager.Instance.Load();

            PowerPointManager.Init();

            MasterWizardManager.Instance.Load();
            await Business.Dashboard.Configuration.SettingsManager.Instance.LoadSettings();

            Business.Dashboard.Dictionaries.ListManager.Instance.Init();
            HelpManager.LoadHelpLinks();

            ActivityManager = ActivityManager.OpenStorage();
            ActivityManager.AddActivity(new UserActivity("Application started"));

            SetCultureSettings();
        }
示例#24
0
        /// <summary>
        /// Gets the text for the help embed based off of the list of directories passed in, and the cursor position
        /// </summary>
        /// <param name="dirs">The list of Directories</param>
        /// <param name="pos">The cursor position</param>
        /// <returns>The text for the embed</returns>
        private string GetDirText(string[] dirs, int pos)
        {
            if (dirs.Length == 0)
            {
                return("Nothing here.");
            }

            string dl = "";

            for (int i = 0; i < dirs.Length; i++)
            {
                if (!dirs[i].Contains('.'))
                {
                    if (i == pos)
                    {
                        dl += CustomEmotes.CursorAnimated;
                    }
                    else
                    {
                        dl += CustomEmotes.CursorBlankSpace;
                    }

                    // if it's a folder, make it bold
                    dl += $"**{HelpManager.StripExtraDirs(dirs[i])}**\n";
                }
                else
                {
                    if (i == pos)
                    {
                        dl += CustomEmotes.CursorAnimated;
                    }
                    else
                    {
                        dl += CustomEmotes.CursorBlankSpace;
                    }

                    // else it's a file (no extension)
                    dl += HelpManager.StripExtraDirs(dirs[i].Substring(0, dirs[i].LastIndexOf('.'))) + "\n"; //  add it and trim off the end
                }
            }

            return(dl.TrimEnd('\n'));
        }
示例#25
0
        private async Task Select(string dir)
        {
            if (FileCount == 0)
            {
                return;
            }

            Cursor = 0;
            Path   = HelpManager.SelectDir(Path, dir);
            if (!OnFile())
            {
                FileCount = HelpManager.GetDirList(Path, Admin, Mod).Length;
            }
            else
            {
                FileCount = 0;
            }

            await UpdateEmbed();
        }
        public async Task Init()
        {
            await AppProfileManager.Instance.LoadProfile();

            await Business.Dashboard.Configuration.ResourceManager.Instance.Load();

            PowerPointManager.Init();

            MasterWizardManager.Instance.Load();
            SettingsManager.Instance.LoadSharedSettings();
            SlideManager.LoadSlides(ResourceManager.Instance.SlideMastersFolder);

            HelpManager.LoadHelpLinks();

            TextResourcesManager.Load();
            ImageResourcesManager.Load();

            FormStyleManager = new FormStyleManager(Business.Dashboard.Configuration.ResourceManager.Instance.FormStyleConfigFile);

            ActivityManager = ActivityManager.OpenStorage();
            ActivityManager.AddActivity(new UserActivity("Application started"));
        }
示例#27
0
        /// <summary>
        /// Takes in the embed builder and adds the formatted help page.
        /// </summary>
        /// <param name="eb">The embed builder</param>
        private void AddHelpPage(EmbedBuilder eb)
        {
            if (BotUtils.GetFileExtension(Path) == "json")
            {
                // Interpret JSON
                HelpPageNode page = HelpManager.GetNode(Path);

                eb.AddField("Command Name", $"{page.Name}");

                if (page.Alias.Length > 0)
                {
                    string alias = "!" + page.Alias[0];

                    for (int i = 1; i < page.Alias.Length; i++)
                    {
                        alias += $", !{page.Alias[i]}";
                    }

                    eb.AddField("Aliases", alias);
                }

                eb.AddField("Usage", page.Usage);
                eb.AddField("Description", page.Description);

                if (!string.IsNullOrWhiteSpace(page.GifURL))
                {
                    eb.AddField("Example:", BotUtils.ZeroSpace);
                    eb.WithImageUrl(page.GifURL);
                }
            }
            else
            {
                // Assume it's text. All other files are ignored anyways
                string text = FileManager.ReadFullFile(Path);
                eb.AddField(BotUtils.ZeroSpace, text);
            }
        }
示例#28
0
 private void frmSAVI_HelpButtonClicked(object sender, CancelEventArgs e)
 {
     HelpManager.ShowHelp(this);
 }
示例#29
0
 private void Statistics_HelpButtonClicked(object sender, CancelEventArgs e)
 {
     HelpManager.ManageHelpPanel(this, e);
 }
示例#30
0
        private void Help(string command)
        {
            Console.ResetColor();

            Console.Write(HelpManager.GetHelp(command));
        }
示例#31
0
        static public void Main(string[] Args)
        {
            //Upgrade settings
            Assembly a                = Assembly.GetExecutingAssembly();
            Version  appVersion       = a.GetName().Version;
            string   appVersionString = appVersion.ToString();

            log.DebugFormat("Application version of new settings {0}", appVersionString);

            try
            {
                if (Properties.Settings.Default.ApplicationVersion != appVersion.ToString())
                {
                    log.Debug("Upgrading settings...");
                    Properties.Settings.Default.Upgrade();

                    // if program's hash has changed (e.g. by upgrading to .NET 4.0), then Upgrade() doesn't import the previous application settings
                    // because it cannot locate a previous user.config file. In this case a new user.config file is created with the default settings.
                    // We will try and find a config file from a previous installation and update the settings from it
                    if (Properties.Settings.Default.ApplicationVersion == "" && Properties.Settings.Default.DoUpgrade)
                    {
                        SettingsUpdate.Update();
                    }
                    log.DebugFormat("Settings upgraded from '{0}' to '{1}'", Properties.Settings.Default.ApplicationVersion, appVersionString);
                    Properties.Settings.Default.ApplicationVersion = appVersionString;
                    Settings.TrySaveSettings();
                }
            }
            catch (ConfigurationErrorsException ex)
            {
                log.Error("Could not load settings.", ex);
                var msg = string.Format("{0}\n\n{1}", Messages.MESSAGEBOX_LOAD_CORRUPTED_TITLE,
                                        string.Format(Messages.MESSAGEBOX_LOAD_CORRUPTED, Settings.GetUserConfigPath()));
                using (var dlg = new ErrorDialog(msg)
                {
                    StartPosition = FormStartPosition.CenterScreen,
                    //For reasons I do not fully comprehend at the moment, the runtime
                    //overrides the above StartPosition with WindowsDefaultPosition if
                    //ShowInTaskbar is false. However it's a good idea anyway to show it
                    //in the taskbar since the main form is not launched at this point.
                    ShowInTaskbar = true
                })
                {
                    dlg.ShowDialog();
                }
                Application.Exit();
                return;
            }

            // Reset statics, because XenAdminTests likes to call Main() twice.
            TestExceptionString = null;
            Exiting             = false;
            // Clear XenConnections and History so static classes like OtherConfigAndTagsWatcher
            // listening to changes still work when Main is called more than once.
            ConnectionsManager.XenConnections.Clear();
            ConnectionsManager.History.Clear();

            Search.InitSearch(BrandManager.ExtensionSearch);
            TreeSearch.InitSearch();

            AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.ThreadException -= Application_ThreadException;
            Application.ThreadException += Application_ThreadException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                if (SystemInformation.FontSmoothingType == 2) // ClearType
                {
                    TransparentUsually = SystemColors.Window;
                }
            }
            catch (NotSupportedException)
            {
                // Leave TransparentUsually == Color.Transparent.  This is an old platform
                // without FontSmoothingType support.
            }

            switch (Environment.OSVersion.Version.Major)
            {
            case 6:     // Vista, 2K8, Win7.
                if (Application.RenderWithVisualStyles)
                {
                    // Vista, Win7 with styles.
                    TitleBarStartColor      = Color.FromArgb(242, 242, 242);
                    TitleBarEndColor        = Color.FromArgb(207, 207, 207);
                    TitleBarBorderColor     = Color.FromArgb(160, 160, 160);
                    TitleBarForeColor       = Color.FromArgb(60, 60, 60);
                    HeaderGradientForeColor = Color.White;
                    HeaderGradientFont      = new Font(DefaultFont.FontFamily, 11.25f);
                    TabbedDialogHeaderFont  = HeaderGradientFont;
                    TabPageRowBorder        = Color.Gainsboro;
                    TabPageRowHeader        = Color.WhiteSmoke;
                }
                else
                {
                    // 2K8 and Vista, Win7 without styles.
                    TitleBarStartColor      = ProfessionalColors.OverflowButtonGradientBegin;
                    TitleBarEndColor        = ProfessionalColors.OverflowButtonGradientEnd;
                    TitleBarBorderColor     = TitleBarEndColor;
                    TitleBarForeColor       = SystemColors.ControlText;
                    HeaderGradientForeColor = SystemColors.ControlText;
                    HeaderGradientFont      = new Font(DefaultFont.FontFamily, DefaultFont.Size + 1f, FontStyle.Bold);
                    TabbedDialogHeaderFont  = HeaderGradientFont;
                    TabPageRowBorder        = Color.DarkGray;
                    TabPageRowHeader        = Color.Silver;
                }
                break;

            default:
                TitleBarStartColor      = ProfessionalColors.OverflowButtonGradientBegin;
                TitleBarEndColor        = ProfessionalColors.OverflowButtonGradientEnd;
                TitleBarBorderColor     = TitleBarEndColor;
                TitleBarForeColor       = SystemColors.ControlText;
                HeaderGradientForeColor = Application.RenderWithVisualStyles ? Color.White : SystemColors.ControlText;
                HeaderGradientFont      = new Font(DefaultFont.FontFamily, DefaultFont.Size + 1f, FontStyle.Bold);
                TabbedDialogHeaderFont  = new Font(DefaultFont.FontFamily, DefaultFont.Size + 1.75f, FontStyle.Bold);
                TabPageRowBorder        = Color.DarkGray;
                TabPageRowHeader        = Color.Silver;
                break;
            }

            // Force the current culture, to make the layout the same whatever the culture of the underlying OS (CA-46983).
            Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture = new CultureInfo(InvisibleMessages.LOCALE, false);

            if (string.IsNullOrEmpty(Thread.CurrentThread.Name))
            {
                Thread.CurrentThread.Name = "Main program thread";
            }

            ServicePointManager.DefaultConnectionLimit = 20;
            ServicePointManager.ServerCertificateValidationCallback = SSL.ValidateServerCertificate;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            Session.UserAgent = string.Format("XenCenter/{0}", ClientVersion());
            RememberProxyAuthenticationModules();
            ReconfigureConnectionSettings();

            log.Info("Application started");
            logSystemDetails();
            Settings.Log();

            // Remove the '--wait' argument, which may have been passed to the splash screen
            var sanitizedArgs = Args.Where(ar => ar != "--wait").ToArray();

            var firstArgType = ParseFileArgs(sanitizedArgs, out string[] tailArgs);

            if (firstArgType == ArgType.Passwords)
            {
                try
                {
                    PasswordsRequest.HandleRequest(tailArgs[0]);
                }
                catch (Exception exn)
                {
                    log.Fatal(exn, exn);
                }

                Application.Exit();
                return;
            }

            try
            {
                ConnectPipe();
            }
            catch (Win32Exception exn)
            {
                log.Error("Creating named pipe failed. Continuing to launch XenCenter.", exn);
            }

            Application.ApplicationExit -= Application_ApplicationExit;
            Application.ApplicationExit += Application_ApplicationExit;

            //set the help version before launching the main window;
            //the call starts a different thread so it won't delay the main window launch;
            //in most cases it is expected to have returned by the time the users request help;
            //if they do before it has returned, the thread requesting help will wait for it
            HelpManager.SetHelpVersion();

            MainWindow mainWindow = new MainWindow(firstArgType, tailArgs);

            Application.Run(mainWindow);

            log.Info("Application main thread exited");
        }