private static void LoadJsonFromShortcuts()
        {
            Config config     = ShortcutListArea.GetConfig();
            string configJson = Serializer.SerializeConfig(config);

            JsonViewManager.SetJson(configJson);
        }
Пример #2
0
 private static void RemoveAllConfirmation(bool isYes)
 {
     if (isYes)
     {
         ShortcutListArea.RemoveAllShortcuts();
         Wind.ValiationError.Visibility = Visibility.Collapsed;
     }
 }
 private void InitEvents()
 {
     TitleBarControl.InitEvents();
     TitleBarButtons.InitEvents();
     WelcomeCard.InitEvents();
     LowerMenuBar.InitEvents();
     ShortcutListArea.InitEvents();
     JsonViewManager.Init();
     Dialogs.SettingsDialog.InitEvents();
     Dialogs.MessageDialog.InitEvents();
     Dialogs.YesNoDialog.InitEvents();
 }
Пример #4
0
        public static void GenerateShortcutsButtonPressed(object sender, RoutedEventArgs args)
        {
            Config          config = ShortcutListArea.GetConfig();
            ValidationError err    = config.IsValid();

            if (err != null)
            {
                Wind.ValiationError.Visibility = Visibility.Visible;
                Wind.ValidationErrorText.Text  = $"Error: \"{err.Shortcut.Name}\" {err.Error}";
                return;
            }
            else
            {
                Wind.ValiationError.Visibility = Visibility.Collapsed;
            }

            Builder.Run(config);
        }
        private void InitJson()
        {
            string getJson         = JsonSerializer.GetLastShortcutsJson();
            Config shortcutsConfig = null;

            try
            {
                shortcutsConfig = Serializer.DeserializeConfig(getJson);
            }
            catch
            {
                shortcutsConfig = new Config();
                getJson         = Serializer.SerializeConfig(shortcutsConfig);
                JsonSerializer.SaveLastShortcutsJson(getJson);
            }

            JsonViewManager.SetJson(getJson);
            ShortcutListArea.LoadShortcuts(shortcutsConfig.Shortcuts);
        }
Пример #6
0
        private static void ResetJson(bool shouldReset)
        {
            if (shouldReset)
            {
                string getJson         = JsonSerializer.GetLastShortcutsJson();
                Config shortcutsConfig = null;

                try
                {
                    shortcutsConfig = Serializer.DeserializeConfig(getJson);
                }
                catch
                {
                    shortcutsConfig = new Config();
                    getJson         = Serializer.SerializeConfig(shortcutsConfig);
                    JsonSerializer.SaveLastShortcutsJson(getJson);
                }

                JsonViewManager.SetJson(getJson);
                ShortcutListArea.LoadShortcuts(shortcutsConfig.Shortcuts);
                Wind.ValiationError.Visibility = Visibility.Collapsed;
            }
        }
        public static void JsonButtonPressed(object sender, RoutedEventArgs args)
        {
            if (DialogManager.OpenDialogSession != null)
            {
                return;
            }

            if (inJsonView)
            {
                // Attempt to Deserialize Json
                string json   = Wind.textEditor.Text;
                Config config = null;
                try
                {
                    config = Serializer.DeserializeConfig(json);
                }
                catch (Exception e)
                {
                    Dialogs.MessageDialog.SetMessage("Json Error", e.Message);
                    DialogManager.Show(Structures.DialogTypes.MessageDialog);
                    return;
                }

                ShortcutListArea.LoadShortcuts(config.Shortcuts);
                Wind.JsonView.Visibility       = Visibility.Collapsed;
                Wind.NonJsonView.Visibility    = Visibility.Visible;
                Wind.ValiationError.Visibility = Visibility.Collapsed;
            }
            else
            {
                LoadJsonFromShortcuts();
                Wind.JsonView.Visibility    = Visibility.Visible;
                Wind.NonJsonView.Visibility = Visibility.Collapsed;
            }

            inJsonView = !inJsonView;
        }
Пример #8
0
 private void TestRunShortcut()
 {
     ShortcutListArea.TestRunShortcut(Shortcut, true);
 }
Пример #9
0
 private void DeleteShortcut()
 {
     ShortcutListArea.RemoveShortcut(this);
 }
Пример #10
0
 private void MoveDownShortcut()
 {
     ShortcutListArea.MoveDownShortcut(this);
 }
Пример #11
0
 private void DuplicateShortcut()
 {
     ShortcutListArea.DuplicateShortcut(this);
 }