Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
Code refactoring
  • Loading branch information
0x7c13 committed Sep 5, 2019
1 parent 9943ec5 commit 0ba3ac2
Show file tree
Hide file tree
Showing 61 changed files with 260 additions and 280 deletions.
10 changes: 5 additions & 5 deletions azure-pipelines.yml
Expand Up @@ -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)"'
5 changes: 2 additions & 3 deletions src/Notepads/App.xaml.cs
@@ -1,5 +1,4 @@

namespace Notepads
namespace Notepads
{
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -233,4 +232,4 @@ private void ExtendAcrylicIntoTitleBar()
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
}
}
}
}
5 changes: 2 additions & 3 deletions src/Notepads/Commands/IKeyboardCommand.cs
@@ -1,5 +1,4 @@

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

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

void Execute(T args);
}
}
}
3 changes: 1 addition & 2 deletions src/Notepads/Commands/IKeyboardCommandHandler.cs
@@ -1,5 +1,4 @@

namespace Notepads.Commands
namespace Notepads.Commands
{
public interface IKeyboardCommandHandler<in T>
{
Expand Down
5 changes: 2 additions & 3 deletions src/Notepads/Commands/KeyboardCommandHandler.cs
@@ -1,5 +1,4 @@

namespace Notepads.Commands
namespace Notepads.Commands
{
using System.Collections.Generic;
using Windows.System;
Expand Down Expand Up @@ -44,4 +43,4 @@ public void Handle(KeyRoutedEventArgs args)
}
}
}
}
}
5 changes: 2 additions & 3 deletions src/Notepads/Commands/KeyboardShortcut.cs
@@ -1,5 +1,4 @@

namespace Notepads.Commands
namespace Notepads.Commands
{
using System;
using Windows.System;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

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

public FindAndReplaceMode FindAndReplaceMode { get; }
}
}
}
5 changes: 2 additions & 3 deletions src/Notepads/Controls/Settings/AboutPage.xaml.cs
@@ -1,5 +1,4 @@

namespace Notepads.Controls.Settings
namespace Notepads.Controls.Settings
{
using System;
using Notepads.Services;
Expand Down Expand Up @@ -37,4 +36,4 @@ private static string GetAppVersion()
return $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
}
}
}
}
5 changes: 2 additions & 3 deletions src/Notepads/Controls/Settings/AdvancedSettings.xaml.cs
@@ -1,5 +1,4 @@

namespace Notepads.Controls.Settings
namespace Notepads.Controls.Settings
{
using Notepads.Services;
using Windows.UI.Xaml;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -91,4 +90,4 @@ private void WindowsAccentColorToggle_OnToggled(object sender, RoutedEventArgs e
AccentColorPicker.Color = ThemeSettingsService.AppAccentColor;
}
}
}
}
5 changes: 2 additions & 3 deletions src/Notepads/Controls/Settings/SettingsPanel.xaml.cs
@@ -1,5 +1,4 @@

namespace Notepads.Controls.Settings
namespace Notepads.Controls.Settings
{
using System;
using Notepads.Services;
Expand Down Expand Up @@ -41,4 +40,4 @@ public void Show(string title, string tag)
ContentFrame.Navigate(pageType, null, new SuppressNavigationTransitionInfo());
}
}
}
}
4 changes: 2 additions & 2 deletions src/Notepads/Controls/TextEditor/ITextEditor.cs
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/Notepads/Controls/TextEditor/TextEditor.xaml.cs
@@ -1,5 +1,4 @@

namespace Notepads.Controls.TextEditor
namespace Notepads.Controls.TextEditor
{
using System;
using System.Collections.Generic;
Expand All @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/Notepads/Controls/TextEditor/TextEditorContextFlyout.cs
@@ -1,5 +1,4 @@

namespace Notepads.Controls.TextEditor
namespace Notepads.Controls.TextEditor
{
using System;
using Notepads.Utilities;
Expand Down Expand Up @@ -274,4 +273,4 @@ public MenuFlyoutItem PreviewToggle
}
}
}
}
}
8 changes: 3 additions & 5 deletions src/Notepads/Controls/TextEditor/TextEditorCore.cs
@@ -1,5 +1,4 @@

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


public void Undo()
{
if (Document.CanUndo() && IsEnabled)
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -569,4 +567,4 @@ private void ShowEasterEgg()
//};
}
}
}
}
3 changes: 1 addition & 2 deletions src/Notepads/Controls/TextEditor/TextEditorStateMetaData.cs
@@ -1,5 +1,4 @@

namespace Notepads.Controls.TextEditor
namespace Notepads.Controls.TextEditor
{
public class TextEditorStateMetaData
{
Expand Down
4 changes: 2 additions & 2 deletions src/Notepads/Core/INotepadsCore.cs
@@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/Notepads/Core/ISessionManager.cs
@@ -1,5 +1,4 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.Threading.Tasks;
Expand Down
6 changes: 3 additions & 3 deletions src/Notepads/Core/NotepadsCore.cs
@@ -1,5 +1,4 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.Collections.Generic;
Expand All @@ -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;
Expand Down Expand Up @@ -749,4 +749,4 @@ private async void Sets_SetDraggedOutside(object sender, SetDraggedOutsideEventA

#endregion
}
}
}
3 changes: 1 addition & 2 deletions src/Notepads/Core/SessionDataModels/NotepadsSessionData.cs
@@ -1,5 +1,4 @@

namespace Notepads.Core.SessionDataModels
namespace Notepads.Core.SessionDataModels
{
using System;
using System.Collections.Generic;
Expand Down
3 changes: 1 addition & 2 deletions src/Notepads/Core/SessionDataModels/TextEditorSessionData.cs
@@ -1,5 +1,4 @@

namespace Notepads.Core.SessionDataModels
namespace Notepads.Core.SessionDataModels
{
using System;
using Notepads.Controls.TextEditor;
Expand Down
7 changes: 3 additions & 4 deletions src/Notepads/Core/SessionManager.cs
@@ -1,5 +1,4 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.Collections.Concurrent;
Expand All @@ -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;
Expand Down Expand Up @@ -236,7 +236,6 @@ public async Task SaveSessionAsync(Action actionAfterSaving = null)
await SessionUtility.SaveSerializedSessionMetaDataAsync(sessionJsonStr);
_lastSessionJsonStr = sessionJsonStr;
sessionDataSaved = true;

}
}
catch (Exception ex)
Expand Down Expand Up @@ -474,4 +473,4 @@ private void RemoveTextEditorSessionData(object sender, EventArgs e)
}
}
}
}
}
5 changes: 2 additions & 3 deletions src/Notepads/Core/TabContextFlyout.cs
@@ -1,5 +1,4 @@

namespace Notepads.Core
namespace Notepads.Core
{
using System;
using System.IO;
Expand Down Expand Up @@ -213,4 +212,4 @@ private void ExecuteOnAllTextEditors(Action<ITextEditor> action)
}
}
}
}
}
24 changes: 24 additions & 0 deletions src/Notepads/Extensions/DiffViewer/BrushFactory.cs
@@ -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];
}
}
}
}
3 changes: 1 addition & 2 deletions src/Notepads/Extensions/DiffViewer/ISideBySideDiffViewer.cs
@@ -1,5 +1,4 @@

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

0 comments on commit 0ba3ac2

Please sign in to comment.