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,14 +1,13 @@
using System;
using HandyControl.Data;
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
internal class AppConfig
{
internal class AppConfig
{
public static readonly string SavePath = $"{AppDomain.CurrentDomain.BaseDirectory}AppConfig.json";
public static readonly string SavePath = $"{AppDomain.CurrentDomain.BaseDirectory}AppConfig.json";
public string Lang { get; set; } = "zh-cn";
public string Lang { get; set; } = "zh-cn";
public SkinType Skin { get; set; }
}
}
public SkinType Skin { get; set; }
}
@@ -1,13 +1,12 @@
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public enum DemoType
{
public enum DemoType
{
Type1 = 1,
Type2,
Type3,
Type4,
Type5,
Type6
}
}
Type1 = 1,
Type2,
Type3,
Type4,
Type5,
Type6
}
@@ -1,38 +1,37 @@
using System.IO;
using Newtonsoft.Json;
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
internal class GlobalData
{
internal class GlobalData
public static void Init()
{
public static void Init()
if (File.Exists(AppConfig.SavePath))
{
if (File.Exists(AppConfig.SavePath))
try
{
try
{
var json = File.ReadAllText(AppConfig.SavePath);
Config = (string.IsNullOrEmpty(json) ? new AppConfig() : JsonConvert.DeserializeObject<AppConfig>(json)) ?? new AppConfig();
}
catch
{
Config = new AppConfig();
}
var json = File.ReadAllText(AppConfig.SavePath);
Config = (string.IsNullOrEmpty(json) ? new AppConfig() : JsonConvert.DeserializeObject<AppConfig>(json)) ?? new AppConfig();
}
else
catch
{
Config = new AppConfig();
}
}
public static void Save()
else
{
var json = JsonConvert.SerializeObject(Config);
File.WriteAllText(AppConfig.SavePath, json);
Config = new AppConfig();
}
public static AppConfig Config { get; set; }
public static bool NotifyIconIsShow { get; set; }
}
}
public static void Save()
{
var json = JsonConvert.SerializeObject(Config);
File.WriteAllText(AppConfig.SavePath, json);
}
public static AppConfig Config { get; set; }
public static bool NotifyIconIsShow { get; set; }
}
@@ -1,58 +1,57 @@
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public class MessageToken
{
public class MessageToken
{
public static readonly string LoadShowContent = nameof(LoadShowContent);
public static readonly string LoadShowContent = nameof(LoadShowContent);
public static readonly string FullSwitch = nameof(FullSwitch);
public static readonly string FullSwitch = nameof(FullSwitch);
public static readonly string ContributorsView = nameof(ContributorsView);
public static readonly string ContributorsView = nameof(ContributorsView);
public static readonly string ClearLeftSelected = nameof(ClearLeftSelected);
public static readonly string ClearLeftSelected = nameof(ClearLeftSelected);
public static readonly string SendChatMessage = nameof(SendChatMessage);
public static readonly string SendChatMessage = nameof(SendChatMessage);
public static readonly string GrowlDemoPanel = nameof(GrowlDemoPanel);
public static readonly string GrowlDemoPanel = nameof(GrowlDemoPanel);
public static readonly string DialogDemoWindow = nameof(DialogDemoWindow);
public static readonly string DialogDemoWindow = nameof(DialogDemoWindow);
public static readonly string MainWindow = nameof(MainWindow);
public static readonly string MainWindow = nameof(MainWindow);
public static readonly string PracticalDemo = nameof(PracticalDemo);
public static readonly string PracticalDemo = nameof(PracticalDemo);
public static readonly string ProjectsView = nameof(ProjectsView);
public static readonly string ProjectsView = nameof(ProjectsView);
public static readonly string BlogsView = nameof(BlogsView);
public static readonly string BlogsView = nameof(BlogsView);
public static readonly string WebsitesView = nameof(WebsitesView);
public static readonly string WebsitesView = nameof(WebsitesView);
public static readonly string NotifyIconDemo = nameof(NotifyIconDemo);
public static readonly string NotifyIconDemo = nameof(NotifyIconDemo);
public static readonly string NotifyIconContextDemo = nameof(NotifyIconContextDemo);
public static readonly string NotifyIconContextDemo = nameof(NotifyIconContextDemo);
public static readonly string CommonWindow = nameof(CommonWindow);
public static readonly string CommonWindow = nameof(CommonWindow);
public static readonly string BlurWindow = nameof(BlurWindow);
public static readonly string BlurWindow = nameof(BlurWindow);
public static readonly string CustomNonClientAreaWindow = nameof(CustomNonClientAreaWindow);
public static readonly string CustomNonClientAreaWindow = nameof(CustomNonClientAreaWindow);
public static readonly string NoNonClientAreaDragableWindow = nameof(NoNonClientAreaDragableWindow);
public static readonly string NoNonClientAreaDragableWindow = nameof(NoNonClientAreaDragableWindow);
public static readonly string QQGroupView = nameof(QQGroupView);
public static readonly string QQGroupView = nameof(QQGroupView);
public static readonly string GlowWindow = nameof(GlowWindow);
public static readonly string GlowWindow = nameof(GlowWindow);
public static readonly string NativeCommonWindow = nameof(NativeCommonWindow);
public static readonly string NativeCommonWindow = nameof(NativeCommonWindow);
public static readonly string NavigationWindow = nameof(NavigationWindow);
public static readonly string NavigationWindow = nameof(NavigationWindow);
public static readonly string TouchDragMoveWindow = nameof(TouchDragMoveWindow);
public static readonly string TouchDragMoveWindow = nameof(TouchDragMoveWindow);
public static readonly string DialogContainer = nameof(DialogContainer);
public static readonly string DialogContainer = nameof(DialogContainer);
public static readonly string LangUpdated = nameof(LangUpdated);
public static readonly string LangUpdated = nameof(LangUpdated);
public static readonly string SkinUpdated = nameof(SkinUpdated);
public static readonly string SkinUpdated = nameof(SkinUpdated);
}
}
}
@@ -1,12 +1,11 @@
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public class AvatarModel
{
public class AvatarModel
{
public string DisplayName { get; set; }
public string DisplayName { get; set; }
public string Link { get; set; }
public string Link { get; set; }
public string AvatarUri { get; set; }
}
}
public string AvatarUri { get; set; }
}
@@ -1,11 +1,10 @@
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public class CardModel
{
public class CardModel
{
public string Header { get; set; }
public string Header { get; set; }
public string Content { get; set; }
public string Content { get; set; }
public string Footer { get; set; }
}
}
public string Footer { get; set; }
}
@@ -1,17 +1,16 @@
using HandyControl.Data;
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public struct ChatInfoModel
{
public struct ChatInfoModel
{
public object Message { get; set; }
public object Message { get; set; }
public string SenderId { get; set; }
public string SenderId { get; set; }
public ChatRoleType Role { get; set; }
public ChatRoleType Role { get; set; }
public ChatMessageType Type { get; set; }
public ChatMessageType Type { get; set; }
public object Enclosure { get; set; }
}
}
public object Enclosure { get; set; }
}
@@ -1,9 +1,8 @@
namespace HandyControlDemo.Data
{
public class CoverViewDemoModel
{
public string ImgPath { get; set; }
namespace HandyControlDemo.Data;
public string BackgroundToken { get; set; }
}
}
public class CoverViewDemoModel
{
public string ImgPath { get; set; }
public string BackgroundToken { get; set; }
}
@@ -1,22 +1,21 @@
using System.Collections.Generic;
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public class DemoDataModel
{
public class DemoDataModel
{
public int Index { get; set; }
public int Index { get; set; }
public string Name { get; set; }
public string Name { get; set; }
public bool IsSelected { get; set; }
public bool IsSelected { get; set; }
public string Remark { get; set; }
public string Remark { get; set; }
public DemoType Type { get; set; }
public DemoType Type { get; set; }
public string ImgPath { get; set; }
public string ImgPath { get; set; }
public List<DemoDataModel> DataList { get; set; }
}
}
public List<DemoDataModel> DataList { get; set; }
}
@@ -1,38 +1,37 @@
using System.Collections.Generic;
using GalaSoft.MvvmLight;
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public class DemoInfoModel : ViewModelBase
{
public class DemoInfoModel : ViewModelBase
public string Key { get; set; }
private string _title;
public string Title
{
public string Key { get; set; }
private string _title;
public string Title
{
get => _title;
get => _title;
#if NET40
set => Set(nameof(Title), ref _title, value);
#else
set => Set(ref _title, value);
set => Set(ref _title, value);
#endif
}
}
private int _selectedIndex;
private int _selectedIndex;
public int SelectedIndex
{
get => _selectedIndex;
public int SelectedIndex
{
get => _selectedIndex;
#if NET40
set => Set(nameof(SelectedIndex), ref _selectedIndex, value);
#else
set => Set(ref _selectedIndex, value);
set => Set(ref _selectedIndex, value);
#endif
}
public bool IsGroupEnabled { get; set; }
public IList<DemoItemModel> DemoItemList { get; set; }
}
}
public bool IsGroupEnabled { get; set; }
public IList<DemoItemModel> DemoItemList { get; set; }
}
@@ -1,40 +1,39 @@
using GalaSoft.MvvmLight;
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public class DemoItemModel : ObservableObject
{
public class DemoItemModel : ObservableObject
private bool _isVisible = true;
private string _queriesText = string.Empty;
public string Name { get; set; }
public string GroupName { get; set; }
public string TargetCtlName { get; set; }
public string ImageName { get; set; }
public bool IsNew { get; set; }
public string QueriesText
{
private bool _isVisible = true;
private string _queriesText = string.Empty;
public string Name { get; set; }
public string GroupName { get; set; }
public string TargetCtlName { get; set; }
public string ImageName { get; set; }
public bool IsNew { get; set; }
public string QueriesText
{
get => _queriesText;
get => _queriesText;
#if NET40
set => Set(nameof(QueriesText), ref _queriesText, value);
set => Set(nameof(QueriesText), ref _queriesText, value);
#else
set => Set(ref _queriesText, value);
#endif
}
}
public bool IsVisible
{
get => _isVisible;
public bool IsVisible
{
get => _isVisible;
#if NET40
set => Set(nameof(IsVisible), ref _isVisible, value);
set => Set(nameof(IsVisible), ref _isVisible, value);
#else
set => Set(ref _isVisible, value);
#endif
}
}
}
}
@@ -1,13 +1,12 @@
using System.Windows.Media;
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public class GeometryItemModel
{
public class GeometryItemModel
{
public Geometry Data { get; set; }
public Geometry Data { get; set; }
public string Key { get; set; }
public string Key { get; set; }
public bool Line { get; set; }
}
}
public bool Line { get; set; }
}
@@ -2,32 +2,31 @@
using System.Windows;
using System.Windows.Media;
namespace HandyControlDemo.Data
namespace HandyControlDemo.Data;
public class PropertyGridDemoModel
{
public class PropertyGridDemoModel
{
[Category("Category1")]
public string String { get; set; }
[Category("Category1")]
public string String { get; set; }
[Category("Category2")]
public int Integer { get; set; }
[Category("Category2")]
public int Integer { get; set; }
[Category("Category2")]
public bool Boolean { get; set; }
[Category("Category2")]
public bool Boolean { get; set; }
[Category("Category1")]
public Gender Enum { get; set; }
[Category("Category1")]
public Gender Enum { get; set; }
public HorizontalAlignment HorizontalAlignment { get; set; }
public HorizontalAlignment HorizontalAlignment { get; set; }
public VerticalAlignment VerticalAlignment { get; set; }
public VerticalAlignment VerticalAlignment { get; set; }
public ImageSource ImageSource { get; set; }
}
public enum Gender
{
Male,
Female
}
public ImageSource ImageSource { get; set; }
}
public enum Gender
{
Male,
Female
}
@@ -1,9 +1,8 @@
namespace HandyControlDemo.Data
{
public class StepBarDemoModel
{
public string Header { get; set; }
namespace HandyControlDemo.Data;
public string Content { get; set; }
}
}
public class StepBarDemoModel
{
public string Header { get; set; }
public string Content { get; set; }
}
@@ -1,9 +1,8 @@
namespace HandyControlDemo.Data
{
public class TabControlDemoModel
{
public string Header { get; set; }
namespace HandyControlDemo.Data;
public string BackgroundToken { get; set; }
}
}
public class TabControlDemoModel
{
public string Header { get; set; }
public string BackgroundToken { get; set; }
}