private void WebView_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args) { #if DEBUG Debug.WriteLine("Navigation Starting"); #endif _parentAccessor = new ParentAccessor(this); _parentAccessor.RegisterAction("Loaded", async() => { if (this.Decorations != null && this.Decorations.Count > 0) { // Need to retrigger highlights after load if they were set before load. await this.DeltaDecorationsHelperAsync(this.Decorations.ToArray()); } // Now we're done loading Loading?.Invoke(this, new RoutedEventArgs()); }); _themeListener = new ThemeListener(); _themeListener.ThemeChanged += _themeListener_ThemeChanged; this._view.AddWebAllowedObject("Debug", new DebugLogger()); this._view.AddWebAllowedObject("Parent", _parentAccessor); this._view.AddWebAllowedObject("Theme", _themeListener); this._view.AddWebAllowedObject("Keyboard", new KeyboardListener(this)); }
private async void _themeListener_ThemeChanged(ThemeListener sender) { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { await this.InvokeScriptAsync("changeTheme", args: new string[] { sender.CurrentTheme.ToString(), sender.IsHighContrast.ToString() }); }); }
public ThemeListenerPage() { this.InitializeComponent(); Listener = new ThemeListener(); this.Loaded += ThemeListenerPage_Loaded; Listener.ThemeChanged += Listener_ThemeChanged; }
public SampleController() { _themeListener = new ThemeListener(); Current = this; InitializeComponent(); _themeListener.ThemeChanged += (s) => { ThemeChanged?.Invoke(this, new ThemeChangedArgs { Theme = GetCurrentTheme() }); }; // Prevent Pop in on wider screens. if (((FrameworkElement)Windows.UI.Xaml.Window.Current.Content).ActualWidth > 700) { SidePaneState = PaneState.Normal; } ThemePicker.SelectedIndex = (int)GetCurrentTheme(); ThemePicker.SelectionChanged += ThemePicker_SelectionChanged; DocumentationTextBlock.SetRenderer <SampleAppMarkdownRenderer>(); ProcessSampleEditorTime(); XamlCodeEditor.UpdateRequested += XamlCodeEditor_UpdateRequested; #if HAS_UNO CanSelectTheme = false; #endif }
public ThemeListenerPage() { this.InitializeComponent(); Listener = new ThemeListener(); this.Loaded += ThemeListenerPage_Loaded; Listener.ThemeChanged += Listener_ThemeChanged; SampleController.Current.ThemeChanged += Current_ThemeChanged; }
private void SetupThemeListener() { if (themeListener is null) { themeListener = new ThemeListener(); themeListener.ThemeChanged += ThemeListener_ThemeChanged; } }
public SettingsPage() { this.InitializeComponent(); var Listener = new ThemeListener(); this.Loaded += SettingsPage_Loaded; Listener.ThemeChanged += Listener_ThemeChanged; //App.Current.ThemeChanged += Current_ThemeChanged; }
private async void ThemeListener_ThemeChanged(ThemeListener sender) { if (RequestedTheme == ElementTheme.Default) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { await InvokeScriptAsync("changeTheme", args: new string[] { sender.CurrentTheme.ToString(), sender.IsHighContrast.ToString() }); }); } }
private void Listener_ThemeChanged(ThemeListener sender) { switch (sender.CurrentTheme) { case ApplicationTheme.Light: GithubLogo.Source = GetIcon("ms-appx:///Assets/Other/Github-light.png"); break; case ApplicationTheme.Dark: GithubLogo.Source = GetIcon("ms-appx:///Assets/Other/Github-dark.png"); break; } }
private void Listener_ThemeChanged(ThemeListener sender) { var theme = sender.CurrentTheme; var titleBar = ApplicationView.GetForCurrentView().TitleBar; switch (theme) { case ApplicationTheme.Dark: titleBar.ForegroundColor = Colors.White; break; default: case ApplicationTheme.Light: titleBar.ForegroundColor = Colors.Black; break; } }
public Task Init() { return(App.Dispatcher.EnqueueAsync(() => { _taskCompletionSource = new TaskCompletionSource <object>(); _themeListener = new ThemeListener { CurrentTheme = Application.Current.RequestedTheme }; _themeListener.ThemeChanged += (s) => { _taskCompletionSource.TrySetResult(null); }; _themeListener.CurrentTheme = Application.Current.RequestedTheme == ApplicationTheme.Light ? ApplicationTheme.Dark : ApplicationTheme.Light; })); }
private void WebView_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args) { #if DEBUG Debug.WriteLine("Navigation Starting"); #endif _parentAccessor = new ParentAccessor(this, _queue); _parentAccessor.AddAssemblyForTypeLookup(typeof(Range).GetTypeInfo().Assembly); _parentAccessor.RegisterAction("Loaded", CodeEditorLoaded); _themeListener = new ThemeListener(_queue); _themeListener.ThemeChanged += ThemeListener_ThemeChanged; _themeToken = RegisterPropertyChangedCallback(RequestedThemeProperty, RequestedTheme_PropertyChanged); _keyboardListener = new KeyboardListener(this, _queue); _view.AddWebAllowedObject("Debug", new DebugLogger()); _view.AddWebAllowedObject("Accessor", _parentAccessor); _view.AddWebAllowedObject("Theme", _themeListener); // TODO: Is this used? _view.AddWebAllowedObject("Keyboard", _keyboardListener); }
public About() { this.InitializeComponent(); Data = DataContext as SettingsPageViewModel; switch (this.ActualTheme) { case ElementTheme.Light: GithubLogo.Source = GetIcon("ms-appx:///Assets/Other/Github-light.png"); break; case ElementTheme.Dark: GithubLogo.Source = GetIcon("ms-appx:///Assets/Other/Github-dark.png"); break; } var Listener = new ThemeListener(); Listener.ThemeChanged += Listener_ThemeChanged; }
private void SetCloseButtonBackgroundColorFromTheme(ThemeListener sender) { ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; switch (sender.CurrentTheme) { case ApplicationTheme.Light: titleBar.ButtonForegroundColor = ((SolidColorBrush)Application.Current.Resources["base03"]).Color; titleBar.ButtonHoverBackgroundColor = ((SolidColorBrush)Application.Current.Resources["base2"]).Color; break; case ApplicationTheme.Dark: titleBar.ButtonForegroundColor = ((SolidColorBrush)Application.Current.Resources["base3"]).Color; titleBar.ButtonHoverBackgroundColor = ((SolidColorBrush)Application.Current.Resources["base03"]).Color; break; default: break; } }
protected override async Task InitializeAsync(CancellationToken CancellationToken, IProgress <ServiceProgressData> Progress) { await JoinableTaskFactory.SwitchToMainThreadAsync(CancellationToken); Instance = this; DTE = GetGlobalService(typeof(DTE)) as DTE; KnownUIContexts.ShellInitializedContext.WhenActivated(() => { ThreadHelper.ThrowIfNotOnUIThread(); DebugListener.Initialize(); ThemeListener.Initialize(GetService(typeof(SVsShell)) as IVsShell); ProjectListener.Initialize(); NuGetListener.Initialize(); PackageInstaller = (GetService(typeof(SComponentModel)) as IComponentModel2)?.GetService <IVsPackageInstaller>(); }); await Commands.ShowDumpWindowCommand.InitializeAsync(this); await OptionContainer.InitializeAsync(); VisualDumpContainer.Initialize(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs args) { if (!args.PrelaunchActivated) { await Startup.ActivateAsync(args); } CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; // Hide default title bar. This setting persists and needs to be reset manually coreTitleBar.ExtendViewIntoTitleBar = true; ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; _themeListener = new ThemeListener(); _themeListener.ThemeChanged += SetCloseButtonBackgroundColorFromTheme; titleBar.ButtonBackgroundColor = Colors.Transparent; titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; SetCloseButtonBackgroundColorFromTheme(_themeListener); }
public static void HandleThemeChange() { try { var isDark = IsDarkTheme(); if (settingsWindow != null) { var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(settingsWindow); ThemeHelpers.SetImmersiveDarkMode(hWnd, isDark); } if (oobeWindow != null) { var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(oobeWindow); ThemeHelpers.SetImmersiveDarkMode(hWnd, isDark); } var selectedTheme = SelectedTheme(); if (selectedTheme == "SYSTEM") { themeListener = new ThemeListener(); themeListener.ThemeChanged += (_) => HandleThemeChange(); } else if (themeListener != null) { themeListener.Dispose(); themeListener = null; } } catch (Exception e) { if (!loggedImmersiveDarkException) { Logger.LogError($"HandleThemeChange exception. Please install .NET 4.", e); loggedImmersiveDarkException = true; } } }
private void CodeEditor_Loaded(object sender, RoutedEventArgs e) { // Do this the 2nd time around. if (_model == null && _view != null) { _model = new ModelHelper(this); _parentAccessor = new ParentAccessor(this); _parentAccessor.AddAssemblyForTypeLookup(typeof(Range).GetTypeInfo().Assembly); _parentAccessor.RegisterAction("Loaded", CodeEditorLoaded); _themeListener = new ThemeListener(); _themeListener.ThemeChanged += _themeListener_ThemeChanged; _themeToken = RegisterPropertyChangedCallback(RequestedThemeProperty, RequestedTheme_PropertyChanged); _keyboardListener = new KeyboardListener(this); _view.AddWebAllowedObject("Parent", _parentAccessor); _view.AddWebAllowedObject("Theme", _themeListener); _view.AddWebAllowedObject("Keyboard", _keyboardListener); Options.PropertyChanged += Options_PropertyChanged; Decorations.VectorChanged += Decorations_VectorChanged; Markers.VectorChanged += Markers_VectorChanged; _view.NewWindowRequested += WebView_NewWindowRequested; _initialized = true; Loading?.Invoke(this, new RoutedEventArgs()); Unloaded += CodeEditor_Unloaded; Loaded?.Invoke(this, new RoutedEventArgs()); } }
private void THEME_LISTENER_ThemeChanged(ThemeListener sender) { MODEL.OnThemeChanged(); }
private static void _notifier_ThemeChanged(ThemeListener sender) { }
private void Listener_ThemeChanged(ThemeListener sender) { UpdateThemeState(); }
private void Listener_ThemeChanged(ThemeListener sender) { var theme = sender.CurrentTheme; CorrectTitleBarTheme(theme); }
public void Clear() => MainBrowser.NavigateToString(new PageHTMLBuilder().SetTheme(ThemeListener.GetCurrentTheme() == Themes.Dark).LoadTheme(OptionContainer.SelectedTheme.Path).BuildHTML());
void Awake() { mvb = GetComponent <ModelViewBehaviour>(); theme = GetComponent <ThemeListener>(); targetView = new TargetView(GetComponent <Canvas>()); }
private void ThemeListener_ThemeChanged(ThemeListener sender) { RenderMarkdown(); }
public static void AddListener(ThemeListener listener) { currentManager.listeners.Add(listener); listener.UpdateTheme(); }
private void ThemeListener_ThemeChanged(ThemeListener sender) { UiUtils.SetupWindow(Current); }
private void ThemeListener_ThemeChanged(ThemeListener sender) { OnColorsChanged(); }
public static void RemoveListener(ThemeListener listener) { currentManager.listeners.Remove(listener); }