chore: use file-scoped namespace

This commit is contained in:
NaBian committed 2022-03-13 20:28:58 +08:00
1 parent 99d2fafb72
commit bbf1b7d4c6
748 files changed
+57929 -58678

No files matched your search

@@ -1,35 +1,34 @@
using System.Windows;
using HandyControlDemo.Tools;
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class AboutWindow
{
public partial class AboutWindow
public AboutWindow()
{
public AboutWindow()
{
InitializeComponent();
InitializeComponent();
DataContext = this;
CopyRight = VersionHelper.GetCopyright();
Version = VersionHelper.GetVersion();
}
public static readonly DependencyProperty CopyRightProperty = DependencyProperty.Register(
"CopyRight", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
public string CopyRight
{
get => (string) GetValue(CopyRightProperty);
set => SetValue(CopyRightProperty, value);
}
public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(
"Version", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
public string Version
{
get => (string) GetValue(VersionProperty);
set => SetValue(VersionProperty, value);
}
DataContext = this;
CopyRight = VersionHelper.GetCopyright();
Version = VersionHelper.GetVersion();
}
}
public static readonly DependencyProperty CopyRightProperty = DependencyProperty.Register(
"CopyRight", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
public string CopyRight
{
get => (string) GetValue(CopyRightProperty);
set => SetValue(CopyRightProperty, value);
}
public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(
"Version", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
public string Version
{
get => (string) GetValue(VersionProperty);
set => SetValue(VersionProperty, value);
}
}
@@ -1,10 +1,9 @@
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class BlurWindow
{
public partial class BlurWindow
public BlurWindow()
{
public BlurWindow()
{
InitializeComponent();
}
InitializeComponent();
}
}
}
@@ -1,10 +1,9 @@
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class CommonWindow
{
public partial class CommonWindow
public CommonWindow()
{
public CommonWindow()
{
InitializeComponent();
}
InitializeComponent();
}
}
}
@@ -1,10 +1,9 @@
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class CustomNonClientAreaWindow
{
public partial class CustomNonClientAreaWindow
public CustomNonClientAreaWindow()
{
public CustomNonClientAreaWindow()
{
InitializeComponent();
}
InitializeComponent();
}
}
}
@@ -3,26 +3,25 @@ using System.Windows;
using HandyControl.Controls;
using HandyControlDemo.Data;
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class DialogDemoWindow
{
public partial class DialogDemoWindow
public DialogDemoWindow()
{
public DialogDemoWindow()
{
InitializeComponent();
InitializeComponent();
var dialogToken = $"{MessageToken.DialogDemoWindow}+{DateTime.Now:yyyyMMddHHmmssfff}";
DialogToken = dialogToken;
Dialog.SetToken(this, dialogToken);
}
public static readonly DependencyProperty DialogTokenProperty = DependencyProperty.Register(
"DialogToken", typeof(string), typeof(DialogDemoWindow), new PropertyMetadata(default(string)));
public string DialogToken
{
get => (string) GetValue(DialogTokenProperty);
set => SetValue(DialogTokenProperty, value);
}
var dialogToken = $"{MessageToken.DialogDemoWindow}+{DateTime.Now:yyyyMMddHHmmssfff}";
DialogToken = dialogToken;
Dialog.SetToken(this, dialogToken);
}
}
public static readonly DependencyProperty DialogTokenProperty = DependencyProperty.Register(
"DialogToken", typeof(string), typeof(DialogDemoWindow), new PropertyMetadata(default(string)));
public string DialogToken
{
get => (string) GetValue(DialogTokenProperty);
set => SetValue(DialogTokenProperty, value);
}
}
@@ -1,10 +1,9 @@
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class GlowWindow
{
public partial class GlowWindow
public GlowWindow()
{
public GlowWindow()
{
InitializeComponent();
}
InitializeComponent();
}
}
}
@@ -1,10 +1,9 @@
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class GrowlDemoWindow
{
public partial class GrowlDemoWindow
public GrowlDemoWindow()
{
public GrowlDemoWindow()
{
InitializeComponent();
}
InitializeComponent();
}
}
}
@@ -1,10 +1,9 @@
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class NativeCommonWindow
{
public partial class NativeCommonWindow
public NativeCommonWindow()
{
public NativeCommonWindow()
{
InitializeComponent();
}
InitializeComponent();
}
}
}
@@ -4,53 +4,52 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using HandyControl.Tools.Extension;
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class NavigationWindow
{
public partial class NavigationWindow
private readonly List<Page> _pageList;
public NavigationWindow()
{
private readonly List<Page> _pageList;
InitializeComponent();
public NavigationWindow()
AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(Button_Click));
_pageList = new List<Page>();
for (var i = 0; i < 5; i++)
{
InitializeComponent();
AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(Button_Click));
_pageList = new List<Page>();
for (var i = 0; i < 5; i++)
{
_pageList.Add(CreatePage(i));
}
Navigate(_pageList[0]);
_pageList.Add(CreatePage(i));
}
private Page CreatePage(int index)
{
var indexStr = index.ToString();
var button = new Button
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Content = indexStr,
Width = 320,
Tag = indexStr
};
Navigate(_pageList[0]);
}
return new Page
{
Title = indexStr,
Content = button
};
}
private void Button_Click(object sender, RoutedEventArgs e)
private Page CreatePage(int index)
{
var indexStr = index.ToString();
var button = new Button
{
if (e.OriginalSource is Button button && button.Tag is string tag)
{
var index = tag.Value<int>() + 1;
Navigate(index >= _pageList.Count ? _pageList[0] : _pageList[index]);
}
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Content = indexStr,
Width = 320,
Tag = indexStr
};
return new Page
{
Title = indexStr,
Content = button
};
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is Button button && button.Tag is string tag)
{
var index = tag.Value<int>() + 1;
Navigate(index >= _pageList.Count ? _pageList[0] : _pageList[index]);
}
}
}
}
@@ -1,14 +1,13 @@
using System.Windows;
namespace HandyControlDemo.Window
{
public partial class NoNonClientAreaDragableWindow
{
public NoNonClientAreaDragableWindow()
{
InitializeComponent();
}
namespace HandyControlDemo.Window;
private void ButtonClose_OnClick(object sender, RoutedEventArgs e) => Close();
public partial class NoNonClientAreaDragableWindow
{
public NoNonClientAreaDragableWindow()
{
InitializeComponent();
}
}
private void ButtonClose_OnClick(object sender, RoutedEventArgs e) => Close();
}
@@ -1,32 +1,31 @@
using System.Windows.Input;
using HandyControl.Tools;
namespace HandyControlDemo.Window
namespace HandyControlDemo.Window;
public partial class TouchDragMoveWindow
{
public partial class TouchDragMoveWindow
private int _currentTouchCount;
public TouchDragMoveWindow()
{
private int _currentTouchCount;
InitializeComponent();
public TouchDragMoveWindow()
{
InitializeComponent();
TouchDown += MainWindow_TouchDown;
TouchUp += MainWindow_TouchUp;
}
private void MainWindow_TouchUp(object sender, TouchEventArgs e)
{
_currentTouchCount--;
}
private void MainWindow_TouchDown(object sender, TouchEventArgs e)
{
CaptureTouch(e.TouchDevice);
if (_currentTouchCount == 0) this.TouchDragMove();
_currentTouchCount++;
}
TouchDown += MainWindow_TouchDown;
TouchUp += MainWindow_TouchUp;
}
}
private void MainWindow_TouchUp(object sender, TouchEventArgs e)
{
_currentTouchCount--;
}
private void MainWindow_TouchDown(object sender, TouchEventArgs e)
{
CaptureTouch(e.TouchDevice);
if (_currentTouchCount == 0) this.TouchDragMove();
_currentTouchCount++;
}
}