private void SaveOptions(object sender, RoutedEventArgs e)
        {
            var newOptions = new AppOptions();

            if (JsonRadio.IsChecked.GetValueOrDefault())
            {
                newOptions.SaveStyle = SaveStyles.Json;
            }
            else
            {
                newOptions.SaveStyle = SaveStyles.Namespaced;
            }

            newOptions.PageSize            = Convert.ToInt32(PageSizeText.Text);
            newOptions.TruncateResultsOver = Convert.ToInt32(TruncateSizeText.Text);

            newOptions.DefaultPath = Config.DefaultPath;
            Config = newOptions;
            newOptions.ToDisk();
            DialogResult = true;
        }
예제 #2
0
        public MainWindow(string startupPath)
        {
            InitializeComponent();


            currentPath = startupPath;

            appOptions = AppOptions.FromDisk();

            if (!string.IsNullOrEmpty(startupPath))
            {
                appOptions.DefaultPath = currentPath;
                appOptions.ToDisk();
            }

            currentPath = appOptions.DefaultPath;
            pagingController.UpdatePageSize(appOptions.PageSize);


            RoutedCommand saveCommand = new RoutedCommand();

            saveCommand.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(saveCommand, Save));

            RoutedCommand refreshCommand = new RoutedCommand();

            refreshCommand.InputGestures.Add(new KeyGesture(Key.R, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(refreshCommand, Refresh));


            RoutedCommand deleteCommand = new RoutedCommand();

            deleteCommand.InputGestures.Add(new KeyGesture(Key.Delete, ModifierKeys.None));
            CommandBindings.Add(new CommandBinding(deleteCommand, DeleteItem));

            RoutedCommand renameCommand = new RoutedCommand();

            renameCommand.InputGestures.Add(new KeyGesture(Key.F2, ModifierKeys.None));
            CommandBindings.Add(new CommandBinding(renameCommand, RenameItem));

            RoutedCommand newCommand = new RoutedCommand();

            newCommand.InputGestures.Add(new KeyGesture(Key.A, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(newCommand, NewItem));

            RoutedCommand newLanguageCommand = new RoutedCommand();

            newLanguageCommand.InputGestures.Add(new KeyGesture(Key.L, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(newLanguageCommand, NewLanguage));

            RoutedCommand openFolderCommand = new RoutedCommand();

            openFolderCommand.InputGestures.Add(new KeyGesture(Key.O, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(openFolderCommand, OpenFolder));

            RoutedCommand nextPageCommand = new RoutedCommand();

            nextPageCommand.InputGestures.Add(new KeyGesture(Key.Right, ModifierKeys.Alt));
            CommandBindings.Add(new CommandBinding(nextPageCommand, NextPage));

            RoutedCommand previousPageCommand = new RoutedCommand();

            previousPageCommand.InputGestures.Add(new KeyGesture(Key.Left, ModifierKeys.Alt));
            CommandBindings.Add(new CommandBinding(previousPageCommand, PreviousPage));
        }