Skip to content
Permalink
Browse files

Code refactoring

Code refactoring
  • Loading branch information...
JasonStein committed Sep 5, 2019
1 parent 9943ec5 commit 0ba3ac277d2c841bdfde23750f48378a2e89226e
Showing with 260 additions and 280 deletions.
  1. +5 −5 azure-pipelines.yml
  2. +2 −3 src/Notepads/App.xaml.cs
  3. +2 −3 src/Notepads/Commands/IKeyboardCommand.cs
  4. +1 −2 src/Notepads/Commands/IKeyboardCommandHandler.cs
  5. +2 −3 src/Notepads/Commands/KeyboardCommandHandler.cs
  6. +2 −3 src/Notepads/Commands/KeyboardShortcut.cs
  7. +2 −3 src/Notepads/Controls/FindAndReplace/FindAndReplaceControl.xaml.cs
  8. +2 −3 src/Notepads/Controls/FindAndReplace/FindAndReplaceEventArgs.cs
  9. +2 −3 src/Notepads/Controls/Settings/AboutPage.xaml.cs
  10. +2 −3 src/Notepads/Controls/Settings/AdvancedSettings.xaml.cs
  11. +2 −3 src/Notepads/Controls/Settings/PersonalizationSettings.xaml.cs
  12. +2 −3 src/Notepads/Controls/Settings/SettingsPanel.xaml.cs
  13. +2 −2 src/Notepads/Controls/TextEditor/ITextEditor.cs
  14. +2 −2 src/Notepads/Controls/TextEditor/TextEditor.xaml.cs
  15. +2 −3 src/Notepads/Controls/TextEditor/TextEditorContextFlyout.cs
  16. +3 −5 src/Notepads/Controls/TextEditor/TextEditorCore.cs
  17. +1 −2 src/Notepads/Controls/TextEditor/TextEditorStateMetaData.cs
  18. +2 −2 src/Notepads/Core/INotepadsCore.cs
  19. +1 −2 src/Notepads/Core/ISessionManager.cs
  20. +3 −3 src/Notepads/Core/NotepadsCore.cs
  21. +1 −2 src/Notepads/Core/SessionDataModels/NotepadsSessionData.cs
  22. +1 −2 src/Notepads/Core/SessionDataModels/TextEditorSessionData.cs
  23. +3 −4 src/Notepads/Core/SessionManager.cs
  24. +2 −3 src/Notepads/Core/TabContextFlyout.cs
  25. +24 −0 src/Notepads/Extensions/DiffViewer/BrushFactory.cs
  26. +1 −2 src/Notepads/Extensions/DiffViewer/ISideBySideDiffViewer.cs
  27. +72 −0 src/Notepads/Extensions/DiffViewer/RichTextBlockDiffContext.cs
  28. +1 −87 src/Notepads/Extensions/DiffViewer/RichTextBlockDiffRenderer.cs
  29. +1 −2 src/Notepads/Extensions/DiffViewer/ScrollViewerSynchronizer.cs
  30. +2 −3 src/Notepads/Extensions/DiffViewer/SideBySideDiffViewer.xaml.cs
  31. +2 −3 src/Notepads/Extensions/IContentExtension.cs
  32. +1 −2 src/Notepads/Extensions/IContentPreviewExtension.cs
  33. +2 −3 src/Notepads/Extensions/INotepadsExtensionProvider.cs
  34. +2 −22 src/Notepads/Extensions/Markdown/MarkdownExtensionView.xaml.cs
  35. +2 −3 src/Notepads/Extensions/NotepadsExtensionProvider.cs
  36. +2 −4 src/Notepads/MainPage.xaml.cs
  37. +24 −0 src/Notepads/Models/TextFile.cs
  38. +4 −0 src/Notepads/Notepads.csproj
  39. +3 −4 src/Notepads/Program.cs
  40. +2 −3 src/Notepads/Services/ActivationService.cs
  41. +2 −3 src/Notepads/Services/ContentDialogFactory.cs
  42. +3 −4 src/Notepads/Services/EditorSettingsService.cs
  43. +2 −3 src/Notepads/Services/FilePickerFactory.cs
  44. +2 −3 src/Notepads/Services/LoggingService.cs
  45. +2 −3 src/Notepads/Services/NotepadsProtocolService.cs
  46. +1 −2 src/Notepads/Services/NotificationCenter.cs
  47. +2 −3 src/Notepads/Services/PrintService.cs
  48. +2 −3 src/Notepads/Services/ThemeSettingsService.cs
  49. +2 −3 src/Notepads/Settings/ApplicationSettings.cs
  50. +2 −3 src/Notepads/Settings/SettingsKey.cs
  51. +2 −3 src/Notepads/Utilities/ContentDialogMaker.cs
  52. +28 −0 src/Notepads/Utilities/Downloader.cs
  53. +3 −4 src/Notepads/Utilities/EncodingUtility.cs
  54. +3 −19 src/Notepads/Utilities/FileSystemUtility.cs
  55. +2 −3 src/Notepads/Utilities/FileTypeUtility.cs
  56. +2 −3 src/Notepads/Utilities/FontUtility.cs
  57. +2 −3 src/Notepads/Utilities/LineEndingUtility.cs
  58. +2 −3 src/Notepads/Utilities/SessionUtility.cs
  59. +2 −3 src/Notepads/Utilities/ThreadUtility.cs
  60. +0 −1 src/SetsView/SetsView.ItemSources.cs
  61. +0 −1 src/SetsView/SetsView.Properties.cs
@@ -30,10 +30,10 @@ steps:
platform: 'x64'
solution: '$(solution)'
configuration: '$(buildConfiguration)'
msbuildArgs: '/p:AppxBundlePlatforms="$(buildPlatform)"
/p:AppxPackageDir="$(appxPackageDir)"
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=StoreUpload
msbuildArgs: '/p:AppxBundlePlatforms="$(buildPlatform)"
/p:AppxPackageDir="$(appxPackageDir)"
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=StoreUpload
/p:AppxPackageSigningEnabled=true
/p:PackageCertificateThumbprint=""
/p:PackageCertificateThumbprint=""
/p:PackageCertificateKeyFile="$(signingCert.secureFilePath)"'
@@ -1,5 +1,4 @@

namespace Notepads
namespace Notepads
{
using System;
using System.Collections.Generic;
@@ -233,4 +232,4 @@ private void ExtendAcrylicIntoTitleBar()
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Commands
namespace Notepads.Commands
{
using Windows.System;

@@ -11,4 +10,4 @@ public interface IKeyboardCommand<T>

void Execute(T args);
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Commands
namespace Notepads.Commands
{
public interface IKeyboardCommandHandler<in T>
{
@@ -1,5 +1,4 @@

namespace Notepads.Commands
namespace Notepads.Commands
{
using System.Collections.Generic;
using Windows.System;
@@ -44,4 +43,4 @@ public void Handle(KeyRoutedEventArgs args)
}
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Commands
namespace Notepads.Commands
{
using System;
using Windows.System;
@@ -67,4 +66,4 @@ public void Execute(T args)
_action?.Invoke(args);
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Controls.FindAndReplace
namespace Notepads.Controls.FindAndReplace
{
using System;
using Notepads.Services;
@@ -142,4 +141,4 @@ private void ReplaceAllButton_OnClick(object sender, RoutedEventArgs e)
OnFindAndReplaceButtonClicked?.Invoke(sender, new FindAndReplaceEventArgs(FindBar.Text, ReplaceBar.Text, MatchCaseToggle.IsChecked, MatchWholeWordToggle.IsChecked, FindAndReplaceMode.ReplaceAll));
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Controls.FindAndReplace
namespace Notepads.Controls.FindAndReplace
{
using System;

@@ -31,4 +30,4 @@ public FindAndReplaceEventArgs(string searchText, string replaceText, bool match

public FindAndReplaceMode FindAndReplaceMode { get; }
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Controls.Settings
namespace Notepads.Controls.Settings
{
using System;
using Notepads.Services;
@@ -37,4 +36,4 @@ private static string GetAppVersion()
return $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Controls.Settings
namespace Notepads.Controls.Settings
{
using Notepads.Services;
using Windows.UI.Xaml;
@@ -42,4 +41,4 @@ private void ShowStatusBarToggleSwitch_Toggled(object sender, RoutedEventArgs e)
EditorSettingsService.ShowStatusBar = ShowStatusBarToggleSwitch.IsOn;
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Controls.Settings
namespace Notepads.Controls.Settings
{
using Notepads.Services;
using Windows.UI.Xaml;
@@ -91,4 +90,4 @@ private void WindowsAccentColorToggle_OnToggled(object sender, RoutedEventArgs e
AccentColorPicker.Color = ThemeSettingsService.AppAccentColor;
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Controls.Settings
namespace Notepads.Controls.Settings
{
using System;
using Notepads.Services;
@@ -41,4 +40,4 @@ public void Show(string title, string tag)
ContentFrame.Navigate(pageType, null, new SuppressNavigationTransitionInfo());
}
}
}
}
@@ -1,9 +1,9 @@

namespace Notepads.Controls.TextEditor
namespace Notepads.Controls.TextEditor
{
using System;
using System.Text;
using System.Threading.Tasks;
using Notepads.Models;
using Notepads.Utilities;
using Windows.Storage;

@@ -1,5 +1,4 @@

namespace Notepads.Controls.TextEditor
namespace Notepads.Controls.TextEditor
{
using System;
using System.Collections.Generic;
@@ -10,6 +9,7 @@ namespace Notepads.Controls.TextEditor
using Notepads.Commands;
using Notepads.Controls.FindAndReplace;
using Notepads.Extensions;
using Notepads.Models;
using Notepads.Services;
using Notepads.Utilities;
using Windows.ApplicationModel.Core;
@@ -1,5 +1,4 @@

namespace Notepads.Controls.TextEditor
namespace Notepads.Controls.TextEditor
{
using System;
using Notepads.Utilities;
@@ -274,4 +273,4 @@ public MenuFlyoutItem PreviewToggle
}
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Controls.TextEditor
namespace Notepads.Controls.TextEditor
{
using System;
using System.Collections.Generic;
@@ -157,7 +156,6 @@ protected override void OnApplyTemplate()
_contentScrollViewer.ViewChanged += OnContentScrollViewerViewChanged;
}


public void Undo()
{
if (Document.CanUndo() && IsEnabled)
@@ -524,7 +522,7 @@ private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
{
var mouseWheelDelta = e.GetCurrentPoint(this).Properties.MouseWheelDelta;
_contentScrollViewer.ChangeView(_contentScrollViewer.HorizontalOffset,
_contentScrollViewer.VerticalOffset + -1 * mouseWheelDelta, null, true);
_contentScrollViewer.VerticalOffset + (-1 * mouseWheelDelta), null, true);
}
}
}
@@ -569,4 +567,4 @@ private void ShowEasterEgg()
//};
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Controls.TextEditor
namespace Notepads.Controls.TextEditor
{
public class TextEditorStateMetaData
{
@@ -1,11 +1,11 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Notepads.Controls.TextEditor;
using Notepads.Models;
using Notepads.Utilities;
using Windows.Storage;
using Windows.UI.Xaml.Input;
@@ -1,5 +1,4 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.Threading.Tasks;
@@ -1,5 +1,4 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.Collections.Generic;
@@ -9,6 +8,7 @@ namespace Notepads.Core
using Newtonsoft.Json;
using Notepads.Controls.TextEditor;
using Notepads.Extensions;
using Notepads.Models;
using Notepads.Services;
using Notepads.Settings;
using Notepads.Utilities;
@@ -749,4 +749,4 @@ private async void Sets_SetDraggedOutside(object sender, SetDraggedOutsideEventA

#endregion
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Core.SessionDataModels
namespace Notepads.Core.SessionDataModels
{
using System;
using System.Collections.Generic;
@@ -1,5 +1,4 @@

namespace Notepads.Core.SessionDataModels
namespace Notepads.Core.SessionDataModels
{
using System;
using Notepads.Controls.TextEditor;
@@ -1,5 +1,4 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.Collections.Concurrent;
@@ -13,6 +12,7 @@ namespace Notepads.Core
using Newtonsoft.Json.Linq;
using Notepads.Controls.TextEditor;
using Notepads.Core.SessionDataModels;
using Notepads.Models;
using Notepads.Services;
using Notepads.Utilities;
using Windows.Storage;
@@ -236,7 +236,6 @@ public async Task SaveSessionAsync(Action actionAfterSaving = null)
await SessionUtility.SaveSerializedSessionMetaDataAsync(sessionJsonStr);
_lastSessionJsonStr = sessionJsonStr;
sessionDataSaved = true;

}
}
catch (Exception ex)
@@ -474,4 +473,4 @@ private void RemoveTextEditorSessionData(object sender, EventArgs e)
}
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.IO;
@@ -213,4 +212,4 @@ private void ExecuteOnAllTextEditors(Action<ITextEditor> action)
}
}
}
}
}
@@ -0,0 +1,24 @@
namespace Notepads.Extensions.DiffViewer
{
using System.Collections.Generic;
using Windows.UI;
using Windows.UI.Xaml.Media;

public static class BrushFactory
{
public static Dictionary<Color, SolidColorBrush> Brushes = new Dictionary<Color, SolidColorBrush>();

public static SolidColorBrush GetSolidColorBrush(Color color)
{
if (Brushes.ContainsKey(color))
{
return Brushes[color];
}
else
{
Brushes[color] = new SolidColorBrush(color);
return Brushes[color];
}
}
}
}
@@ -1,5 +1,4 @@

namespace Notepads.Extensions.DiffViewer
namespace Notepads.Extensions.DiffViewer
{
public interface ISideBySideDiffViewer
{

0 comments on commit 0ba3ac2

Please sign in to comment.
You can’t perform that action at this time.