Beispiel #1
0
        public static void Populate()
        {
            if (Settings.Instance.Hotkeys == null)
            {
                Settings.Instance.Hotkeys = new List <HotkeyModel>();
            }

            if (Settings.Instance.Hotkeys.Count == 0)
            {
                Reset();
            }

            var nonReg = new List <Hotkey>();

            foreach (var model in Settings.Instance.Hotkeys)
            {
                var hotkey = new Hotkey(model);

                if (hotkey.IsActive && !hotkey.IsRegistered)
                {
                    nonReg.Add(hotkey);
                }

                Hotkeys.Add(hotkey);
            }

            if (nonReg.Count > 0)
            {
                var message =
                    "The following Hotkeys could not be registered:\nOther programs might be using them.\nTry changing them.\n\n";

                foreach (var hotkey in nonReg)
                {
                    message +=
                        $"{TranslationSource.Instance[ServiceProvider.GetDescriptionKey(hotkey.ServiceName)]} - {hotkey}\n\n";
                }
                ServiceProvider.MessageProvider.ShowError(message);
            }
        }