Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8131140cb0 | ||
|
|
304314230c | ||
|
|
0ce605f122 | ||
|
|
d4aadd7dd4 | ||
|
|
3cf3e0a330 | ||
|
|
ff2cfc36b6 |
No files matched your search
@@ -23,7 +23,7 @@ namespace FluentTerminal.App.Services.Test
|
|||||||
public void ShowCreateKeyBindingDialog_Default_UsesCreateKeyBindingDialog()
|
public void ShowCreateKeyBindingDialog_Default_UsesCreateKeyBindingDialog()
|
||||||
{
|
{
|
||||||
var createKeyBindingDialog = new Mock<ICreateKeyBindingDialog>();
|
var createKeyBindingDialog = new Mock<ICreateKeyBindingDialog>();
|
||||||
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, Mock.Of<IMessageDialog>, () => createKeyBindingDialog.Object);
|
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, Mock.Of<IMessageDialog>, () => createKeyBindingDialog.Object, Mock.Of<IInputDialog>);
|
||||||
|
|
||||||
dialogService.ShowCreateKeyBindingDialog();
|
dialogService.ShowCreateKeyBindingDialog();
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ namespace FluentTerminal.App.Services.Test
|
|||||||
var title = string.Empty;
|
var title = string.Empty;
|
||||||
var content = _fixture.Create<string>();
|
var content = _fixture.Create<string>();
|
||||||
var buttons = _fixture.CreateMany<DialogButton>(2);
|
var buttons = _fixture.CreateMany<DialogButton>(2);
|
||||||
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, Mock.Of<IMessageDialog>, Mock.Of<ICreateKeyBindingDialog>);
|
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, Mock.Of<IMessageDialog>, Mock.Of<ICreateKeyBindingDialog>, Mock.Of<IInputDialog>);
|
||||||
|
|
||||||
Func<Task<DialogButton>> showMessageDialogAsnyc = () => dialogService.ShowMessageDialogAsnyc(title, content, buttons.ElementAt(0), buttons.ElementAt(1));
|
Func<Task<DialogButton>> showMessageDialogAsnyc = () => dialogService.ShowMessageDialogAsnyc(title, content, buttons.ElementAt(0), buttons.ElementAt(1));
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ namespace FluentTerminal.App.Services.Test
|
|||||||
var title = _fixture.Create<string>();
|
var title = _fixture.Create<string>();
|
||||||
var content = string.Empty;
|
var content = string.Empty;
|
||||||
var buttons = _fixture.CreateMany<DialogButton>(2);
|
var buttons = _fixture.CreateMany<DialogButton>(2);
|
||||||
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, Mock.Of<IMessageDialog>, Mock.Of<ICreateKeyBindingDialog>);
|
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, Mock.Of<IMessageDialog>, Mock.Of<ICreateKeyBindingDialog>, Mock.Of<IInputDialog>);
|
||||||
|
|
||||||
Func<Task<DialogButton>> showMessageDialogAsnyc = () => dialogService.ShowMessageDialogAsnyc(title, content, buttons.ElementAt(0), buttons.ElementAt(1));
|
Func<Task<DialogButton>> showMessageDialogAsnyc = () => dialogService.ShowMessageDialogAsnyc(title, content, buttons.ElementAt(0), buttons.ElementAt(1));
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ namespace FluentTerminal.App.Services.Test
|
|||||||
{
|
{
|
||||||
var title = _fixture.Create<string>();
|
var title = _fixture.Create<string>();
|
||||||
var content = _fixture.Create<string>();
|
var content = _fixture.Create<string>();
|
||||||
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, Mock.Of<IMessageDialog>, Mock.Of<ICreateKeyBindingDialog>);
|
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, Mock.Of<IMessageDialog>, Mock.Of<ICreateKeyBindingDialog>, Mock.Of<IInputDialog>);
|
||||||
|
|
||||||
Func<Task<DialogButton>> showMessageDialogAsnyc = () => dialogService.ShowMessageDialogAsnyc(title, content);
|
Func<Task<DialogButton>> showMessageDialogAsnyc = () => dialogService.ShowMessageDialogAsnyc(title, content);
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ namespace FluentTerminal.App.Services.Test
|
|||||||
var content = _fixture.Create<string>();
|
var content = _fixture.Create<string>();
|
||||||
var buttons = _fixture.CreateMany<DialogButton>(2);
|
var buttons = _fixture.CreateMany<DialogButton>(2);
|
||||||
var messageDialog = new Mock<IMessageDialog>();
|
var messageDialog = new Mock<IMessageDialog>();
|
||||||
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, () => messageDialog.Object, Mock.Of<ICreateKeyBindingDialog>);
|
var dialogService = new DialogService(Mock.Of<IShellProfileSelectionDialog>, () => messageDialog.Object, Mock.Of<ICreateKeyBindingDialog>, Mock.Of<IInputDialog>);
|
||||||
|
|
||||||
dialogService.ShowMessageDialogAsnyc(title, content, buttons.ElementAt(0), buttons.ElementAt(1));
|
dialogService.ShowMessageDialogAsnyc(title, content, buttons.ElementAt(0), buttons.ElementAt(1));
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ namespace FluentTerminal.App.Services.Test
|
|||||||
public void ShowProfileSelectionDialogAsync_Default_UsesShellProfileSelectionDialog()
|
public void ShowProfileSelectionDialogAsync_Default_UsesShellProfileSelectionDialog()
|
||||||
{
|
{
|
||||||
var shellProfileSelectionDialog = new Mock<IShellProfileSelectionDialog>();
|
var shellProfileSelectionDialog = new Mock<IShellProfileSelectionDialog>();
|
||||||
var dialogService = new DialogService(() => shellProfileSelectionDialog.Object, Mock.Of<IMessageDialog>, Mock.Of<ICreateKeyBindingDialog>);
|
var dialogService = new DialogService(() => shellProfileSelectionDialog.Object, Mock.Of<IMessageDialog>, Mock.Of<ICreateKeyBindingDialog>, Mock.Of<IInputDialog>);
|
||||||
|
|
||||||
dialogService.ShowProfileSelectionDialogAsync();
|
dialogService.ShowProfileSelectionDialogAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FluentTerminal.App.Services.Dialogs
|
||||||
|
{
|
||||||
|
public interface IInputDialog
|
||||||
|
{
|
||||||
|
void SetTitle(string title);
|
||||||
|
Task<string> GetInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,5 +16,6 @@ namespace FluentTerminal.App.Services
|
|||||||
Task<ShellProfile> ShowProfileSelectionDialogAsync();
|
Task<ShellProfile> ShowProfileSelectionDialogAsync();
|
||||||
|
|
||||||
Task<KeyBinding> ShowCreateKeyBindingDialog();
|
Task<KeyBinding> ShowCreateKeyBindingDialog();
|
||||||
|
Task<string> ShowInputDialogAsync(string title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,12 +10,14 @@ namespace FluentTerminal.App.Services.Implementation
|
|||||||
private readonly Func<IShellProfileSelectionDialog> _shellProfileSelectionDialogFactory;
|
private readonly Func<IShellProfileSelectionDialog> _shellProfileSelectionDialogFactory;
|
||||||
private readonly Func<IMessageDialog> _messageDialogFactory;
|
private readonly Func<IMessageDialog> _messageDialogFactory;
|
||||||
private readonly Func<ICreateKeyBindingDialog> _createKeyBindingDialogFactory;
|
private readonly Func<ICreateKeyBindingDialog> _createKeyBindingDialogFactory;
|
||||||
|
private readonly Func<IInputDialog> _inputDialogFactory;
|
||||||
|
|
||||||
public DialogService(Func<IShellProfileSelectionDialog> shellProfileSelectionDialogFactory, Func<IMessageDialog> messageDialogFactory, Func<ICreateKeyBindingDialog> createKeyBindingDialogFactory)
|
public DialogService(Func<IShellProfileSelectionDialog> shellProfileSelectionDialogFactory, Func<IMessageDialog> messageDialogFactory, Func<ICreateKeyBindingDialog> createKeyBindingDialogFactory, Func<IInputDialog> inputDialogFactory)
|
||||||
{
|
{
|
||||||
_shellProfileSelectionDialogFactory = shellProfileSelectionDialogFactory;
|
_shellProfileSelectionDialogFactory = shellProfileSelectionDialogFactory;
|
||||||
_messageDialogFactory = messageDialogFactory;
|
_messageDialogFactory = messageDialogFactory;
|
||||||
_createKeyBindingDialogFactory = createKeyBindingDialogFactory;
|
_createKeyBindingDialogFactory = createKeyBindingDialogFactory;
|
||||||
|
_inputDialogFactory = inputDialogFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<KeyBinding> ShowCreateKeyBindingDialog()
|
public Task<KeyBinding> ShowCreateKeyBindingDialog()
|
||||||
@@ -54,6 +56,14 @@ namespace FluentTerminal.App.Services.Implementation
|
|||||||
return dialog.ShowAsync();
|
return dialog.ShowAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<string> ShowInputDialogAsync(string title)
|
||||||
|
{
|
||||||
|
var dialog = _inputDialogFactory.Invoke();
|
||||||
|
dialog.SetTitle(title);
|
||||||
|
|
||||||
|
return dialog.GetInput();
|
||||||
|
}
|
||||||
|
|
||||||
public Task<ShellProfile> ShowProfileSelectionDialogAsync()
|
public Task<ShellProfile> ShowProfileSelectionDialogAsync()
|
||||||
{
|
{
|
||||||
var dialog = _shellProfileSelectionDialogFactory();
|
var dialog = _shellProfileSelectionDialogFactory();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace FluentTerminal.App.ViewModels.Settings
|
|||||||
|
|
||||||
CreateThemeCommand = new RelayCommand(CreateTheme);
|
CreateThemeCommand = new RelayCommand(CreateTheme);
|
||||||
ImportThemeCommand = new RelayCommand(ImportTheme);
|
ImportThemeCommand = new RelayCommand(ImportTheme);
|
||||||
|
CloneCommand = new RelayCommand<ThemeViewModel>(CloneTheme);
|
||||||
|
|
||||||
_settingsService.TerminalOptionsChanged += OnTerminalOptionsChanged;
|
_settingsService.TerminalOptionsChanged += OnTerminalOptionsChanged;
|
||||||
|
|
||||||
@@ -55,6 +56,7 @@ namespace FluentTerminal.App.ViewModels.Settings
|
|||||||
|
|
||||||
public RelayCommand CreateThemeCommand { get; }
|
public RelayCommand CreateThemeCommand { get; }
|
||||||
public RelayCommand ImportThemeCommand { get; }
|
public RelayCommand ImportThemeCommand { get; }
|
||||||
|
public RelayCommand<ThemeViewModel> CloneCommand { get; set; }
|
||||||
|
|
||||||
public double BackgroundOpacity
|
public double BackgroundOpacity
|
||||||
{
|
{
|
||||||
@@ -81,6 +83,18 @@ namespace FluentTerminal.App.ViewModels.Settings
|
|||||||
|
|
||||||
public ObservableCollection<ThemeViewModel> Themes { get; } = new ObservableCollection<ThemeViewModel>();
|
public ObservableCollection<ThemeViewModel> Themes { get; } = new ObservableCollection<ThemeViewModel>();
|
||||||
|
|
||||||
|
private void CloneTheme(ThemeViewModel theme)
|
||||||
|
{
|
||||||
|
var cloned = new TerminalTheme(theme.Model)
|
||||||
|
{
|
||||||
|
Id = Guid.NewGuid(),
|
||||||
|
PreInstalled = false,
|
||||||
|
Name = $"Copy of {theme.Name}"
|
||||||
|
};
|
||||||
|
|
||||||
|
AddTheme(cloned);
|
||||||
|
}
|
||||||
|
|
||||||
private void CreateTheme()
|
private void CreateTheme()
|
||||||
{
|
{
|
||||||
var defaultTheme = _settingsService.GetTheme(_defaultValueProvider.GetDefaultThemeId());
|
var defaultTheme = _settingsService.GetTheme(_defaultValueProvider.GetDefaultThemeId());
|
||||||
@@ -92,13 +106,7 @@ namespace FluentTerminal.App.ViewModels.Settings
|
|||||||
Colors = new TerminalColors(defaultTheme.Colors)
|
Colors = new TerminalColors(defaultTheme.Colors)
|
||||||
};
|
};
|
||||||
|
|
||||||
_settingsService.SaveTheme(theme, true);
|
AddTheme(theme);
|
||||||
|
|
||||||
var viewModel = new ThemeViewModel(theme, _settingsService, _dialogService, _fileSystemService);
|
|
||||||
viewModel.Activated += OnThemeActivated;
|
|
||||||
viewModel.Deleted += OnThemeDeleted;
|
|
||||||
Themes.Add(viewModel);
|
|
||||||
SelectedTheme = viewModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ImportTheme()
|
private async void ImportTheme()
|
||||||
@@ -118,13 +126,7 @@ namespace FluentTerminal.App.ViewModels.Settings
|
|||||||
{
|
{
|
||||||
var theme = await parser.Parse(file.Name, file.Content).ConfigureAwait(true);
|
var theme = await parser.Parse(file.Name, file.Content).ConfigureAwait(true);
|
||||||
|
|
||||||
_settingsService.SaveTheme(theme, true);
|
AddTheme(theme);
|
||||||
|
|
||||||
var viewModel = new ThemeViewModel(theme, _settingsService, _dialogService, _fileSystemService);
|
|
||||||
viewModel.Activated += OnThemeActivated;
|
|
||||||
viewModel.Deleted += OnThemeDeleted;
|
|
||||||
Themes.Add(viewModel);
|
|
||||||
SelectedTheme = viewModel;
|
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
@@ -133,6 +135,17 @@ namespace FluentTerminal.App.ViewModels.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddTheme(TerminalTheme theme)
|
||||||
|
{
|
||||||
|
_settingsService.SaveTheme(theme, true);
|
||||||
|
|
||||||
|
var viewModel = new ThemeViewModel(theme, _settingsService, _dialogService, _fileSystemService);
|
||||||
|
viewModel.Activated += OnThemeActivated;
|
||||||
|
viewModel.Deleted += OnThemeDeleted;
|
||||||
|
Themes.Add(viewModel);
|
||||||
|
SelectedTheme = viewModel;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnThemeActivated(object sender, EventArgs e)
|
private void OnThemeActivated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is ThemeViewModel activatedTheme)
|
if (sender is ThemeViewModel activatedTheme)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Fleck;
|
using Fleck;
|
||||||
using FluentTerminal.App.Services;
|
using FluentTerminal.App.Services;
|
||||||
|
using FluentTerminal.App.ViewModels.Infrastructure;
|
||||||
using FluentTerminal.Models;
|
using FluentTerminal.Models;
|
||||||
using FluentTerminal.Models.Enums;
|
using FluentTerminal.Models.Enums;
|
||||||
using GalaSoft.MvvmLight;
|
using GalaSoft.MvvmLight;
|
||||||
@@ -77,6 +78,7 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
FindPreviousCommand = new RelayCommand(async () => await FindPrevious().ConfigureAwait(false));
|
FindPreviousCommand = new RelayCommand(async () => await FindPrevious().ConfigureAwait(false));
|
||||||
CloseSearchPanelCommand = new RelayCommand(CloseSearchPanel);
|
CloseSearchPanelCommand = new RelayCommand(CloseSearchPanel);
|
||||||
SelectTabThemeCommand = new RelayCommand<string>(SelectTabTheme);
|
SelectTabThemeCommand = new RelayCommand<string>(SelectTabTheme);
|
||||||
|
EditTitleCommand = new AsyncCommand(EditTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public event EventHandler Closed;
|
public event EventHandler Closed;
|
||||||
@@ -108,6 +110,8 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
|
|
||||||
public RelayCommand FindPreviousCommand { get; }
|
public RelayCommand FindPreviousCommand { get; }
|
||||||
|
|
||||||
|
public IAsyncCommand EditTitleCommand { get; }
|
||||||
|
|
||||||
public bool Initialized { get; private set; }
|
public bool Initialized { get; private set; }
|
||||||
|
|
||||||
public bool IsSelected
|
public bool IsSelected
|
||||||
@@ -402,6 +406,15 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
TabTheme = TabThemes.FirstOrDefault(t => t.Name == name);
|
TabTheme = TabThemes.FirstOrDefault(t => t.Name == name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task EditTitle()
|
||||||
|
{
|
||||||
|
var result = await _dialogService.ShowInputDialogAsync("Edit Title");
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
Title = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task TryClose()
|
private async Task TryClose()
|
||||||
{
|
{
|
||||||
if (ApplicationSettings.ConfirmClosingTabs)
|
if (ApplicationSettings.ConfirmClosingTabs)
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
private string _name;
|
private string _name;
|
||||||
private string _red;
|
private string _red;
|
||||||
private string _selection;
|
private string _selection;
|
||||||
private readonly TerminalTheme _theme;
|
|
||||||
private string _white;
|
private string _white;
|
||||||
private string _yellow;
|
private string _yellow;
|
||||||
private readonly IFileSystemService _fileSystemService;
|
private readonly IFileSystemService _fileSystemService;
|
||||||
@@ -49,38 +48,38 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
|
|
||||||
public ThemeViewModel(TerminalTheme theme, ISettingsService settingsService, IDialogService dialogService, IFileSystemService fileSystemService)
|
public ThemeViewModel(TerminalTheme theme, ISettingsService settingsService, IDialogService dialogService, IFileSystemService fileSystemService)
|
||||||
{
|
{
|
||||||
_theme = theme;
|
Model = theme;
|
||||||
_settingsService = settingsService;
|
_settingsService = settingsService;
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
_fileSystemService = fileSystemService;
|
_fileSystemService = fileSystemService;
|
||||||
|
|
||||||
Name = _theme.Name;
|
Name = Model.Name;
|
||||||
Author = _theme.Author;
|
Author = Model.Author;
|
||||||
Id = _theme.Id;
|
Id = Model.Id;
|
||||||
|
|
||||||
Black = _theme.Colors.Black;
|
Black = Model.Colors.Black;
|
||||||
Red = _theme.Colors.Red;
|
Red = Model.Colors.Red;
|
||||||
Green = _theme.Colors.Green;
|
Green = Model.Colors.Green;
|
||||||
Yellow = _theme.Colors.Yellow;
|
Yellow = Model.Colors.Yellow;
|
||||||
Blue = _theme.Colors.Blue;
|
Blue = Model.Colors.Blue;
|
||||||
Magenta = _theme.Colors.Magenta;
|
Magenta = Model.Colors.Magenta;
|
||||||
Cyan = _theme.Colors.Cyan;
|
Cyan = Model.Colors.Cyan;
|
||||||
White = _theme.Colors.White;
|
White = Model.Colors.White;
|
||||||
|
|
||||||
BrightBlack = _theme.Colors.BrightBlack;
|
BrightBlack = Model.Colors.BrightBlack;
|
||||||
BrightRed = _theme.Colors.BrightRed;
|
BrightRed = Model.Colors.BrightRed;
|
||||||
BrightGreen = _theme.Colors.BrightGreen;
|
BrightGreen = Model.Colors.BrightGreen;
|
||||||
BrightYellow = _theme.Colors.BrightYellow;
|
BrightYellow = Model.Colors.BrightYellow;
|
||||||
BrightBlue = _theme.Colors.BrightBlue;
|
BrightBlue = Model.Colors.BrightBlue;
|
||||||
BrightMagenta = _theme.Colors.BrightMagenta;
|
BrightMagenta = Model.Colors.BrightMagenta;
|
||||||
BrightCyan = _theme.Colors.BrightCyan;
|
BrightCyan = Model.Colors.BrightCyan;
|
||||||
BrightWhite = _theme.Colors.BrightWhite;
|
BrightWhite = Model.Colors.BrightWhite;
|
||||||
|
|
||||||
Background = _theme.Colors.Background;
|
Background = Model.Colors.Background;
|
||||||
Foreground = _theme.Colors.Foreground;
|
Foreground = Model.Colors.Foreground;
|
||||||
Cursor = _theme.Colors.Cursor;
|
Cursor = Model.Colors.Cursor;
|
||||||
CursorAccent = _theme.Colors.CursorAccent;
|
CursorAccent = Model.Colors.CursorAccent;
|
||||||
Selection = _theme.Colors.Selection;
|
Selection = Model.Colors.Selection;
|
||||||
|
|
||||||
SetActiveCommand = new RelayCommand(SetActive);
|
SetActiveCommand = new RelayCommand(SetActive);
|
||||||
DeleteCommand = new RelayCommand(async () => await Delete().ConfigureAwait(false), NotPreInstalled);
|
DeleteCommand = new RelayCommand(async () => await Delete().ConfigureAwait(false), NotPreInstalled);
|
||||||
@@ -94,6 +93,8 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
|
|
||||||
public event EventHandler Deleted;
|
public event EventHandler Deleted;
|
||||||
|
|
||||||
|
public TerminalTheme Model { get; }
|
||||||
|
|
||||||
public string Author
|
public string Author
|
||||||
{
|
{
|
||||||
get => _author;
|
get => _author;
|
||||||
@@ -268,34 +269,34 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
|
|
||||||
public void SaveChanges()
|
public void SaveChanges()
|
||||||
{
|
{
|
||||||
_theme.Name = Name;
|
Model.Name = Name;
|
||||||
_theme.Author = Author;
|
Model.Author = Author;
|
||||||
|
|
||||||
_theme.Colors.Black = Black;
|
Model.Colors.Black = Black;
|
||||||
_theme.Colors.Red = Red;
|
Model.Colors.Red = Red;
|
||||||
_theme.Colors.Green = Green;
|
Model.Colors.Green = Green;
|
||||||
_theme.Colors.Yellow = Yellow;
|
Model.Colors.Yellow = Yellow;
|
||||||
_theme.Colors.Blue = Blue;
|
Model.Colors.Blue = Blue;
|
||||||
_theme.Colors.Magenta = Magenta;
|
Model.Colors.Magenta = Magenta;
|
||||||
_theme.Colors.Cyan = Cyan;
|
Model.Colors.Cyan = Cyan;
|
||||||
_theme.Colors.White = White;
|
Model.Colors.White = White;
|
||||||
|
|
||||||
_theme.Colors.BrightBlack = BrightBlack;
|
Model.Colors.BrightBlack = BrightBlack;
|
||||||
_theme.Colors.BrightRed = BrightRed;
|
Model.Colors.BrightRed = BrightRed;
|
||||||
_theme.Colors.BrightGreen = BrightGreen;
|
Model.Colors.BrightGreen = BrightGreen;
|
||||||
_theme.Colors.BrightYellow = BrightYellow;
|
Model.Colors.BrightYellow = BrightYellow;
|
||||||
_theme.Colors.BrightBlue = BrightBlue;
|
Model.Colors.BrightBlue = BrightBlue;
|
||||||
_theme.Colors.BrightMagenta = BrightMagenta;
|
Model.Colors.BrightMagenta = BrightMagenta;
|
||||||
_theme.Colors.BrightCyan = BrightCyan;
|
Model.Colors.BrightCyan = BrightCyan;
|
||||||
_theme.Colors.BrightWhite = BrightWhite;
|
Model.Colors.BrightWhite = BrightWhite;
|
||||||
|
|
||||||
_theme.Colors.Background = Background;
|
Model.Colors.Background = Background;
|
||||||
_theme.Colors.Foreground = Foreground;
|
Model.Colors.Foreground = Foreground;
|
||||||
_theme.Colors.Cursor = Cursor;
|
Model.Colors.Cursor = Cursor;
|
||||||
_theme.Colors.CursorAccent = CursorAccent;
|
Model.Colors.CursorAccent = CursorAccent;
|
||||||
_theme.Colors.Selection = Selection;
|
Model.Colors.Selection = Selection;
|
||||||
|
|
||||||
_settingsService.SaveTheme(_theme);
|
_settingsService.SaveTheme(Model);
|
||||||
|
|
||||||
InEditMode = false;
|
InEditMode = false;
|
||||||
}
|
}
|
||||||
@@ -339,7 +340,7 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
|
|
||||||
private bool NotPreInstalled()
|
private bool NotPreInstalled()
|
||||||
{
|
{
|
||||||
return !_theme.PreInstalled;
|
return !Model.PreInstalled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Delete()
|
private async Task Delete()
|
||||||
@@ -354,7 +355,7 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
|
|
||||||
private void Edit()
|
private void Edit()
|
||||||
{
|
{
|
||||||
_fallBackColors = new TerminalColors(_theme.Colors);
|
_fallBackColors = new TerminalColors(Model.Colors);
|
||||||
_fallBackName = Name;
|
_fallBackName = Name;
|
||||||
_fallBackAuthor = Author;
|
_fallBackAuthor = Author;
|
||||||
InEditMode = true;
|
InEditMode = true;
|
||||||
@@ -367,7 +368,7 @@ namespace FluentTerminal.App.ViewModels
|
|||||||
|
|
||||||
private Task Export()
|
private Task Export()
|
||||||
{
|
{
|
||||||
var content = JsonConvert.SerializeObject(_theme, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new TerminalThemeContractResolver() });
|
var content = JsonConvert.SerializeObject(Model, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new TerminalThemeContractResolver() });
|
||||||
return _fileSystemService.SaveTextFile(Name, "Fluent Terminal Theme", ".flutecolors", content);
|
return _fileSystemService.SaveTextFile(Name, "Fluent Terminal Theme", ".flutecolors", content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ namespace FluentTerminal.App
|
|||||||
builder.RegisterType<SystemFontService>().As<ISystemFontService>().SingleInstance();
|
builder.RegisterType<SystemFontService>().As<ISystemFontService>().SingleInstance();
|
||||||
builder.RegisterType<ShellProfileSelectionDialog>().As<IShellProfileSelectionDialog>().InstancePerDependency();
|
builder.RegisterType<ShellProfileSelectionDialog>().As<IShellProfileSelectionDialog>().InstancePerDependency();
|
||||||
builder.RegisterType<CreateKeyBindingDialog>().As<ICreateKeyBindingDialog>().InstancePerDependency();
|
builder.RegisterType<CreateKeyBindingDialog>().As<ICreateKeyBindingDialog>().InstancePerDependency();
|
||||||
|
builder.RegisterType<InputDialog>().As<IInputDialog>().InstancePerDependency();
|
||||||
builder.RegisterType<MessageDialogAdapter>().As<IMessageDialog>().InstancePerDependency();
|
builder.RegisterType<MessageDialogAdapter>().As<IMessageDialog>().InstancePerDependency();
|
||||||
builder.RegisterType<ApplicationViewAdapter>().As<IApplicationView>().InstancePerDependency();
|
builder.RegisterType<ApplicationViewAdapter>().As<IApplicationView>().InstancePerDependency();
|
||||||
builder.RegisterType<DispatcherTimerAdapter>().As<IDispatcherTimer>().InstancePerDependency();
|
builder.RegisterType<DispatcherTimerAdapter>().As<IDispatcherTimer>().InstancePerDependency();
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<ContentDialog
|
||||||
|
x:Class="FluentTerminal.App.Dialogs.InputDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||||
|
CloseButtonText="Cancel"
|
||||||
|
PrimaryButtonText="OK"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<TextBox VerticalAlignment="Center" Text="{x:Bind Input, Mode=TwoWay}" />
|
||||||
|
</ContentDialog>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using FluentTerminal.App.Services.Dialogs;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace FluentTerminal.App.Dialogs
|
||||||
|
{
|
||||||
|
public sealed partial class InputDialog : ContentDialog, IInputDialog
|
||||||
|
{
|
||||||
|
public string Input { get; private set; }
|
||||||
|
|
||||||
|
public InputDialog()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> GetInput()
|
||||||
|
{
|
||||||
|
var result = await ShowAsync();
|
||||||
|
if (result == ContentDialogResult.Primary)
|
||||||
|
{
|
||||||
|
return Input;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTitle(string title)
|
||||||
|
{
|
||||||
|
Title = title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -125,6 +125,9 @@
|
|||||||
<Compile Include="Converters\ToolTipValueToPixelConverter.cs" />
|
<Compile Include="Converters\ToolTipValueToPixelConverter.cs" />
|
||||||
<Compile Include="Converters\TrueToVisibleConverter.cs" />
|
<Compile Include="Converters\TrueToVisibleConverter.cs" />
|
||||||
<Compile Include="Adapters\MessageDialogAdapter.cs" />
|
<Compile Include="Adapters\MessageDialogAdapter.cs" />
|
||||||
|
<Compile Include="Dialogs\InputDialog.xaml.cs">
|
||||||
|
<DependentUpon>InputDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Dialogs\ShellProfileSelectionDialog.xaml.cs">
|
<Compile Include="Dialogs\ShellProfileSelectionDialog.xaml.cs">
|
||||||
<DependentUpon>ShellProfileSelectionDialog.xaml</DependentUpon>
|
<DependentUpon>ShellProfileSelectionDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -275,6 +278,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Page Include="Dialogs\InputDialog.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Dialogs\ShellProfileSelectionDialog.xaml">
|
<Page Include="Dialogs\ShellProfileSelectionDialog.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" IgnorableNamespaces="uap mp desktop rescap">
|
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" IgnorableNamespaces="uap mp desktop rescap">
|
||||||
<Identity Name="53621FSApps.FluentTerminal" Publisher="CN=BDC72197-B634-438A-B863-16DCB7D90C85" Version="0.3.0.0" />
|
<Identity Name="53621FSApps.FluentTerminal" Publisher="CN=BDC72197-B634-438A-B863-16DCB7D90C85" Version="0.3.1.0" />
|
||||||
<mp:PhoneIdentity PhoneProductId="f7225014-f405-4342-ad2e-ebf6ac60ea2c" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
<mp:PhoneIdentity PhoneProductId="f7225014-f405-4342-ad2e-ebf6ac60ea2c" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||||
<Properties>
|
<Properties>
|
||||||
<DisplayName>Fluent Terminal</DisplayName>
|
<DisplayName>Fluent Terminal</DisplayName>
|
||||||
|
|||||||
@@ -63,6 +63,12 @@
|
|||||||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
|
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
|
||||||
</AppBarButton.Icon>
|
</AppBarButton.Icon>
|
||||||
</AppBarButton>
|
</AppBarButton>
|
||||||
|
<AppBarButton
|
||||||
|
Name="CloneButton"
|
||||||
|
Command="{x:Bind ViewModel.CloneCommand, Mode=OneWay}"
|
||||||
|
CommandParameter="{x:Bind ViewModel.SelectedTheme, Mode=OneWay}"
|
||||||
|
Icon="Copy"
|
||||||
|
Label="Clone" />
|
||||||
<AppBarButton
|
<AppBarButton
|
||||||
Name="EditButton"
|
Name="EditButton"
|
||||||
Command="{x:Bind ViewModel.SelectedTheme.EditCommand, Mode=OneWay}"
|
Command="{x:Bind ViewModel.SelectedTheme.EditCommand, Mode=OneWay}"
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace FluentTerminal.App.Views.SettingsPages
|
|||||||
SaveButton.RequestedTheme = theme;
|
SaveButton.RequestedTheme = theme;
|
||||||
CancelButton.RequestedTheme = theme;
|
CancelButton.RequestedTheme = theme;
|
||||||
ExportButton.RequestedTheme = theme;
|
ExportButton.RequestedTheme = theme;
|
||||||
|
CloneButton.RequestedTheme = theme;
|
||||||
|
|
||||||
ContrastHelper.SetTitleBarButtonsForTheme(theme);
|
ContrastHelper.SetTitleBarButtonsForTheme(theme);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,6 +151,7 @@
|
|||||||
</ToggleMenuFlyoutItem.Icon>
|
</ToggleMenuFlyoutItem.Icon>
|
||||||
</ToggleMenuFlyoutItem>
|
</ToggleMenuFlyoutItem>
|
||||||
</MenuFlyoutSubItem>
|
</MenuFlyoutSubItem>
|
||||||
|
<MenuFlyoutItem Command="{x:Bind EditTitleCommand}" Text="Edit Title" />
|
||||||
<MenuFlyoutSeparator />
|
<MenuFlyoutSeparator />
|
||||||
<MenuFlyoutItem Command="{x:Bind CloseCommand}" Text="Close" />
|
<MenuFlyoutItem Command="{x:Bind CloseCommand}" Text="Close" />
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
|
|||||||
Generated
+3
-3
@@ -4305,9 +4305,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"xterm": {
|
"xterm": {
|
||||||
"version": "3.9.1",
|
"version": "3.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/xterm/-/xterm-3.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/xterm/-/xterm-3.10.1.tgz",
|
||||||
"integrity": "sha512-5AZlhP0jvH/Sskx1UvvNFMqDRHVFqapl59rjV3RRpTJmveoharJplxPfzSThk85I4+AZo2xvD0X0nh0AAzkeZQ=="
|
"integrity": "sha512-RHaUwJ8zwLiICu1QsXoxUHP+R2Pp8Rc8yVoNali/nKw3CVXwmXxT/4mgbk7U22psuNgOqLyI4Sg9nlQfYeTRQw=="
|
||||||
},
|
},
|
||||||
"y18n": {
|
"y18n": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
"webpack-cli": "^3.1.0"
|
"webpack-cli": "^3.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"xterm": "^3.9.1"
|
"xterm": "^3.10.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,15 +84,15 @@ function createTerminal(options, theme, keyBindings) {
|
|||||||
&& keyBinding.shift == e.shiftKey
|
&& keyBinding.shift == e.shiftKey
|
||||||
&& keyBinding.key == e.keyCode) {
|
&& keyBinding.key == e.keyCode) {
|
||||||
if (document.visibilityState == 'visible') {
|
if (document.visibilityState == 'visible') {
|
||||||
if (keyBinding.command == 'copy' && term.getSelection() == '') {
|
if (keyBinding.command == 'Copy' && term.getSelection() == '') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (keyBinding.command == 'clear') {
|
if (keyBinding.command == 'Clear') {
|
||||||
term.clearSelection();
|
term.clearSelection();
|
||||||
term.clear();
|
term.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (keyBinding.command == 'selectAll') {
|
if (keyBinding.command == 'SelectAll') {
|
||||||
term.selectAll();
|
term.selectAll();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,19 @@ namespace FluentTerminal.Models
|
|||||||
{
|
{
|
||||||
public class TerminalTheme
|
public class TerminalTheme
|
||||||
{
|
{
|
||||||
|
public TerminalTheme()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public TerminalTheme(TerminalTheme other)
|
||||||
|
{
|
||||||
|
Id = other.Id;
|
||||||
|
Name = other.Name;
|
||||||
|
Author = other.Author;
|
||||||
|
PreInstalled = other.PreInstalled;
|
||||||
|
Colors = new TerminalColors(other.Colors);
|
||||||
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Author { get; set; }
|
public string Author { get; set; }
|
||||||
|
|||||||
Reference in new issue
Block a user