From 2d1b47b1988a38abf7e8e77105a9db6cd988d74e Mon Sep 17 00:00:00 2001
From: "Lucas Pinho B. Santos" <5108881+pinholucas@users.noreply.github.com>
Date: Sun, 19 Apr 2020 02:41:55 -0300
Subject: [PATCH 1/3] Translation/updated pt br (#450)
* Updated PT-BR strings files
---
src/Notepads/Strings/pt-BR/Resources.resw | 60 +++++++++++------------
src/Notepads/Strings/pt-BR/Settings.resw | 34 ++++++-------
2 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/src/Notepads/Strings/pt-BR/Resources.resw b/src/Notepads/Strings/pt-BR/Resources.resw
index 22df2ca41..e3f00df5a 100644
--- a/src/Notepads/Strings/pt-BR/Resources.resw
+++ b/src/Notepads/Strings/pt-BR/Resources.resw
@@ -458,99 +458,99 @@
MainMenu: "New Window" button display text.
- Open Recent
+ Abrir Recentes
MainMenu: "Open Recent" button display text.
- Go To Line
+ Ir para a linha
GoTo: Go to bar placeholder text.
- Go To:
+ Ir para:
GoTo:Go to bar label
- Line number exceeds beyond the total number of lines!
+ O número da linha está além do número total de linhas
GoTo: Notification message when input exceeds input limit.
- You can only type a number!
+ Você só pode digitar números!
GoTo: Notification message when invalid input entered.
- Go To Line
+ Ir para a linha
GoTo: "Search" button tool tip display text.
- Search in web
+ Procurar na web
TextEditor: ContextFlyout "Web Search" button display text.
- Restore Default Zoom
+ Restaurar Zoom Padrão
TextEditor: FontZoomIndicator "Restore Default Zoom" FlyoutItem display text. Restores to default zoom for selected text editor.
- Zoom In
+ Ampliar
TextEditor: FontZoomIndicator "ZoomIn" FlyoutItem display text. Zooms in selected text editor text.
- Zoom Out
+ Reduzir
TextEditor: FontZoomIndicator "ZoomOut" FlyoutItem display text. Zooms out selected text editor text.
- Use Regular Expression
+ Usar Expressão Regular
FindAndReplace: "Use Regular Expression" OptionToggleButton display text.
- Print All...
+ Print Tudo...
MainMenu: "Print All" button display text.
- Can only accept upto one decimal place
+ Só é aceito até uma casa decimal
Print: Error message when decimal places for margin entry exceeds limit.
- Value out of range
+ Valor fora do alcance
Print: Error message when value for margin entry exceeds limit.
- Footer
+ Rodapé
Print: PrintManager custom option "FooterText" title.
- Header
+ Cabeçalho
Print: PrintManager custom option "HeaderText" title.
- Horizontal Margin (in %)
+ Margem Horizontal (em %)
Print: PrintManager custom option "LeftMargin" title.
- In % of paper width
+ Na % da largura do papel
Print: PrintManager custom option "LeftMargin" and "TopMargin" description.
- Error printing:
+ Erro na impressão:
Print: Notification message when error occurs while showing print ui.
- Failed to print
+ Falha ao imprimir
Print: Notification message on print failure.
- Printing is not supported on this device
+ A impressão não é suportada neste dispositivo
Print: Notification message when printing attempted in a non-supported device.
- Vertical Margin (in %)
+ Margem Vertical (em %)
Print: PrintManager custom option "TopMargin" title.
- Clear Recently Opened
+ Limpar Recentemente Aberto
MainMenu: "Open Recent" button ClearRecentlyOpenedSubItem display text.
- More Encodings
+ Mais Codificações
TextEditor: EncodingIndicator "More Encodings" FlyoutItem display text.
@@ -562,27 +562,27 @@
TextEditor: EncodingIndicator "Save with Encoding" FlyoutItem display text.
- Invalid regular expression!
+ Expressão regular inválida!
FindAndReplace: Notification message when regular expression text is invalid.
- Auto Guess Encoding
+ Adivinhar Codificação
TextEditor: EncodingIndicator "Auto Guess Encoding" FlyoutItem display text.
- Encoding cannot be determined
+ Não foi possível determinar a codificação
TextEditor: Notification message when file's encoding cannot be determined.
- Find Previous (Shift+F3)
+ Localizar Anterior (Shift+F3)
FindAndReplace: "Find Previous" button tool tip display text.
- Toggle Replace Mode
+ Alternar modo de Substituição
FindAndReplace: "Toggle Replace Mode" button tool tip display text.
- Right-to-Left Reading order
+ Leitura da Direita para Esquerda
TextEditor: ContextFlyout "Right-to-Left Reading order" toggle button display text.
\ No newline at end of file
diff --git a/src/Notepads/Strings/pt-BR/Settings.resw b/src/Notepads/Strings/pt-BR/Settings.resw
index e68bb0df3..3f72eeefd 100644
--- a/src/Notepads/Strings/pt-BR/Settings.resw
+++ b/src/Notepads/Strings/pt-BR/Settings.resw
@@ -186,7 +186,7 @@
PersonalizationPage AccentColorSettings UseWindowsAccentColorToggleSwitch On display text.
- Opacidade do tom de fundo do acrílico. Please note that Acrylic effect will be disabled when battery saver mode is on or if you turn off transparency effects in Windows Settings.
+ Opacidade do tom de fundo do acrílico. Saiba que o efeito acrílico será desativado quando o modo de economia de bateria estiver ativado ou se você desativar os efeitos de transparência nas configurações do Windows.
PersonalizationPage BackgroundTintOpacitySettings Description display text.
@@ -214,7 +214,7 @@
PersonalizationPage Title display text.
- ANSI (Windows code page)
+ ANSI (Página de código do Windows)
TextAndEditorPage DecodingSettings AnsiRadioButton content display text.
@@ -310,63 +310,63 @@
AdvancedPageSessionSnapshotSettings Title display text.
- Highlight misspelled words
+ Destacar erros ortográficos
TextAndEditorPage SpellingSettings HighlightMisspelledWordsToggleSwitch Off display text.
- Highlight misspelled words
+ Destacar erros ortográficos
TextAndEditorPage SpellingSettings HighlightMisspelledWordsToggleSwitch On display text.
- Spelling
+ Ortografia
TextAndEditorPage SpellingSettings Title display text.
- Once enabled, Notepads will always open file in a new window instead of creating a new tab.
+ Quando ativada, o Notepads irá sempre abrir o arquivo em uma nova janela ao invés de criar uma nova aba.
AdvancedPage LaunchPreferenceSettings AlwaysOpenNewWindow Description display text.
- Always open new window
+ Sempre abrir em uma nova janela
AdvancedPage LaunchPreferenceSettings AlwaysOpenNewWindow OnOffToggleSwitch On display text.
- Always open new window
+ Sempre abrir em uma nova janela
AdvancedPage LaunchPreferenceSettings AlwaysOpenNewWindow OnOffToggleSwitch Off display text.
- Launch Preferences
+ Preferências de Inicialização
AdvancedPage LaunchPreferenceSettings Title display text.
- Highlight Current Line
+ Destacar Linha Atual
TextAndEditorPage LineHighlighterSettings Title display text.
- Show border around current line
+ Mostrar borda ao redor da linha atual
TextAndEditorPage LineHighlighterSettings ToggleSwitch Off display text.
- Show border around current line
+ Mostrar borda ao redor da linha atual
TextAndEditorPage LineHighlighterSettings ToggleSwitch On display text.
- Custom Search Engine
+ Personalizado
TextAndEditorPage CustomSearchUrlRadioButton display text.
- *Enter a url of format https://www.example.com/search?q={0}
+ *Digite uma URL com o formato https://www.example.com/search?q={0}
TextAndEditorPage CustomSearchUrl Textbox display text when entered text is not a valid format.
- Settings for default search engine choosen when a web search is done.
+ Configurações do motor de busca padrão escolhido, para quando é realizada uma busca na web.
TextAndEditorPage SearchEngineSettings Description display text.
- Default Search Engine
+ Mecanismo de Pesquisa Padrão
TextAndEditorPage SearchEngineSettings Title display text.
- Auto guess Encoding (Recomendado)
+ Detectar Codificação (Recomendado)
TextAndEditorPage DecodingSettings AutoGuessDecodingRadioButton content display text.
\ No newline at end of file
From 98db331b81eb256e0034cd4c43745eed1b89930d Mon Sep 17 00:00:00 2001
From: Jiaqi Liu
Date: Sat, 18 Apr 2020 23:07:56 -0700
Subject: [PATCH 2/3] Move extension class/methods to extension folder
Move extension class/methods to extension folder
---
.../DiffViewer/SideBySideDiffViewer.xaml.cs | 4 ++--
.../FindAndReplaceControl.xaml.cs | 4 ++--
src/Notepads/Controls/GoTo/GoToControl.xaml.cs | 4 ++--
.../Markdown/MarkdownExtensionView.xaml.cs | 2 +-
.../Controls/TextEditor/TextEditor.xaml.cs | 18 +++++++++---------
.../TextEditorCore.FindAndReplace.cs | 2 +-
.../Controls/TextEditor/TextEditorCore.cs | 11 ++++++-----
src/Notepads/Core/NotepadsCore.cs | 2 +-
.../Extensions/DispatcherExtensions.cs | 14 ++++++++++++++
.../StringExtensions.cs} | 10 ++++++++--
src/Notepads/Notepads.csproj | 3 ++-
src/Notepads/Utilities/BrushUtility.cs | 7 +------
src/Notepads/Utilities/ThreadUtility.cs | 10 ----------
src/Notepads/Views/AboutPage.xaml.cs | 4 ++--
.../Views/NotepadsMainPage.StatusBar.cs | 3 ++-
src/Notepads/Views/NotepadsMainPage.Theme.cs | 8 ++++----
src/Notepads/Views/NotepadsMainPage.xaml.cs | 2 +-
.../Views/PersonalizationSettingsPage.xaml.cs | 8 ++++----
src/Notepads/Views/SettingsPage.xaml.cs | 6 +++---
19 files changed, 65 insertions(+), 57 deletions(-)
create mode 100644 src/Notepads/Extensions/DispatcherExtensions.cs
rename src/Notepads/{Utilities/StringUtility.cs => Extensions/StringExtensions.cs} (87%)
diff --git a/src/Notepads/Controls/DiffViewer/SideBySideDiffViewer.xaml.cs b/src/Notepads/Controls/DiffViewer/SideBySideDiffViewer.xaml.cs
index 31e607fd9..3b66d8920 100644
--- a/src/Notepads/Controls/DiffViewer/SideBySideDiffViewer.xaml.cs
+++ b/src/Notepads/Controls/DiffViewer/SideBySideDiffViewer.xaml.cs
@@ -5,8 +5,8 @@
using System.Threading;
using System.Threading.Tasks;
using Notepads.Commands;
+ using Notepads.Extensions;
using Notepads.Services;
- using Notepads.Utilities;
using Windows.System;
using Windows.UI;
using Windows.UI.Core;
@@ -70,7 +70,7 @@ private void SideBySideDiffViewer_Loaded(object sender, RoutedEventArgs e)
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
LeftBox.SelectionHighlightColor = new SolidColorBrush(color);
RightBox.SelectionHighlightColor = new SolidColorBrush(color);
diff --git a/src/Notepads/Controls/FindAndReplace/FindAndReplaceControl.xaml.cs b/src/Notepads/Controls/FindAndReplace/FindAndReplaceControl.xaml.cs
index c231fb906..221493369 100644
--- a/src/Notepads/Controls/FindAndReplace/FindAndReplaceControl.xaml.cs
+++ b/src/Notepads/Controls/FindAndReplace/FindAndReplaceControl.xaml.cs
@@ -3,8 +3,8 @@
using System;
using System.Collections.Generic;
using Notepads.Commands;
+ using Notepads.Extensions;
using Notepads.Services;
- using Notepads.Utilities;
using Windows.System;
using Windows.UI;
using Windows.UI.Core;
@@ -64,7 +64,7 @@ private void FindAndReplaceControl_Loaded(object sender, RoutedEventArgs e)
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
SetSelectionHighlightColor(color);
});
diff --git a/src/Notepads/Controls/GoTo/GoToControl.xaml.cs b/src/Notepads/Controls/GoTo/GoToControl.xaml.cs
index 3c125d8cc..18ed5d798 100644
--- a/src/Notepads/Controls/GoTo/GoToControl.xaml.cs
+++ b/src/Notepads/Controls/GoTo/GoToControl.xaml.cs
@@ -1,8 +1,8 @@
namespace Notepads.Controls.GoTo
{
using System;
+ using Notepads.Extensions;
using Notepads.Services;
- using Notepads.Utilities;
using Windows.ApplicationModel.Resources;
using Windows.System;
using Windows.UI;
@@ -51,7 +51,7 @@ private void GoToControl_Loaded(object sender, RoutedEventArgs e)
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
SetSelectionHighlightColor(color);
});
diff --git a/src/Notepads/Controls/Markdown/MarkdownExtensionView.xaml.cs b/src/Notepads/Controls/Markdown/MarkdownExtensionView.xaml.cs
index 8c710ca7e..9916edc28 100644
--- a/src/Notepads/Controls/Markdown/MarkdownExtensionView.xaml.cs
+++ b/src/Notepads/Controls/Markdown/MarkdownExtensionView.xaml.cs
@@ -48,7 +48,7 @@ public MarkdownExtensionView()
private async void OnThemeChanged(object sender, ElementTheme theme)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
MarkdownTextBlock.RequestedTheme = theme;
});
diff --git a/src/Notepads/Controls/TextEditor/TextEditor.xaml.cs b/src/Notepads/Controls/TextEditor/TextEditor.xaml.cs
index 7f26985fb..b2aa95c05 100644
--- a/src/Notepads/Controls/TextEditor/TextEditor.xaml.cs
+++ b/src/Notepads/Controls/TextEditor/TextEditor.xaml.cs
@@ -262,14 +262,14 @@ public void Dispose()
private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
if (Mode == TextEditorMode.DiffPreview)
{
SideBySideDiffViewer.RenderDiff(LastSavedSnapshot.Content, TextEditorCore.GetText(), theme);
Task.Factory.StartNew(async () =>
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () => { SideBySideDiffViewer.Focus(); });
+ await Dispatcher.CallOnUIThreadAsync(() => { SideBySideDiffViewer.Focus(); });
});
}
});
@@ -400,7 +400,7 @@ private async Task CheckAndUpdateFileStatus(CancellationToken cancellationToken)
return;
}
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
FileModificationState = newState.Value;
});
@@ -1071,7 +1071,7 @@ private void DrawLineHighlighter()
private async void LineHighlighter_OnViewStateChanged(object sender, bool enabled)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
if (enabled)
{
@@ -1087,7 +1087,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void LineHighlighter_OnSelectionChanged(object sender, RoutedEventArgs e)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled) DrawLineHighlighter();
});
@@ -1095,7 +1095,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void LineHighlighter_OnTextWrappingChanged(object sender, TextWrapping e)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled)
{
@@ -1108,7 +1108,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void LineHighlighter_OnFontSizeChanged(object sender, double e)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled) DrawLineHighlighter();
});
@@ -1116,7 +1116,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void LineHighlighter_OnSizeChanged(object sender, SizeChangedEventArgs e)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled) DrawLineHighlighter();
});
@@ -1124,7 +1124,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void LineHighlighter_OnScrollViewerViewChanging(object sender, ScrollViewerViewChangingEventArgs e)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled) DrawLineHighlighter();
});
diff --git a/src/Notepads/Controls/TextEditor/TextEditorCore.FindAndReplace.cs b/src/Notepads/Controls/TextEditor/TextEditorCore.FindAndReplace.cs
index e8debd5a3..69472b591 100644
--- a/src/Notepads/Controls/TextEditor/TextEditorCore.FindAndReplace.cs
+++ b/src/Notepads/Controls/TextEditor/TextEditorCore.FindAndReplace.cs
@@ -4,7 +4,7 @@
using System.Text.RegularExpressions;
using Windows.UI.Text;
using Notepads.Controls.FindAndReplace;
- using Notepads.Utilities;
+ using Notepads.Extensions;
public partial class TextEditorCore
{
diff --git a/src/Notepads/Controls/TextEditor/TextEditorCore.cs b/src/Notepads/Controls/TextEditor/TextEditorCore.cs
index dba1acfdd..963eb2629 100644
--- a/src/Notepads/Controls/TextEditor/TextEditorCore.cs
+++ b/src/Notepads/Controls/TextEditor/TextEditorCore.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Notepads.Commands;
+ using Notepads.Extensions;
using Notepads.Services;
using Notepads.Utilities;
using Windows.ApplicationModel.DataTransfer;
@@ -225,7 +226,7 @@ private ICommandHandler GetMouseCommandHandler()
private async void EditorSettingsService_OnFontFamilyChanged(object sender, string fontFamily)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
FontFamily = new FontFamily(fontFamily);
SetDefaultTabStopAndLineSpacing(FontFamily, FontSize);
@@ -234,7 +235,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void EditorSettingsService_OnFontSizeChanged(object sender, int fontSize)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
FontSize = fontSize;
});
@@ -242,7 +243,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void EditorSettingsService_OnDefaultTextWrappingChanged(object sender, TextWrapping textWrapping)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
TextWrapping = textWrapping;
});
@@ -250,7 +251,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void EditorSettingsService_OnHighlightMisspelledWordsChanged(object sender, bool isSpellCheckEnabled)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
IsSpellCheckEnabled = isSpellCheckEnabled;
});
@@ -258,7 +259,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
SelectionHighlightColor = new SolidColorBrush(color);
SelectionHighlightColorWhenNotFocused = new SolidColorBrush(color);
diff --git a/src/Notepads/Core/NotepadsCore.cs b/src/Notepads/Core/NotepadsCore.cs
index a5c100c18..28dfc8f15 100644
--- a/src/Notepads/Core/NotepadsCore.cs
+++ b/src/Notepads/Core/NotepadsCore.cs
@@ -86,7 +86,7 @@ public NotepadsCore(SetsView sets,
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
- await ThreadUtility.CallOnUIThreadAsync(_dispatcher, () =>
+ await _dispatcher.CallOnUIThreadAsync(() =>
{
if (Sets.Items == null) return;
foreach (SetsViewItem item in Sets.Items)
diff --git a/src/Notepads/Extensions/DispatcherExtensions.cs b/src/Notepads/Extensions/DispatcherExtensions.cs
new file mode 100644
index 000000000..93bceb447
--- /dev/null
+++ b/src/Notepads/Extensions/DispatcherExtensions.cs
@@ -0,0 +1,14 @@
+namespace Notepads.Extensions
+{
+ using System;
+ using System.Threading.Tasks;
+ using Windows.UI.Core;
+
+ public static class DispatcherExtensions
+ {
+ public static async Task CallOnUIThreadAsync(this CoreDispatcher dispatcher, DispatchedHandler handler)
+ {
+ await dispatcher.RunAsync(CoreDispatcherPriority.Normal, handler);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Notepads/Utilities/StringUtility.cs b/src/Notepads/Extensions/StringExtensions.cs
similarity index 87%
rename from src/Notepads/Utilities/StringUtility.cs
rename to src/Notepads/Extensions/StringExtensions.cs
index d89fa5f82..63618e1ba 100644
--- a/src/Notepads/Utilities/StringUtility.cs
+++ b/src/Notepads/Extensions/StringExtensions.cs
@@ -1,8 +1,8 @@
-namespace Notepads.Utilities
+namespace Notepads.Extensions
{
using System;
- public static class StringUtility
+ public static class StringExtensions
{
public static string LeadingSpacesAndTabs(this string str)
{
@@ -61,5 +61,11 @@ public static int LastIndexOfWholeWord(this string target, string value, int sta
}
return -1;
}
+
+ public static Uri ToAppxUri(this string path)
+ {
+ string prefix = $"ms-appx://{(path.StartsWith('/') ? string.Empty : "/")}";
+ return new Uri($"{prefix}{path}");
+ }
}
}
\ No newline at end of file
diff --git a/src/Notepads/Notepads.csproj b/src/Notepads/Notepads.csproj
index aaeaf7495..c805b6e79 100644
--- a/src/Notepads/Notepads.csproj
+++ b/src/Notepads/Notepads.csproj
@@ -124,6 +124,7 @@
PrintPageFormat.xaml
+
AboutPage.xaml
@@ -210,7 +211,7 @@
-
+
diff --git a/src/Notepads/Utilities/BrushUtility.cs b/src/Notepads/Utilities/BrushUtility.cs
index 04de3d62a..643c9eeac 100644
--- a/src/Notepads/Utilities/BrushUtility.cs
+++ b/src/Notepads/Utilities/BrushUtility.cs
@@ -8,6 +8,7 @@
using Windows.UI.Xaml.Media;
using Microsoft.AppCenter.Analytics;
using Notepads.Brushes;
+ using Notepads.Extensions;
public static class BrushUtility
{
@@ -40,11 +41,5 @@ public static async Task GetHostBackdropAcrylicBrush(Color color, float t
SemaphoreSlim.Release();
}
}
-
- private static Uri ToAppxUri(this string path)
- {
- string prefix = $"ms-appx://{(path.StartsWith('/') ? string.Empty : "/")}";
- return new Uri($"{prefix}{path}");
- }
}
}
\ No newline at end of file
diff --git a/src/Notepads/Utilities/ThreadUtility.cs b/src/Notepads/Utilities/ThreadUtility.cs
index 1af009af3..9aaec20b5 100644
--- a/src/Notepads/Utilities/ThreadUtility.cs
+++ b/src/Notepads/Utilities/ThreadUtility.cs
@@ -1,7 +1,5 @@
namespace Notepads.Utilities
{
- using System;
- using System.Threading.Tasks;
using Windows.UI.Core;
internal static class ThreadUtility
@@ -11,13 +9,5 @@ public static bool IsOnUIThread()
CoreWindow coreWindow = CoreWindow.GetForCurrentThread();
return coreWindow != null && coreWindow.Dispatcher.HasThreadAccess;
}
-
- public static async Task CallOnUIThreadAsync(CoreDispatcher dispatcher, DispatchedHandler handler)
- {
- await dispatcher.RunAsync(CoreDispatcherPriority.Normal, handler);
- }
-
- //public static async Task CallOnMainViewUIThreadAsync(DispatchedHandler handler) =>
- // await CallOnUIThreadAsync(CoreApplication.MainView.CoreWindow.Dispatcher, handler);
}
}
\ No newline at end of file
diff --git a/src/Notepads/Views/AboutPage.xaml.cs b/src/Notepads/Views/AboutPage.xaml.cs
index 84b071aef..dc5ef7878 100644
--- a/src/Notepads/Views/AboutPage.xaml.cs
+++ b/src/Notepads/Views/AboutPage.xaml.cs
@@ -1,8 +1,8 @@
namespace Notepads.Views
{
using System;
+ using Notepads.Extensions;
using Notepads.Services;
- using Notepads.Utilities;
using Windows.ApplicationModel;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@@ -33,7 +33,7 @@ private void AboutPage_Unloaded(object sender, RoutedEventArgs e)
private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
SetAppIconBasedOnTheme(theme);
});
diff --git a/src/Notepads/Views/NotepadsMainPage.StatusBar.cs b/src/Notepads/Views/NotepadsMainPage.StatusBar.cs
index 885653ff4..eafa947cc 100644
--- a/src/Notepads/Views/NotepadsMainPage.StatusBar.cs
+++ b/src/Notepads/Views/NotepadsMainPage.StatusBar.cs
@@ -13,6 +13,7 @@
using Windows.UI.Xaml.Input;
using Notepads.Controls.Dialog;
using Notepads.Controls.TextEditor;
+ using Notepads.Extensions;
using Notepads.Services;
using Notepads.Utilities;
@@ -61,7 +62,7 @@ public void ShowHideStatusBar(bool showStatusBar)
private async void OnStatusBarVisibilityChanged(object sender, bool visible)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
if (ApplicationView.GetForCurrentView().ViewMode != ApplicationViewMode.CompactOverlay) ShowHideStatusBar(visible);
});
diff --git a/src/Notepads/Views/NotepadsMainPage.Theme.cs b/src/Notepads/Views/NotepadsMainPage.Theme.cs
index 33543dd09..cc9c76d7e 100644
--- a/src/Notepads/Views/NotepadsMainPage.Theme.cs
+++ b/src/Notepads/Views/NotepadsMainPage.Theme.cs
@@ -4,8 +4,8 @@
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
+ using Notepads.Extensions;
using Notepads.Services;
- using Notepads.Utilities;
public sealed partial class NotepadsMainPage
{
@@ -19,12 +19,12 @@ private void InitializeThemeSettings()
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, ThemeSettingsService.SetRequestedAccentColor);
+ await Dispatcher.CallOnUIThreadAsync(ThemeSettingsService.SetRequestedAccentColor);
}
private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
ThemeSettingsService.SetRequestedTheme(RootGrid, Window.Current.Content, ApplicationView.GetForCurrentView().TitleBar);
});
@@ -32,7 +32,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void ThemeSettingsService_OnBackgroundChanged(object sender, Brush backgroundBrush)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
RootGrid.Background = backgroundBrush;
});
diff --git a/src/Notepads/Views/NotepadsMainPage.xaml.cs b/src/Notepads/Views/NotepadsMainPage.xaml.cs
index b54c28a82..e40e382e6 100644
--- a/src/Notepads/Views/NotepadsMainPage.xaml.cs
+++ b/src/Notepads/Views/NotepadsMainPage.xaml.cs
@@ -411,7 +411,7 @@ private async void MainPage_CloseRequested(object sender, Windows.UI.Core.Previe
private async void OnSessionBackupAndRestoreOptionChanged(object sender, bool isSessionBackupAndRestoreEnabled)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, async () =>
+ await Dispatcher.CallOnUIThreadAsync(async () =>
{
if (isSessionBackupAndRestoreEnabled)
{
diff --git a/src/Notepads/Views/PersonalizationSettingsPage.xaml.cs b/src/Notepads/Views/PersonalizationSettingsPage.xaml.cs
index b9978856c..ed319d0d8 100644
--- a/src/Notepads/Views/PersonalizationSettingsPage.xaml.cs
+++ b/src/Notepads/Views/PersonalizationSettingsPage.xaml.cs
@@ -1,7 +1,7 @@
namespace Notepads.Views
{
+ using Notepads.Extensions;
using Notepads.Services;
- using Notepads.Utilities;
using Windows.System.Power;
using Windows.UI;
using Windows.UI.ViewManagement;
@@ -58,7 +58,7 @@ public PersonalizationSettingsPage()
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
BackgroundTintOpacitySlider.Foreground = new SolidColorBrush(color);
AccentColorPicker.ColorChanged -= AccentColorPicker_OnColorChanged;
@@ -101,7 +101,7 @@ private void PersonalizationSettings_Unloaded(object sender, RoutedEventArgs e)
private async void PowerManager_EnergySaverStatusChanged(object sender, object e)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
BackgroundTintOpacitySlider.IsEnabled = UISettings.AdvancedEffectsEnabled &&
PowerManager.EnergySaverStatus != EnergySaverStatus.On;
@@ -110,7 +110,7 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
private async void UISettings_AdvancedEffectsEnabledChanged(UISettings sender, object args)
{
- await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
+ await Dispatcher.CallOnUIThreadAsync(() =>
{
BackgroundTintOpacitySlider.IsEnabled = UISettings.AdvancedEffectsEnabled &&
PowerManager.EnergySaverStatus != EnergySaverStatus.On;
diff --git a/src/Notepads/Views/SettingsPage.xaml.cs b/src/Notepads/Views/SettingsPage.xaml.cs
index 98e9027f0..c07ad9be0 100644
--- a/src/Notepads/Views/SettingsPage.xaml.cs
+++ b/src/Notepads/Views/SettingsPage.xaml.cs
@@ -1,7 +1,7 @@
namespace Notepads.Views
{
+ using Notepads.Extensions;
using Notepads.Services;
- using Notepads.Utilities;
using System.Linq;
using Windows.UI;
using Windows.UI.Xaml;
@@ -43,12 +43,12 @@ private void SettingsPage_Unloaded(object sender, RoutedEventArgs e)
private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
- await ThreadUtility.CallOnUIThreadAsync(Window.Current?.Dispatcher ?? Dispatcher, ThemeSettingsService.SetRequestedAccentColor);
+ await (Window.Current?.Dispatcher ?? Dispatcher).CallOnUIThreadAsync(ThemeSettingsService.SetRequestedAccentColor);
}
private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
{
- await ThreadUtility.CallOnUIThreadAsync(Window.Current?.Dispatcher ?? Dispatcher, () =>
+ await (Window.Current?.Dispatcher ?? Dispatcher).CallOnUIThreadAsync(() =>
{
ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null);
});
From 07fa99a6d32bf1dd3be9569c9007614304e6d79e Mon Sep 17 00:00:00 2001
From: Jiaqi Liu
Date: Sun, 19 Apr 2020 22:48:19 -0700
Subject: [PATCH 3/3] Add shadow to the edge of the settings panel
Add shadow to the edge of the settings panel + some shadow tweaks
---
src/Notepads.Controls/SetsView/SetsView.xaml | 65 ++++++++++++-------
.../Controls/TextEditor/TextEditor.xaml | 8 ++-
src/Notepads/Views/NotepadsMainPage.xaml | 16 ++++-
3 files changed, 63 insertions(+), 26 deletions(-)
diff --git a/src/Notepads.Controls/SetsView/SetsView.xaml b/src/Notepads.Controls/SetsView/SetsView.xaml
index e1e2f7377..0feb302a3 100644
--- a/src/Notepads.Controls/SetsView/SetsView.xaml
+++ b/src/Notepads.Controls/SetsView/SetsView.xaml
@@ -32,7 +32,7 @@
ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
- 0.4
+ 0.55
- 0.4
+ 0.7
@@ -126,8 +126,7 @@
FalseValue="{StaticResource SetsViewItemHeaderCloseWidth}"
TrueValue="NaN" />
-
-
-