Example #1
0
        public SshInfoDialog(ISettingsService settingsService)
        {
            InitializeComponent();
            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);
        }
Example #2
0
        public SshInfoDialog(ISettingsService settingsService, ISshHelperService sshHelperService,
                             ITrayProcessCommunicationService trayProcessCommunicationService)
        {
            _sshHelperService = sshHelperService;
            _trayProcessCommunicationService = trayProcessCommunicationService;
            InitializeComponent();
            PrimaryButtonText   = I18N.Translate("OK");
            SecondaryButtonText = I18N.Translate("Cancel");
            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);

            TabThemes = new ObservableCollection <TabTheme>(settingsService.GetTabThemes());

            TerminalThemes = new ObservableCollection <TerminalTheme>
            {
                new TerminalTheme
                {
                    Id   = Guid.Empty,
                    Name = "Default"
                }
            };
            foreach (var theme in settingsService.GetThemes())
            {
                TerminalThemes.Add(theme);
            }
        }
        public AboutDialog(ISettingsService settingsService, IUpdateService updateService)
        {
            this.InitializeComponent();
            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);

            CreatedBy.Inlines.Add(new Run {
                Text = "Created by "
            });
            CreatedBy.Inlines.Add(new Italic {
                Inlines = { new Run {
                                Text = "felixse "
                            } }
            });
            CreatedBy.Inlines.Add(new Run {
                Text = "and "
            });
            CreatedBy.Inlines.Add(new Hyperlink {
                Inlines = { new Run {
                                Text = "contributors"
                            } }, NavigateUri = new Uri("https://github.com/felixse/FluentTerminal/graphs/contributors")
            });

            CurrentVersion.Text = updateService.GetCurrentVersion().ToString();
            ReleaseNotesHyperlink.NavigateUri = new Uri("https://github.com/felixse/FluentTerminal/releases/tag/" + CurrentVersion.Text);
        }
 private IAsyncAction SetTitleBarColors()
 {
     return(_dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         var theme = Application.Current.RequestedTheme == ApplicationTheme.Light ? ElementTheme.Light : ElementTheme.Dark;
         ContrastHelper.SetTitleBarButtonsForTheme(theme);
     }));
 }
        private void OnSelectedThemeBackgroundColorChanged(object sender, string e)
        {
            var theme = ContrastHelper.GetIdealThemeForBackgroundColor(e);

            SetTheme(theme);

            SetGridBackground(e, ViewModel.SelectedTheme.BackgroundThemeFile);
        }
 private Task SetTitleBarColorsAsync()
 {
     return(_dispatcher.ExecuteAsync(() =>
     {
         var theme = Application.Current.RequestedTheme == ApplicationTheme.Light ? ElementTheme.Light : ElementTheme.Dark;
         ContrastHelper.SetTitleBarButtonsForTheme(theme);
     }));
 }
        public ShellProfileSelectionDialog(ISettingsService settingsService)
        {
            Profiles        = settingsService.GetShellProfiles();
            SelectedProfile = Profiles.First();
            this.InitializeComponent();
            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);
        }
Example #8
0
        public InputDialog(ISettingsService settingsService)
        {
            this.InitializeComponent();
            this.PrimaryButtonText = I18N.Translate("OK");
            this.CloseButtonText   = I18N.Translate("Cancel");
            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter is ThemesPageViewModel viewModel)
     {
         ViewModel = viewModel;
         viewModel.SelectedThemeBackgroundColorChanged += OnSelectedThemeBackgroundColorChanged;
         var theme = ContrastHelper.GetIdealThemeForBackgroundColor(ViewModel.SelectedTheme.Background);
         SetTheme(theme);
     }
 }
Example #10
0
        private void SetTheme(ElementTheme theme)
        {
            SetActiveButton.RequestedTheme = theme;
            EditButton.RequestedTheme      = theme;
            DeleteButton.RequestedTheme    = theme;
            SaveButton.RequestedTheme      = theme;
            CancelButton.RequestedTheme    = theme;
            ExportButton.RequestedTheme    = theme;

            ContrastHelper.SetTitleBarButtonsForTheme(theme);
        }
        public SshInfoDialog(ISettingsService settingsService, ISshHelperService sshHelperService,
                             ITrayProcessCommunicationService trayProcessCommunicationService)
        {
            _sshHelperService = sshHelperService;
            _trayProcessCommunicationService = trayProcessCommunicationService;
            InitializeComponent();
            PrimaryButtonText   = I18N.Translate("OK");
            SecondaryButtonText = I18N.Translate("Cancel");
            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);
        }
Example #12
0
        public MainPage()
        {
            InitializeComponent();
            Root.DataContext = this;
            Window.Current.SetTitleBar(TitleBar);
            Loaded   += OnLoaded;
            Unloaded += OnUnloaded;
            Window.Current.Activated += OnWindowActivated;
            RegisterPropertyChangedCallback(RequestedThemeProperty, (s, e) =>
            {
                ContrastHelper.SetTitleBarButtonsForTheme(RequestedTheme);
            });

            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
        }
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            Color color;

            if (value is string colorString)
            {
                color = colorString.ToColor();
            }
            else if (value is Color)
            {
                color = (Color)value;
            }

            return(ContrastHelper.GetIdealThemeForBackgroundColor(color));
        }
        public ShellProfileSelectionDialog(ISettingsService settingsService)
        {
            Profiles = new ObservableCollection <ShellProfile>(settingsService.GetAllProfiles().OrderBy(p => p.Name));

            SelectedProfile = Profiles.First();

            InitializeComponent();

            PrimaryButtonText   = I18N.TranslateWithFallback("OK", "OK");
            SecondaryButtonText = I18N.TranslateWithFallback("Cancel", "Cancel");

            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);
        }
        public CustomCommandDialog(ISettingsService settingsService, IApplicationView applicationView,
                                   ITrayProcessCommunicationService trayProcessCommunicationService, ApplicationDataContainers containers)
        {
            _settingsService = settingsService;
            _applicationView = applicationView;
            _trayProcessCommunicationService = trayProcessCommunicationService;
            _historyContainer = containers.HistoryContainer;

            InitializeComponent();

            PrimaryButtonText   = I18N.Translate("OK");
            SecondaryButtonText = I18N.Translate("Cancel");

            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);
        }
Example #16
0
        public SshProfileSelectionDialog(ISettingsService settingsService, IDialogService dialogService)
        {
            _dialogService = dialogService;
            Profiles       = new ObservableCollection <SshProfile>(settingsService.GetSshProfiles().OrderBy(p => p.Name));

            var selectedProfile = settingsService.GetDefaultSshProfile();

            if (selectedProfile != null)
            {
                selectedProfile = Profiles.FirstOrDefault(p => p.Id.Equals(selectedProfile.Id));
            }

            SelectedProfile = selectedProfile ?? Profiles.FirstOrDefault();

            this.InitializeComponent();
            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);
        }
        public SshInfoDialog(ISettingsService settingsService, IApplicationView applicationView,
                             IFileSystemService fileSystemService, ITrayProcessCommunicationService trayProcessCommunicationService)
        {
            _settingsService   = settingsService;
            _applicationView   = applicationView;
            _fileSystemService = fileSystemService;
            _trayProcessCommunicationService = trayProcessCommunicationService;

            InitializeComponent();

            BrowseIdentityFileCommand = new AsyncCommand(BrowseIdentityFile);
            SaveLinkCommand           = new AsyncCommand(SaveLink);

            PrimaryButtonText   = I18N.Translate("OK");
            SecondaryButtonText = I18N.Translate("Cancel");

            var currentTheme = settingsService.GetCurrentTheme();

            RequestedTheme = ContrastHelper.GetIdealThemeForBackgroundColor(currentTheme.Colors.Background);
        }
Example #18
0
 private void OnRequestedThemeProperty(DependencyObject sender, DependencyProperty dp)
 {
     ContrastHelper.SetTitleBarButtonsForTheme(RequestedTheme);
 }
Example #19
0
        private void OnSelectedThemeBackgroundColorChanged(object sender, Color e)
        {
            var theme = ContrastHelper.GetIdealThemeForBackgroundColor(e);

            SetTheme(theme);
        }