mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-12-02 03:47:48 +08:00
chore: use file-scoped namespace
This commit is contained in:
parent
99d2fafb72
commit
bbf1b7d4c6
@ -15,17 +15,17 @@ using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Properties.Langs;
|
||||
using HandyControlDemo.Tools;
|
||||
|
||||
namespace HandyControlDemo
|
||||
namespace HandyControlDemo;
|
||||
|
||||
public partial class App
|
||||
{
|
||||
public partial class App
|
||||
{
|
||||
#pragma warning disable IDE0052
|
||||
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
|
||||
private static Mutex AppMutex;
|
||||
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
|
||||
private static Mutex AppMutex;
|
||||
#pragma warning restore IDE0052
|
||||
|
||||
public App()
|
||||
{
|
||||
public App()
|
||||
{
|
||||
#if !NET40
|
||||
var cachePath = $"{AppDomain.CurrentDomain.BaseDirectory}Cache";
|
||||
if (!Directory.Exists(cachePath))
|
||||
@ -35,106 +35,105 @@ namespace HandyControlDemo
|
||||
ProfileOptimization.SetProfileRoot(cachePath);
|
||||
ProfileOptimization.StartProfile("Profile");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
AppMutex = new Mutex(true, "HandyControlDemo", out var createdNew);
|
||||
|
||||
if (!createdNew)
|
||||
{
|
||||
AppMutex = new Mutex(true, "HandyControlDemo", out var createdNew);
|
||||
var current = Process.GetCurrentProcess();
|
||||
|
||||
if (!createdNew)
|
||||
foreach (var process in Process.GetProcessesByName(current.ProcessName))
|
||||
{
|
||||
var current = Process.GetCurrentProcess();
|
||||
|
||||
foreach (var process in Process.GetProcessesByName(current.ProcessName))
|
||||
if (process.Id != current.Id)
|
||||
{
|
||||
if (process.Id != current.Id)
|
||||
{
|
||||
Win32Helper.SetForegroundWindow(process.MainWindowHandle);
|
||||
break;
|
||||
}
|
||||
Win32Helper.SetForegroundWindow(process.MainWindowHandle);
|
||||
break;
|
||||
}
|
||||
Shutdown();
|
||||
}
|
||||
else
|
||||
Shutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
var splashScreen = new SplashScreen("Resources/Img/Cover.png");
|
||||
splashScreen.Show(true);
|
||||
|
||||
base.OnStartup(e);
|
||||
|
||||
UpdateRegistry();
|
||||
|
||||
ShutdownMode = ShutdownMode.OnMainWindowClose;
|
||||
GlobalData.Init();
|
||||
ConfigHelper.Instance.SetLang(GlobalData.Config.Lang);
|
||||
LangProvider.Culture = new CultureInfo(GlobalData.Config.Lang);
|
||||
|
||||
if (GlobalData.Config.Skin != SkinType.Default)
|
||||
{
|
||||
var splashScreen = new SplashScreen("Resources/Img/Cover.png");
|
||||
splashScreen.Show(true);
|
||||
UpdateSkin(GlobalData.Config.Skin);
|
||||
}
|
||||
|
||||
base.OnStartup(e);
|
||||
|
||||
UpdateRegistry();
|
||||
|
||||
ShutdownMode = ShutdownMode.OnMainWindowClose;
|
||||
GlobalData.Init();
|
||||
ConfigHelper.Instance.SetLang(GlobalData.Config.Lang);
|
||||
LangProvider.Culture = new CultureInfo(GlobalData.Config.Lang);
|
||||
|
||||
if (GlobalData.Config.Skin != SkinType.Default)
|
||||
{
|
||||
UpdateSkin(GlobalData.Config.Skin);
|
||||
}
|
||||
|
||||
ConfigHelper.Instance.SetWindowDefaultStyle();
|
||||
ConfigHelper.Instance.SetNavigationWindowDefaultStyle();
|
||||
ConfigHelper.Instance.SetWindowDefaultStyle();
|
||||
ConfigHelper.Instance.SetNavigationWindowDefaultStyle();
|
||||
|
||||
#if NET40
|
||||
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
|
||||
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
|
||||
#else
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
base.OnExit(e);
|
||||
GlobalData.Save();
|
||||
}
|
||||
|
||||
internal void UpdateSkin(SkinType skin)
|
||||
{
|
||||
var skins0 = Resources.MergedDictionaries[0];
|
||||
skins0.MergedDictionaries.Clear();
|
||||
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(skin));
|
||||
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skin));
|
||||
|
||||
var skins1 = Resources.MergedDictionaries[1];
|
||||
skins1.MergedDictionaries.Clear();
|
||||
skins1.MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
base.OnExit(e);
|
||||
GlobalData.Save();
|
||||
}
|
||||
|
||||
internal void UpdateSkin(SkinType skin)
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||
});
|
||||
skins1.MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
var skins0 = Resources.MergedDictionaries[0];
|
||||
skins0.MergedDictionaries.Clear();
|
||||
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(skin));
|
||||
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skin));
|
||||
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
|
||||
});
|
||||
|
||||
var skins1 = Resources.MergedDictionaries[1];
|
||||
skins1.MergedDictionaries.Clear();
|
||||
skins1.MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||
});
|
||||
skins1.MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
|
||||
});
|
||||
Current.MainWindow?.OnApplyTemplate();
|
||||
}
|
||||
|
||||
Current.MainWindow?.OnApplyTemplate();
|
||||
}
|
||||
|
||||
private void UpdateRegistry()
|
||||
private void UpdateRegistry()
|
||||
{
|
||||
var processModule = Process.GetCurrentProcess().MainModule;
|
||||
if (processModule != null)
|
||||
{
|
||||
var processModule = Process.GetCurrentProcess().MainModule;
|
||||
if (processModule != null)
|
||||
var registryFilePath = $"{Path.GetDirectoryName(processModule.FileName)}\\Registry.reg";
|
||||
if (!File.Exists(registryFilePath))
|
||||
{
|
||||
var registryFilePath = $"{Path.GetDirectoryName(processModule.FileName)}\\Registry.reg";
|
||||
if (!File.Exists(registryFilePath))
|
||||
var streamResourceInfo = GetResourceStream(new Uri("pack://application:,,,/Resources/Registry.txt"));
|
||||
if (streamResourceInfo != null)
|
||||
{
|
||||
var streamResourceInfo = GetResourceStream(new Uri("pack://application:,,,/Resources/Registry.txt"));
|
||||
if (streamResourceInfo != null)
|
||||
using var reader = new StreamReader(streamResourceInfo.Stream);
|
||||
var registryStr = reader.ReadToEnd();
|
||||
var newRegistryStr = registryStr.Replace("#", processModule.FileName.Replace("\\", "\\\\"));
|
||||
File.WriteAllText(registryFilePath, newRegistryStr);
|
||||
Process.Start(new ProcessStartInfo("cmd", $"/c {registryFilePath}")
|
||||
{
|
||||
using var reader = new StreamReader(streamResourceInfo.Stream);
|
||||
var registryStr = reader.ReadToEnd();
|
||||
var newRegistryStr = registryStr.Replace("#", processModule.FileName.Replace("\\", "\\\\"));
|
||||
File.WriteAllText(registryFilePath, newRegistryStr);
|
||||
Process.Start(new ProcessStartInfo("cmd", $"/c {registryFilePath}")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
}
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
@ -10,45 +10,44 @@ using HandyControlDemo.Tools;
|
||||
using HandyControlDemo.UserControl;
|
||||
using HandyControlDemo.ViewModel;
|
||||
|
||||
namespace HandyControlDemo
|
||||
namespace HandyControlDemo;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
public MainWindow() => InitializeComponent();
|
||||
|
||||
protected override void OnContentRendered(EventArgs e)
|
||||
{
|
||||
public MainWindow() => InitializeComponent();
|
||||
base.OnContentRendered(e);
|
||||
|
||||
protected override void OnContentRendered(EventArgs e)
|
||||
DataContext = ViewModelLocator.Instance.Main;
|
||||
NonClientAreaContent = new NonClientAreaContent();
|
||||
ControlMain.Content = new MainWindowContent();
|
||||
|
||||
GlobalShortcut.Init(new List<KeyBinding>
|
||||
{
|
||||
base.OnContentRendered(e);
|
||||
new(ViewModelLocator.Instance.Main.GlobalShortcutInfoCmd, Key.I, ModifierKeys.Control | ModifierKeys.Alt),
|
||||
new(ViewModelLocator.Instance.Main.GlobalShortcutWarningCmd, Key.E, ModifierKeys.Control | ModifierKeys.Alt)
|
||||
});
|
||||
|
||||
DataContext = ViewModelLocator.Instance.Main;
|
||||
NonClientAreaContent = new NonClientAreaContent();
|
||||
ControlMain.Content = new MainWindowContent();
|
||||
Dialog.SetToken(this, MessageToken.MainWindow);
|
||||
WindowAttach.SetIgnoreAltF4(this, true);
|
||||
|
||||
GlobalShortcut.Init(new List<KeyBinding>
|
||||
{
|
||||
new(ViewModelLocator.Instance.Main.GlobalShortcutInfoCmd, Key.I, ModifierKeys.Control | ModifierKeys.Alt),
|
||||
new(ViewModelLocator.Instance.Main.GlobalShortcutWarningCmd, Key.E, ModifierKeys.Control | ModifierKeys.Alt)
|
||||
});
|
||||
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.PracticalDemo}"), MessageToken.LoadShowContent);
|
||||
}
|
||||
|
||||
Dialog.SetToken(this, MessageToken.MainWindow);
|
||||
WindowAttach.SetIgnoreAltF4(this, true);
|
||||
|
||||
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.PracticalDemo}"), MessageToken.LoadShowContent);
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
if (GlobalData.NotifyIconIsShow)
|
||||
{
|
||||
MessageBox.Info(Properties.Langs.Lang.AppClosingTip, Properties.Langs.Lang.Tip);
|
||||
Hide();
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
else
|
||||
{
|
||||
if (GlobalData.NotifyIconIsShow)
|
||||
{
|
||||
MessageBox.Info(Properties.Langs.Lang.AppClosingTip, Properties.Langs.Lang.Tip);
|
||||
Hide();
|
||||
e.Cancel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnClosing(e);
|
||||
}
|
||||
base.OnClosing(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -4,16 +4,15 @@ using HandyControl.Data;
|
||||
using HandyControl.Themes;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControlDemo.Resources
|
||||
{
|
||||
public class DemoTheme : Theme
|
||||
{
|
||||
public override ResourceDictionary GetSkin(SkinType skinType) =>
|
||||
ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skinType);
|
||||
namespace HandyControlDemo.Resources;
|
||||
|
||||
public override ResourceDictionary GetTheme() => new()
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
|
||||
};
|
||||
}
|
||||
}
|
||||
public class DemoTheme : Theme
|
||||
{
|
||||
public override ResourceDictionary GetSkin(SkinType skinType) =>
|
||||
ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skinType);
|
||||
|
||||
public override ResourceDictionary GetTheme() => new()
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
|
||||
};
|
||||
}
|
@ -12,431 +12,430 @@ using HandyControlDemo.Properties.Langs;
|
||||
using HandyControlDemo.Tools.Converter;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HandyControlDemo.Service
|
||||
namespace HandyControlDemo.Service;
|
||||
|
||||
public class DataService
|
||||
{
|
||||
public class DataService
|
||||
internal ObservableCollection<TabControlDemoModel> GetTabControlDemoDataList()
|
||||
{
|
||||
internal ObservableCollection<TabControlDemoModel> GetTabControlDemoDataList()
|
||||
return new()
|
||||
{
|
||||
return new()
|
||||
new TabControlDemoModel
|
||||
{
|
||||
new TabControlDemoModel
|
||||
{
|
||||
Header = "Success",
|
||||
BackgroundToken = ResourceToken.SuccessBrush
|
||||
},
|
||||
new TabControlDemoModel
|
||||
{
|
||||
Header = "Primary",
|
||||
BackgroundToken = ResourceToken.PrimaryBrush
|
||||
},
|
||||
new TabControlDemoModel
|
||||
{
|
||||
Header = "Warning",
|
||||
BackgroundToken = ResourceToken.WarningBrush
|
||||
},
|
||||
new TabControlDemoModel
|
||||
{
|
||||
Header = "Danger",
|
||||
BackgroundToken = ResourceToken.DangerBrush
|
||||
},
|
||||
new TabControlDemoModel
|
||||
{
|
||||
Header = "Info",
|
||||
BackgroundToken = ResourceToken.InfoBrush
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<DemoDataModel> GetDemoDataList()
|
||||
{
|
||||
var list = new List<DemoDataModel>();
|
||||
for (var i = 1; i <= 20; i++)
|
||||
Header = "Success",
|
||||
BackgroundToken = ResourceToken.SuccessBrush
|
||||
},
|
||||
new TabControlDemoModel
|
||||
{
|
||||
var dataList = new List<DemoDataModel>();
|
||||
for (var j = 0; j < 3; j++)
|
||||
{
|
||||
dataList.Add(new DemoDataModel
|
||||
{
|
||||
Index = j,
|
||||
IsSelected = j % 2 == 0,
|
||||
Name = $"SubName{j}",
|
||||
Type = (DemoType) j
|
||||
});
|
||||
}
|
||||
var model = new DemoDataModel
|
||||
{
|
||||
Index = i,
|
||||
IsSelected = i % 2 == 0,
|
||||
Name = $"Name{i}",
|
||||
Type = (DemoType) (i % 6 + 1),
|
||||
DataList = dataList,
|
||||
ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{i % 6 + 1}.png",
|
||||
Remark = new string(i.ToString()[0], 10)
|
||||
};
|
||||
list.Add(model);
|
||||
Header = "Primary",
|
||||
BackgroundToken = ResourceToken.PrimaryBrush
|
||||
},
|
||||
new TabControlDemoModel
|
||||
{
|
||||
Header = "Warning",
|
||||
BackgroundToken = ResourceToken.WarningBrush
|
||||
},
|
||||
new TabControlDemoModel
|
||||
{
|
||||
Header = "Danger",
|
||||
BackgroundToken = ResourceToken.DangerBrush
|
||||
},
|
||||
new TabControlDemoModel
|
||||
{
|
||||
Header = "Info",
|
||||
BackgroundToken = ResourceToken.InfoBrush
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
internal List<DemoDataModel> GetDemoDataList(int count)
|
||||
internal List<DemoDataModel> GetDemoDataList()
|
||||
{
|
||||
var list = new List<DemoDataModel>();
|
||||
for (var i = 1; i <= 20; i++)
|
||||
{
|
||||
var list = new List<DemoDataModel>();
|
||||
for (var i = 1; i <= count; i++)
|
||||
var dataList = new List<DemoDataModel>();
|
||||
for (var j = 0; j < 3; j++)
|
||||
{
|
||||
var index = i % 6 + 1;
|
||||
var model = new DemoDataModel
|
||||
dataList.Add(new DemoDataModel
|
||||
{
|
||||
Index = i,
|
||||
IsSelected = i % 2 == 0,
|
||||
Name = $"Name{i}",
|
||||
Type = (DemoType) index,
|
||||
ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{index}.png",
|
||||
Remark = new string(i.ToString()[0], 10)
|
||||
};
|
||||
list.Add(model);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetContributorDataList()
|
||||
{
|
||||
var client = new WebClient();
|
||||
client.Headers.Add("User-Agent", "request");
|
||||
var list = new List<AvatarModel>();
|
||||
try
|
||||
{
|
||||
var json = client.DownloadString(new Uri("https://api.github.com/repos/nabian/handycontrol/contributors"));
|
||||
var objList = JsonConvert.DeserializeObject<List<dynamic>>(json);
|
||||
list.AddRange(objList.Select(item => new AvatarModel
|
||||
{
|
||||
DisplayName = item.login,
|
||||
AvatarUri = item.avatar_url,
|
||||
Link = item.html_url
|
||||
}));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error(e.Message, Lang.Error);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetBlogDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "林德熙",
|
||||
AvatarUri = "https://avatars3.githubusercontent.com/u/16054566?s=400&v=4",
|
||||
Link = "https://blog.lindexi.com/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "吕毅",
|
||||
AvatarUri = "https://avatars2.githubusercontent.com/u/9959623?s=400&v=4",
|
||||
Link = "https://blog.walterlv.com/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "DinoChan",
|
||||
AvatarUri = "https://avatars1.githubusercontent.com/u/6076257?s=400&v=4",
|
||||
Link = "https://www.cnblogs.com/dino623/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "noctwolf",
|
||||
AvatarUri = "https://avatars3.githubusercontent.com/u/21022467?s=400&v=4",
|
||||
Link = "https://www.cnblogs.com/noctwolf/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "关关长语",
|
||||
AvatarUri = "https://avatars3.githubusercontent.com/u/25916858?s=400&v=4",
|
||||
Link = "https://blog.csdn.net/qq_28806349/category_11213909.html"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetProjectDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "phpEnv",
|
||||
AvatarUri = "https://cdn.phpenv.cn:444/logo.png",
|
||||
Link = "https://www.phpenv.cn/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "AutumnBox",
|
||||
AvatarUri = "https://raw.githubusercontent.com/zsh2401/AutumnBox/master/src/AutumnBox.GUI/Resources/Images/icon.png",
|
||||
Link = "https://github.com/zsh2401/AutumnBox"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "quicker",
|
||||
AvatarUri = "https://files.getquicker.net/_sitefiles/quicker_round_128.png",
|
||||
Link = "https://getquicker.net"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetWebsiteDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "Dotnet9",
|
||||
AvatarUri = "https://pic.cnblogs.com/avatar/1663243/20191124121029.png",
|
||||
Link = "https://dotnet9.com/"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal ObservableCollection<CardModel> GetCardDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new CardModel
|
||||
{
|
||||
Header = "Atomic",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/1.jpg",
|
||||
Footer = "Stive Morgan"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Zinderlong",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/2.jpg",
|
||||
Footer = "Zonderling"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Busy Doin' Nothin'",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/3.jpg",
|
||||
Footer = "Ace Wilder"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Wrong",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/4.jpg",
|
||||
Footer = "Blaxy Girls"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "The Lights",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/5.jpg",
|
||||
Footer = "Panda Eyes"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "EA7-50-Cent Disco",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/6.jpg",
|
||||
Footer = "еяхат музыка"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Monsters",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/7.jpg",
|
||||
Footer = "Different Heaven"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Gangsta Walk",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/8.jpg",
|
||||
Footer = "Illusionize"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Won't Back Down",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/9.jpg",
|
||||
Footer = "Boehm / Benjamin Francis Leftwich"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Katchi",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/10.jpg",
|
||||
Footer = "Ofenbach / Nick Waterhouse"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal CardModel GetCardData()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Content = $"/HandyControlDemo;component/Resources/Img/Album/{DateTime.Now.Second % 10 + 1}.jpg"
|
||||
};
|
||||
}
|
||||
|
||||
internal List<StepBarDemoModel> GetStepBarDemoDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new StepBarDemoModel
|
||||
{
|
||||
Header = LangKeys.Step,
|
||||
Content = LangKeys.Register
|
||||
},
|
||||
new StepBarDemoModel
|
||||
{
|
||||
Header = LangKeys.Step,
|
||||
Content = LangKeys.BasicInfo
|
||||
},
|
||||
new StepBarDemoModel
|
||||
{
|
||||
Header = LangKeys.Step,
|
||||
Content = LangKeys.UploadFile
|
||||
},
|
||||
new StepBarDemoModel
|
||||
{
|
||||
Header = LangKeys.Step,
|
||||
Content = LangKeys.Complete
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal ObservableCollection<CoverViewDemoModel> GetCoverViewDemoDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/1.jpg",
|
||||
BackgroundToken = ResourceToken.SuccessBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/2.jpg",
|
||||
BackgroundToken = ResourceToken.PrimaryBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/3.jpg",
|
||||
BackgroundToken = ResourceToken.WarningBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/4.jpg",
|
||||
BackgroundToken = ResourceToken.DangerBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/5.jpg",
|
||||
BackgroundToken = ResourceToken.SuccessBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/6.jpg",
|
||||
BackgroundToken = ResourceToken.PrimaryBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/7.jpg",
|
||||
BackgroundToken = ResourceToken.InfoBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/8.jpg",
|
||||
BackgroundToken = ResourceToken.WarningBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/9.jpg",
|
||||
BackgroundToken = ResourceToken.PrimaryBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/10.jpg",
|
||||
BackgroundToken = ResourceToken.DangerBrush
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<DemoInfoModel> GetDemoInfo()
|
||||
{
|
||||
var infoList = new List<DemoInfoModel>();
|
||||
|
||||
var stream = Application.GetResourceStream(new Uri("Data/DemoInfo.json", UriKind.Relative))?.Stream;
|
||||
if (stream == null) return infoList;
|
||||
|
||||
string jsonStr;
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
jsonStr = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
var jsonObj = JsonConvert.DeserializeObject<dynamic>(jsonStr);
|
||||
foreach (var item in jsonObj)
|
||||
{
|
||||
var titleKey = (string) item.title;
|
||||
var title = titleKey;
|
||||
List<DemoItemModel> list = Convert2DemoItemList(item.demoItemList);
|
||||
|
||||
var demoInfoModel = new DemoInfoModel
|
||||
{
|
||||
Key = titleKey,
|
||||
Title = title,
|
||||
DemoItemList = list,
|
||||
SelectedIndex = (int) item.selectedIndex,
|
||||
IsGroupEnabled = (bool) item.group
|
||||
};
|
||||
|
||||
infoList.Add(demoInfoModel);
|
||||
}
|
||||
|
||||
return infoList;
|
||||
}
|
||||
|
||||
private List<DemoItemModel> Convert2DemoItemList(dynamic list)
|
||||
{
|
||||
var resultList = new List<DemoItemModel>();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
var name = (string) item[0];
|
||||
string targetCtlName = item[1];
|
||||
string imageName = item[2];
|
||||
var isNew = !string.IsNullOrEmpty((string) item[3]);
|
||||
var groupName = (string) item[4];
|
||||
if (string.IsNullOrEmpty(groupName))
|
||||
{
|
||||
groupName = "Misc";
|
||||
}
|
||||
|
||||
resultList.Add(new DemoItemModel
|
||||
{
|
||||
Name = name,
|
||||
TargetCtlName = targetCtlName,
|
||||
ImageName = $"../../Resources/Img/LeftMainContent/{imageName}.png",
|
||||
IsNew = isNew,
|
||||
GroupName = groupName
|
||||
Index = j,
|
||||
IsSelected = j % 2 == 0,
|
||||
Name = $"SubName{j}",
|
||||
Type = (DemoType) j
|
||||
});
|
||||
}
|
||||
|
||||
return resultList;
|
||||
var model = new DemoDataModel
|
||||
{
|
||||
Index = i,
|
||||
IsSelected = i % 2 == 0,
|
||||
Name = $"Name{i}",
|
||||
Type = (DemoType) (i % 6 + 1),
|
||||
DataList = dataList,
|
||||
ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{i % 6 + 1}.png",
|
||||
Remark = new string(i.ToString()[0], 10)
|
||||
};
|
||||
list.Add(model);
|
||||
}
|
||||
|
||||
public string GetDemoUrl(DemoInfoModel demoInfo, DemoItemModel demoItem)
|
||||
return list;
|
||||
}
|
||||
|
||||
internal List<DemoDataModel> GetDemoDataList(int count)
|
||||
{
|
||||
var list = new List<DemoDataModel>();
|
||||
for (var i = 1; i <= count; i++)
|
||||
{
|
||||
var key = demoInfo.Key switch
|
||||
var index = i % 6 + 1;
|
||||
var model = new DemoDataModel
|
||||
{
|
||||
"Styles" => "native_controls",
|
||||
"Controls" => "extend_controls",
|
||||
"Tools" => "tools",
|
||||
_ => string.Empty
|
||||
Index = i,
|
||||
IsSelected = i % 2 == 0,
|
||||
Name = $"Name{i}",
|
||||
Type = (DemoType) index,
|
||||
ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{index}.png",
|
||||
Remark = new string(i.ToString()[0], 10)
|
||||
};
|
||||
list.Add(model);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetContributorDataList()
|
||||
{
|
||||
var client = new WebClient();
|
||||
client.Headers.Add("User-Agent", "request");
|
||||
var list = new List<AvatarModel>();
|
||||
try
|
||||
{
|
||||
var json = client.DownloadString(new Uri("https://api.github.com/repos/nabian/handycontrol/contributors"));
|
||||
var objList = JsonConvert.DeserializeObject<List<dynamic>>(json);
|
||||
list.AddRange(objList.Select(item => new AvatarModel
|
||||
{
|
||||
DisplayName = item.login,
|
||||
AvatarUri = item.avatar_url,
|
||||
Link = item.html_url
|
||||
}));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error(e.Message, Lang.Error);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetBlogDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "林德熙",
|
||||
AvatarUri = "https://avatars3.githubusercontent.com/u/16054566?s=400&v=4",
|
||||
Link = "https://blog.lindexi.com/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "吕毅",
|
||||
AvatarUri = "https://avatars2.githubusercontent.com/u/9959623?s=400&v=4",
|
||||
Link = "https://blog.walterlv.com/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "DinoChan",
|
||||
AvatarUri = "https://avatars1.githubusercontent.com/u/6076257?s=400&v=4",
|
||||
Link = "https://www.cnblogs.com/dino623/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "noctwolf",
|
||||
AvatarUri = "https://avatars3.githubusercontent.com/u/21022467?s=400&v=4",
|
||||
Link = "https://www.cnblogs.com/noctwolf/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "关关长语",
|
||||
AvatarUri = "https://avatars3.githubusercontent.com/u/25916858?s=400&v=4",
|
||||
Link = "https://blog.csdn.net/qq_28806349/category_11213909.html"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetProjectDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "phpEnv",
|
||||
AvatarUri = "https://cdn.phpenv.cn:444/logo.png",
|
||||
Link = "https://www.phpenv.cn/"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "AutumnBox",
|
||||
AvatarUri = "https://raw.githubusercontent.com/zsh2401/AutumnBox/master/src/AutumnBox.GUI/Resources/Images/icon.png",
|
||||
Link = "https://github.com/zsh2401/AutumnBox"
|
||||
},
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "quicker",
|
||||
AvatarUri = "https://files.getquicker.net/_sitefiles/quicker_round_128.png",
|
||||
Link = "https://getquicker.net"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<AvatarModel> GetWebsiteDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new AvatarModel
|
||||
{
|
||||
DisplayName = "Dotnet9",
|
||||
AvatarUri = "https://pic.cnblogs.com/avatar/1663243/20191124121029.png",
|
||||
Link = "https://dotnet9.com/"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal ObservableCollection<CardModel> GetCardDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new CardModel
|
||||
{
|
||||
Header = "Atomic",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/1.jpg",
|
||||
Footer = "Stive Morgan"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Zinderlong",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/2.jpg",
|
||||
Footer = "Zonderling"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Busy Doin' Nothin'",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/3.jpg",
|
||||
Footer = "Ace Wilder"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Wrong",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/4.jpg",
|
||||
Footer = "Blaxy Girls"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "The Lights",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/5.jpg",
|
||||
Footer = "Panda Eyes"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "EA7-50-Cent Disco",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/6.jpg",
|
||||
Footer = "еяхат музыка"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Monsters",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/7.jpg",
|
||||
Footer = "Different Heaven"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Gangsta Walk",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/8.jpg",
|
||||
Footer = "Illusionize"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Won't Back Down",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/9.jpg",
|
||||
Footer = "Boehm / Benjamin Francis Leftwich"
|
||||
},
|
||||
new CardModel
|
||||
{
|
||||
Header = "Katchi",
|
||||
Content = "/HandyControlDemo;component/Resources/Img/Album/10.jpg",
|
||||
Footer = "Ofenbach / Nick Waterhouse"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal CardModel GetCardData()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Content = $"/HandyControlDemo;component/Resources/Img/Album/{DateTime.Now.Second % 10 + 1}.jpg"
|
||||
};
|
||||
}
|
||||
|
||||
internal List<StepBarDemoModel> GetStepBarDemoDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new StepBarDemoModel
|
||||
{
|
||||
Header = LangKeys.Step,
|
||||
Content = LangKeys.Register
|
||||
},
|
||||
new StepBarDemoModel
|
||||
{
|
||||
Header = LangKeys.Step,
|
||||
Content = LangKeys.BasicInfo
|
||||
},
|
||||
new StepBarDemoModel
|
||||
{
|
||||
Header = LangKeys.Step,
|
||||
Content = LangKeys.UploadFile
|
||||
},
|
||||
new StepBarDemoModel
|
||||
{
|
||||
Header = LangKeys.Step,
|
||||
Content = LangKeys.Complete
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal ObservableCollection<CoverViewDemoModel> GetCoverViewDemoDataList()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/1.jpg",
|
||||
BackgroundToken = ResourceToken.SuccessBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/2.jpg",
|
||||
BackgroundToken = ResourceToken.PrimaryBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/3.jpg",
|
||||
BackgroundToken = ResourceToken.WarningBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/4.jpg",
|
||||
BackgroundToken = ResourceToken.DangerBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/5.jpg",
|
||||
BackgroundToken = ResourceToken.SuccessBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/6.jpg",
|
||||
BackgroundToken = ResourceToken.PrimaryBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/7.jpg",
|
||||
BackgroundToken = ResourceToken.InfoBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/8.jpg",
|
||||
BackgroundToken = ResourceToken.WarningBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/9.jpg",
|
||||
BackgroundToken = ResourceToken.PrimaryBrush
|
||||
},
|
||||
new CoverViewDemoModel
|
||||
{
|
||||
ImgPath = "/HandyControlDemo;component/Resources/Img/Album/10.jpg",
|
||||
BackgroundToken = ResourceToken.DangerBrush
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal List<DemoInfoModel> GetDemoInfo()
|
||||
{
|
||||
var infoList = new List<DemoInfoModel>();
|
||||
|
||||
var stream = Application.GetResourceStream(new Uri("Data/DemoInfo.json", UriKind.Relative))?.Stream;
|
||||
if (stream == null) return infoList;
|
||||
|
||||
string jsonStr;
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
jsonStr = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
var jsonObj = JsonConvert.DeserializeObject<dynamic>(jsonStr);
|
||||
foreach (var item in jsonObj)
|
||||
{
|
||||
var titleKey = (string) item.title;
|
||||
var title = titleKey;
|
||||
List<DemoItemModel> list = Convert2DemoItemList(item.demoItemList);
|
||||
|
||||
var demoInfoModel = new DemoInfoModel
|
||||
{
|
||||
Key = titleKey,
|
||||
Title = title,
|
||||
DemoItemList = list,
|
||||
SelectedIndex = (int) item.selectedIndex,
|
||||
IsGroupEnabled = (bool) item.group
|
||||
};
|
||||
|
||||
var domainName = LangProvider.Culture == null || LangProvider.Culture.Name.ToLower() == "zh-cn"
|
||||
? "handyorg"
|
||||
: "ghost1372";
|
||||
return $"https://{domainName}.github.io/handycontrol/{key}/{demoItem.Name[0].ToString().ToLower()}{demoItem.Name.Substring(1)}";
|
||||
infoList.Add(demoInfoModel);
|
||||
}
|
||||
|
||||
return infoList;
|
||||
}
|
||||
}
|
||||
|
||||
private List<DemoItemModel> Convert2DemoItemList(dynamic list)
|
||||
{
|
||||
var resultList = new List<DemoItemModel>();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
var name = (string) item[0];
|
||||
string targetCtlName = item[1];
|
||||
string imageName = item[2];
|
||||
var isNew = !string.IsNullOrEmpty((string) item[3]);
|
||||
var groupName = (string) item[4];
|
||||
if (string.IsNullOrEmpty(groupName))
|
||||
{
|
||||
groupName = "Misc";
|
||||
}
|
||||
|
||||
resultList.Add(new DemoItemModel
|
||||
{
|
||||
Name = name,
|
||||
TargetCtlName = targetCtlName,
|
||||
ImageName = $"../../Resources/Img/LeftMainContent/{imageName}.png",
|
||||
IsNew = isNew,
|
||||
GroupName = groupName
|
||||
});
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public string GetDemoUrl(DemoInfoModel demoInfo, DemoItemModel demoItem)
|
||||
{
|
||||
var key = demoInfo.Key switch
|
||||
{
|
||||
"Styles" => "native_controls",
|
||||
"Controls" => "extend_controls",
|
||||
"Tools" => "tools",
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
var domainName = LangProvider.Culture == null || LangProvider.Culture.Name.ToLower() == "zh-cn"
|
||||
? "handyorg"
|
||||
: "ghost1372";
|
||||
return $"https://{domainName}.github.io/handycontrol/{key}/{demoItem.Name[0].ToString().ToLower()}{demoItem.Name.Substring(1)}";
|
||||
}
|
||||
}
|
@ -5,29 +5,28 @@ using System.Windows.Media;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControlDemo.Tools.Converter
|
||||
namespace HandyControlDemo.Tools.Converter;
|
||||
|
||||
public class HatchBrushConverter : IValueConverter
|
||||
{
|
||||
public class HatchBrushConverter : IValueConverter
|
||||
private readonly HatchBrushGenerator _brushGenerator;
|
||||
|
||||
public HatchBrushConverter()
|
||||
{
|
||||
private readonly HatchBrushGenerator _brushGenerator;
|
||||
|
||||
public HatchBrushConverter()
|
||||
{
|
||||
_brushGenerator = new HatchBrushGenerator();
|
||||
}
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is HatchStyle style)
|
||||
{
|
||||
return _brushGenerator.GetHatchBrush(style, ResourceHelper.GetResource<Color>(ResourceToken.DarkPrimaryColor), Colors.Transparent);
|
||||
}
|
||||
return Brushes.Transparent;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
_brushGenerator = new HatchBrushGenerator();
|
||||
}
|
||||
}
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is HatchStyle style)
|
||||
{
|
||||
return _brushGenerator.GetHatchBrush(style, ResourceHelper.GetResource<Color>(ResourceToken.DarkPrimaryColor), Colors.Transparent);
|
||||
}
|
||||
return Brushes.Transparent;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
@ -4,18 +4,17 @@ using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControlDemo.Tools.Converter
|
||||
{
|
||||
public class String2BrushConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value is string str ? ResourceHelper.GetResource<Brush>(str) : default;
|
||||
}
|
||||
namespace HandyControlDemo.Tools.Converter;
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
public class String2BrushConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value is string str ? ResourceHelper.GetResource<Brush>(str) : default;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
@ -3,43 +3,42 @@ using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace HandyControlDemo.Tools.Converter
|
||||
namespace HandyControlDemo.Tools.Converter;
|
||||
|
||||
public class StringRepeatConverter : IValueConverter
|
||||
{
|
||||
public class StringRepeatConverter : IValueConverter
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
if (value is string strValue)
|
||||
{
|
||||
if (value is string strValue)
|
||||
var builder = new StringBuilder();
|
||||
int num;
|
||||
if (parameter is string numStr)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
int num;
|
||||
if (parameter is string numStr)
|
||||
{
|
||||
if (!int.TryParse(numStr, out num))
|
||||
{
|
||||
return strValue;
|
||||
}
|
||||
}
|
||||
else if (parameter is int intValue)
|
||||
{
|
||||
num = intValue;
|
||||
}
|
||||
else
|
||||
if (!int.TryParse(numStr, out num))
|
||||
{
|
||||
return strValue;
|
||||
}
|
||||
for (var i = 0; i < num; i++)
|
||||
{
|
||||
builder.Append(strValue);
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
else if (parameter is int intValue)
|
||||
{
|
||||
num = intValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return strValue;
|
||||
}
|
||||
for (var i = 0; i < num; i++)
|
||||
{
|
||||
builder.Append(strValue);
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
using HandyControlDemo.Properties.Langs;
|
||||
|
||||
namespace HandyControlDemo.Tools.Extension
|
||||
namespace HandyControlDemo.Tools.Extension;
|
||||
|
||||
public class LangExtension : HandyControl.Tools.Extension.LangExtension
|
||||
{
|
||||
public class LangExtension : HandyControl.Tools.Extension.LangExtension
|
||||
public LangExtension()
|
||||
{
|
||||
public LangExtension()
|
||||
{
|
||||
Source = LangProvider.Instance;
|
||||
}
|
||||
Source = LangProvider.Instance;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,37 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
namespace HandyControlDemo.Tools;
|
||||
|
||||
internal class AssemblyHelper
|
||||
{
|
||||
internal class AssemblyHelper
|
||||
private static readonly string NameSpaceStr = typeof(AssemblyHelper).Assembly.GetName().Name;
|
||||
|
||||
private static readonly Dictionary<string, object> CacheDic = new();
|
||||
|
||||
public static void Register(string name, object instance) => CacheDic[name] = instance;
|
||||
|
||||
public static object ResolveByKey(string key)
|
||||
{
|
||||
private static readonly string NameSpaceStr = typeof(AssemblyHelper).Assembly.GetName().Name;
|
||||
|
||||
private static readonly Dictionary<string, object> CacheDic = new();
|
||||
|
||||
public static void Register(string name, object instance) => CacheDic[name] = instance;
|
||||
|
||||
public static object ResolveByKey(string key)
|
||||
if (CacheDic.TryGetValue(key, out var value))
|
||||
{
|
||||
if (CacheDic.TryGetValue(key, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static object CreateInternalInstance(string className)
|
||||
{
|
||||
try
|
||||
{
|
||||
var type = Type.GetType($"{NameSpaceStr}.{className}");
|
||||
return type == null ? null : Activator.CreateInstance(type);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static object CreateInternalInstance(string className)
|
||||
{
|
||||
try
|
||||
{
|
||||
var type = Type.GetType($"{NameSpaceStr}.{className}");
|
||||
return type == null ? null : Activator.CreateInstance(type);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
namespace HandyControlDemo.Tools;
|
||||
|
||||
internal class VersionHelper
|
||||
{
|
||||
internal class VersionHelper
|
||||
internal static string GetVersion()
|
||||
{
|
||||
internal static string GetVersion()
|
||||
{
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
|
||||
#if NET40
|
||||
var netVersion = "NET 40";
|
||||
var netVersion = "NET 40";
|
||||
#elif NET45
|
||||
var netVersion = "NET 45";
|
||||
#elif NET451
|
||||
@ -39,10 +39,9 @@ namespace HandyControlDemo.Tools
|
||||
#elif NETCOREAPP3_1
|
||||
var netVersion = "CORE 31";
|
||||
#endif
|
||||
return $"v {versionInfo.FileVersion} {netVersion}";
|
||||
}
|
||||
|
||||
internal static string GetCopyright() =>
|
||||
FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).LegalCopyright;
|
||||
return $"v {versionInfo.FileVersion} {netVersion}";
|
||||
}
|
||||
}
|
||||
|
||||
internal static string GetCopyright() =>
|
||||
FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).LegalCopyright;
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
{
|
||||
internal class Win32Helper
|
||||
{
|
||||
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
|
||||
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
namespace HandyControlDemo.Tools;
|
||||
|
||||
[DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
|
||||
public static extern int MciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
|
||||
}
|
||||
}
|
||||
internal class Win32Helper
|
||||
{
|
||||
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
|
||||
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
|
||||
[DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
|
||||
public static extern int MciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
|
||||
}
|
@ -6,75 +6,74 @@ using HandyControl.Data;
|
||||
using ICSharpCode.AvalonEdit.Highlighting;
|
||||
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
namespace HandyControlDemo.Tools;
|
||||
|
||||
internal class HighlightingProvider
|
||||
{
|
||||
internal class HighlightingProvider
|
||||
public static HighlightingProvider Default = new Lazy<HighlightingProvider>(() => new HighlightingProvider()).Value;
|
||||
|
||||
protected static readonly Lazy<IHighlightingDefinition> DefaultDefinition = new(() => HighlightingManager.Instance.GetDefinition("C#"));
|
||||
|
||||
private static readonly Dictionary<SkinType, HighlightingProvider> Providers = new();
|
||||
|
||||
protected Dictionary<string, Lazy<IHighlightingDefinition>> Definition;
|
||||
|
||||
public static void Register(SkinType skinType, HighlightingProvider provider)
|
||||
{
|
||||
public static HighlightingProvider Default = new Lazy<HighlightingProvider>(() => new HighlightingProvider()).Value;
|
||||
|
||||
protected static readonly Lazy<IHighlightingDefinition> DefaultDefinition = new(() => HighlightingManager.Instance.GetDefinition("C#"));
|
||||
|
||||
private static readonly Dictionary<SkinType, HighlightingProvider> Providers = new();
|
||||
|
||||
protected Dictionary<string, Lazy<IHighlightingDefinition>> Definition;
|
||||
|
||||
public static void Register(SkinType skinType, HighlightingProvider provider)
|
||||
{
|
||||
Providers[skinType] = provider ?? throw new ArgumentNullException(nameof(provider));
|
||||
provider.InitDefinitions();
|
||||
}
|
||||
|
||||
public static IHighlightingDefinition GetDefinition(SkinType skinType, string name)
|
||||
{
|
||||
if (Providers.TryGetValue(skinType, out var provider))
|
||||
{
|
||||
return provider.GetDefinition(name);
|
||||
}
|
||||
|
||||
return DefaultDefinition.Value;
|
||||
}
|
||||
|
||||
protected static IHighlightingDefinition LoadDefinition(string xshdName)
|
||||
{
|
||||
var streamResourceInfo = Application.GetResourceStream(new Uri($"pack://application:,,,/Resources/xshd/{xshdName}.xshd"));
|
||||
if (streamResourceInfo == null)
|
||||
{
|
||||
return DefaultDefinition.Value;
|
||||
}
|
||||
|
||||
using var reader = new XmlTextReader(streamResourceInfo.Stream);
|
||||
return HighlightingLoader.Load(reader, HighlightingManager.Instance);
|
||||
}
|
||||
|
||||
protected virtual IHighlightingDefinition GetDefinition(string name)
|
||||
{
|
||||
if (Definition.TryGetValue(name, out var definition))
|
||||
{
|
||||
return definition.Value;
|
||||
}
|
||||
|
||||
return DefaultDefinition.Value;
|
||||
}
|
||||
|
||||
protected virtual void InitDefinitions()
|
||||
{
|
||||
Definition = new Dictionary<string, Lazy<IHighlightingDefinition>>
|
||||
{
|
||||
["XML"] = new(() => HighlightingManager.Instance.GetDefinition("XML")),
|
||||
["C#"] = new(() => DefaultDefinition.Value)
|
||||
};
|
||||
}
|
||||
Providers[skinType] = provider ?? throw new ArgumentNullException(nameof(provider));
|
||||
provider.InitDefinitions();
|
||||
}
|
||||
|
||||
internal class HighlightingProviderDark : HighlightingProvider
|
||||
public static IHighlightingDefinition GetDefinition(SkinType skinType, string name)
|
||||
{
|
||||
protected override void InitDefinitions()
|
||||
if (Providers.TryGetValue(skinType, out var provider))
|
||||
{
|
||||
Definition = new Dictionary<string, Lazy<IHighlightingDefinition>>
|
||||
{
|
||||
["XML"] = new(() => LoadDefinition("XML-Dark")),
|
||||
["C#"] = new(() => LoadDefinition("CSharp-Dark")),
|
||||
};
|
||||
return provider.GetDefinition(name);
|
||||
}
|
||||
|
||||
return DefaultDefinition.Value;
|
||||
}
|
||||
|
||||
protected static IHighlightingDefinition LoadDefinition(string xshdName)
|
||||
{
|
||||
var streamResourceInfo = Application.GetResourceStream(new Uri($"pack://application:,,,/Resources/xshd/{xshdName}.xshd"));
|
||||
if (streamResourceInfo == null)
|
||||
{
|
||||
return DefaultDefinition.Value;
|
||||
}
|
||||
|
||||
using var reader = new XmlTextReader(streamResourceInfo.Stream);
|
||||
return HighlightingLoader.Load(reader, HighlightingManager.Instance);
|
||||
}
|
||||
|
||||
protected virtual IHighlightingDefinition GetDefinition(string name)
|
||||
{
|
||||
if (Definition.TryGetValue(name, out var definition))
|
||||
{
|
||||
return definition.Value;
|
||||
}
|
||||
|
||||
return DefaultDefinition.Value;
|
||||
}
|
||||
|
||||
protected virtual void InitDefinitions()
|
||||
{
|
||||
Definition = new Dictionary<string, Lazy<IHighlightingDefinition>>
|
||||
{
|
||||
["XML"] = new(() => HighlightingManager.Instance.GetDefinition("XML")),
|
||||
["C#"] = new(() => DefaultDefinition.Value)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal class HighlightingProviderDark : HighlightingProvider
|
||||
{
|
||||
protected override void InitDefinitions()
|
||||
{
|
||||
Definition = new Dictionary<string, Lazy<IHighlightingDefinition>>
|
||||
{
|
||||
["XML"] = new(() => LoadDefinition("XML-Dark")),
|
||||
["C#"] = new(() => LoadDefinition("CSharp-Dark")),
|
||||
};
|
||||
}
|
||||
}
|
@ -1,40 +1,39 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class Avatar
|
||||
{
|
||||
public partial class Avatar
|
||||
public Avatar()
|
||||
{
|
||||
public Avatar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
|
||||
"Source", typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));
|
||||
|
||||
public BitmapFrame Source
|
||||
{
|
||||
get => (BitmapFrame) GetValue(SourceProperty);
|
||||
set => SetValue(SourceProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
|
||||
"DisplayName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get => (string) GetValue(UserNameProperty);
|
||||
set => SetValue(UserNameProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LinkProperty = DependencyProperty.Register(
|
||||
"Link", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string Link
|
||||
{
|
||||
get => (string) GetValue(LinkProperty);
|
||||
set => SetValue(LinkProperty, value);
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
|
||||
"Source", typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));
|
||||
|
||||
public BitmapFrame Source
|
||||
{
|
||||
get => (BitmapFrame) GetValue(SourceProperty);
|
||||
set => SetValue(SourceProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
|
||||
"DisplayName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get => (string) GetValue(UserNameProperty);
|
||||
set => SetValue(UserNameProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LinkProperty = DependencyProperty.Register(
|
||||
"Link", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string Link
|
||||
{
|
||||
get => (string) GetValue(LinkProperty);
|
||||
set => SetValue(LinkProperty, value);
|
||||
}
|
||||
}
|
@ -1,22 +1,21 @@
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ChatBox
|
||||
{
|
||||
public partial class ChatBox
|
||||
private ScrollViewer _scrollViewer;
|
||||
|
||||
public ChatBox()
|
||||
{
|
||||
private ScrollViewer _scrollViewer;
|
||||
|
||||
public ChatBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
ListBoxChat.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged;
|
||||
}
|
||||
|
||||
private void ItemContainerGenerator_ItemsChanged(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs e)
|
||||
{
|
||||
_scrollViewer ??= VisualHelper.GetChild<ScrollViewer>(ListBoxChat);
|
||||
_scrollViewer?.ScrollToBottom();
|
||||
}
|
||||
InitializeComponent();
|
||||
ListBoxChat.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void ItemContainerGenerator_ItemsChanged(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs e)
|
||||
{
|
||||
_scrollViewer ??= VisualHelper.GetChild<ScrollViewer>(ListBoxChat);
|
||||
_scrollViewer?.ScrollToBottom();
|
||||
}
|
||||
}
|
@ -1,19 +1,18 @@
|
||||
using System.Windows;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class GeometryItem
|
||||
{
|
||||
public partial class GeometryItem
|
||||
public GeometryItem() => InitializeComponent();
|
||||
|
||||
public static readonly DependencyProperty InfoProperty = DependencyProperty.Register(
|
||||
"Info", typeof(GeometryItemModel), typeof(GeometryItem), new PropertyMetadata(default(GeometryItemModel)));
|
||||
|
||||
public GeometryItemModel Info
|
||||
{
|
||||
public GeometryItem() => InitializeComponent();
|
||||
|
||||
public static readonly DependencyProperty InfoProperty = DependencyProperty.Register(
|
||||
"Info", typeof(GeometryItemModel), typeof(GeometryItem), new PropertyMetadata(default(GeometryItemModel)));
|
||||
|
||||
public GeometryItemModel Info
|
||||
{
|
||||
get => (GeometryItemModel) GetValue(InfoProperty);
|
||||
set => SetValue(InfoProperty, value);
|
||||
}
|
||||
get => (GeometryItemModel) GetValue(InfoProperty);
|
||||
set => SetValue(InfoProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
internal interface IFull
|
||||
{
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
}
|
||||
}
|
||||
internal interface IFull
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class InteractiveDialog
|
||||
{
|
||||
public partial class InteractiveDialog
|
||||
public InteractiveDialog()
|
||||
{
|
||||
public InteractiveDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class TextDialog
|
||||
{
|
||||
public partial class TextDialog
|
||||
public TextDialog()
|
||||
{
|
||||
public TextDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,23 +2,22 @@
|
||||
using System.Windows.Controls.Primitives;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class TextDialogWithTimer
|
||||
{
|
||||
public partial class TextDialogWithTimer
|
||||
public TextDialogWithTimer()
|
||||
{
|
||||
public TextDialogWithTimer()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeComponent();
|
||||
|
||||
var animation = AnimationHelper.CreateAnimation(100, 5000);
|
||||
animation.EasingFunction = null;
|
||||
animation.Completed += Animation_Completed;
|
||||
ProgressBarTimer.BeginAnimation(RangeBase.ValueProperty, animation);
|
||||
}
|
||||
|
||||
private void Animation_Completed(object sender, EventArgs e)
|
||||
{
|
||||
ButtonClose.Command.Execute(null);
|
||||
}
|
||||
var animation = AnimationHelper.CreateAnimation(100, 5000);
|
||||
animation.EasingFunction = null;
|
||||
animation.Completed += Animation_Completed;
|
||||
ProgressBarTimer.BeginAnimation(RangeBase.ValueProperty, animation);
|
||||
}
|
||||
}
|
||||
|
||||
private void Animation_Completed(object sender, EventArgs e)
|
||||
{
|
||||
ButtonClose.Command.Execute(null);
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class AnimationPathDemoCtl
|
||||
{
|
||||
public partial class AnimationPathDemoCtl
|
||||
public AnimationPathDemoCtl()
|
||||
{
|
||||
public AnimationPathDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class AutoCompleteTextBoxDemoCtl
|
||||
{
|
||||
public partial class AutoCompleteTextBoxDemoCtl
|
||||
public AutoCompleteTextBoxDemoCtl()
|
||||
{
|
||||
public AutoCompleteTextBoxDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class BadgeDemoCtl
|
||||
{
|
||||
public partial class BadgeDemoCtl
|
||||
public BadgeDemoCtl()
|
||||
{
|
||||
public BadgeDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +1,39 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ButtonGroupDemoCtl
|
||||
{
|
||||
public partial class ButtonGroupDemoCtl
|
||||
public ButtonGroupDemoCtl()
|
||||
{
|
||||
public ButtonGroupDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
|
||||
"Source", typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));
|
||||
|
||||
public BitmapFrame Source
|
||||
{
|
||||
get => (BitmapFrame) GetValue(SourceProperty);
|
||||
set => SetValue(SourceProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
|
||||
"DisplayName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get => (string) GetValue(UserNameProperty);
|
||||
set => SetValue(UserNameProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LinkProperty = DependencyProperty.Register(
|
||||
"Link", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string Link
|
||||
{
|
||||
get => (string) GetValue(LinkProperty);
|
||||
set => SetValue(LinkProperty, value);
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
|
||||
"Source", typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));
|
||||
|
||||
public BitmapFrame Source
|
||||
{
|
||||
get => (BitmapFrame) GetValue(SourceProperty);
|
||||
set => SetValue(SourceProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
|
||||
"DisplayName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get => (string) GetValue(UserNameProperty);
|
||||
set => SetValue(UserNameProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LinkProperty = DependencyProperty.Register(
|
||||
"Link", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string Link
|
||||
{
|
||||
get => (string) GetValue(LinkProperty);
|
||||
set => SetValue(LinkProperty, value);
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class CalendarWithClockDemoCtl
|
||||
{
|
||||
public partial class CalendarWithClockDemoCtl
|
||||
public CalendarWithClockDemoCtl()
|
||||
{
|
||||
public CalendarWithClockDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class CardDemoCtl
|
||||
{
|
||||
public partial class CardDemoCtl
|
||||
public CardDemoCtl()
|
||||
{
|
||||
public CardDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class CarouselDemoCtl
|
||||
{
|
||||
public partial class CarouselDemoCtl
|
||||
public CarouselDemoCtl()
|
||||
{
|
||||
public CarouselDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ChatBubbleDemoCtl
|
||||
{
|
||||
public partial class ChatBubbleDemoCtl
|
||||
public ChatBubbleDemoCtl()
|
||||
{
|
||||
public ChatBubbleDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class CheckComboBoxDemoCtl
|
||||
{
|
||||
public partial class CheckComboBoxDemoCtl
|
||||
public CheckComboBoxDemoCtl()
|
||||
{
|
||||
public CheckComboBoxDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class CirclePanelDemoCtl
|
||||
{
|
||||
public partial class CirclePanelDemoCtl
|
||||
public CirclePanelDemoCtl()
|
||||
{
|
||||
public CirclePanelDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ClockDemoCtl
|
||||
{
|
||||
public partial class ClockDemoCtl
|
||||
public ClockDemoCtl()
|
||||
{
|
||||
public ClockDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ColorPickerDemoCtl
|
||||
{
|
||||
public partial class ColorPickerDemoCtl
|
||||
public ColorPickerDemoCtl()
|
||||
{
|
||||
public ColorPickerDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ComboBoxDemoCtl
|
||||
{
|
||||
public partial class ComboBoxDemoCtl
|
||||
public ComboBoxDemoCtl()
|
||||
{
|
||||
public ComboBoxDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class CompareSliderDemoCtl
|
||||
{
|
||||
public partial class CompareSliderDemoCtl
|
||||
public CompareSliderDemoCtl()
|
||||
{
|
||||
public CompareSliderDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,28 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class CoverFlowDemoCtl
|
||||
{
|
||||
public partial class CoverFlowDemoCtl
|
||||
public CoverFlowDemoCtl()
|
||||
{
|
||||
public CoverFlowDemoCtl()
|
||||
InitializeComponent();
|
||||
|
||||
CoverFlowMain.AddRange(new[]
|
||||
{
|
||||
InitializeComponent();
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/1.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/2.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/3.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/4.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/5.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/6.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/7.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/8.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/9.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/10.jpg")
|
||||
});
|
||||
|
||||
CoverFlowMain.AddRange(new[]
|
||||
{
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/1.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/2.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/3.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/4.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/5.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/6.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/7.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/8.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/9.jpg"),
|
||||
new Uri(@"pack://application:,,,/Resources/Img/Album/10.jpg")
|
||||
});
|
||||
|
||||
CoverFlowMain.PageIndex = 2;
|
||||
}
|
||||
CoverFlowMain.PageIndex = 2;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class CoverViewDemoCtl
|
||||
{
|
||||
public partial class CoverViewDemoCtl
|
||||
public CoverViewDemoCtl()
|
||||
{
|
||||
public CoverViewDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class DatePickerDemoCtl
|
||||
{
|
||||
public partial class DatePickerDemoCtl
|
||||
public DatePickerDemoCtl()
|
||||
{
|
||||
public DatePickerDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class DateTimePickerDemoCtl
|
||||
{
|
||||
public partial class DateTimePickerDemoCtl
|
||||
public DateTimePickerDemoCtl()
|
||||
{
|
||||
public DateTimePickerDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class DialogDemoCtl
|
||||
{
|
||||
public partial class DialogDemoCtl
|
||||
public DialogDemoCtl()
|
||||
{
|
||||
public DialogDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class DividerDemoCtl
|
||||
{
|
||||
public partial class DividerDemoCtl
|
||||
public DividerDemoCtl()
|
||||
{
|
||||
public DividerDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class DrawerDemoCtl
|
||||
{
|
||||
public partial class DrawerDemoCtl
|
||||
public DrawerDemoCtl()
|
||||
{
|
||||
public DrawerDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ElementGroupDemoCtl
|
||||
{
|
||||
public partial class ElementGroupDemoCtl
|
||||
public ElementGroupDemoCtl()
|
||||
{
|
||||
public ElementGroupDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class FlexPanelDemoCtl : IFull
|
||||
{
|
||||
public partial class FlexPanelDemoCtl : IFull
|
||||
public FlexPanelDemoCtl()
|
||||
{
|
||||
public FlexPanelDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class FlipClockDemoCtl
|
||||
{
|
||||
public partial class FlipClockDemoCtl
|
||||
public FlipClockDemoCtl()
|
||||
{
|
||||
public FlipClockDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class FloatingBlockDemoCtl
|
||||
{
|
||||
public partial class FloatingBlockDemoCtl
|
||||
public FloatingBlockDemoCtl()
|
||||
{
|
||||
public FloatingBlockDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class GifImageDemoCtl : IDisposable
|
||||
{
|
||||
public GifImageDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GifImageMain.Dispose();
|
||||
}
|
||||
public partial class GifImageDemoCtl : IDisposable
|
||||
{
|
||||
public GifImageDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GifImageMain.Dispose();
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class GotoTopDemoCtl
|
||||
{
|
||||
public partial class GotoTopDemoCtl
|
||||
public GotoTopDemoCtl()
|
||||
{
|
||||
public GotoTopDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class GravatarDemoCtl
|
||||
{
|
||||
public partial class GravatarDemoCtl
|
||||
public GravatarDemoCtl()
|
||||
{
|
||||
public GravatarDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class GridDemoCtl : IFull
|
||||
{
|
||||
public partial class GridDemoCtl : IFull
|
||||
public GridDemoCtl()
|
||||
{
|
||||
public GridDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class GrowlDemoCtl
|
||||
{
|
||||
public partial class GrowlDemoCtl
|
||||
public GrowlDemoCtl()
|
||||
{
|
||||
public GrowlDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class HoneycombPanelDemoCtl
|
||||
{
|
||||
public partial class HoneycombPanelDemoCtl
|
||||
public HoneycombPanelDemoCtl()
|
||||
{
|
||||
public HoneycombPanelDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ImageBlockDemoCtl
|
||||
{
|
||||
public partial class ImageBlockDemoCtl
|
||||
public ImageBlockDemoCtl()
|
||||
{
|
||||
public ImageBlockDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ImageBrowserDemoCtl
|
||||
{
|
||||
public partial class ImageBrowserDemoCtl
|
||||
public ImageBrowserDemoCtl()
|
||||
{
|
||||
public ImageBrowserDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ImageSelectorDemoCtl
|
||||
{
|
||||
public partial class ImageSelectorDemoCtl
|
||||
public ImageSelectorDemoCtl()
|
||||
{
|
||||
public ImageSelectorDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class LoadingDemoCtl
|
||||
{
|
||||
public partial class LoadingDemoCtl
|
||||
public LoadingDemoCtl()
|
||||
{
|
||||
public LoadingDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class MagnifierDemoCtl
|
||||
{
|
||||
public partial class MagnifierDemoCtl
|
||||
public MagnifierDemoCtl()
|
||||
{
|
||||
public MagnifierDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class NotificationDemoCtl
|
||||
{
|
||||
public partial class NotificationDemoCtl
|
||||
public NotificationDemoCtl()
|
||||
{
|
||||
public NotificationDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,20 +2,19 @@
|
||||
using HandyControlDemo.Tools;
|
||||
using HandyControlDemo.ViewModel;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class NotifyIconDemoCtl
|
||||
{
|
||||
public partial class NotifyIconDemoCtl
|
||||
public NotifyIconDemoCtl()
|
||||
{
|
||||
public NotifyIconDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeComponent();
|
||||
|
||||
AssemblyHelper.Register(nameof(NotifyIconDemoCtl), this);
|
||||
Unloaded += NotifyIconDemoCtl_Unloaded;
|
||||
}
|
||||
|
||||
private void NotifyIconDemoCtl_Unloaded(object sender, RoutedEventArgs e) => ViewModelLocator.Instance.NotifyIconDemo.Cleanup();
|
||||
|
||||
private void ButtonPush_OnClick(object sender, RoutedEventArgs e) => NotifyIconContextContent.CloseContextControl();
|
||||
AssemblyHelper.Register(nameof(NotifyIconDemoCtl), this);
|
||||
Unloaded += NotifyIconDemoCtl_Unloaded;
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifyIconDemoCtl_Unloaded(object sender, RoutedEventArgs e) => ViewModelLocator.Instance.NotifyIconDemo.Cleanup();
|
||||
|
||||
private void ButtonPush_OnClick(object sender, RoutedEventArgs e) => NotifyIconContextContent.CloseContextControl();
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class NumericUpDownDemoCtl
|
||||
{
|
||||
public partial class NumericUpDownDemoCtl
|
||||
public NumericUpDownDemoCtl()
|
||||
{
|
||||
public NumericUpDownDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class OutlineTextDemoCtl
|
||||
{
|
||||
public partial class OutlineTextDemoCtl
|
||||
public OutlineTextDemoCtl()
|
||||
{
|
||||
public OutlineTextDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class PaginationDemoCtl
|
||||
{
|
||||
public partial class PaginationDemoCtl
|
||||
public PaginationDemoCtl()
|
||||
{
|
||||
public PaginationDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class PasswordBoxDemoCtl
|
||||
{
|
||||
public partial class PasswordBoxDemoCtl
|
||||
public PasswordBoxDemoCtl()
|
||||
{
|
||||
public PasswordBoxDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +1,20 @@
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class PinBoxDemoCtl
|
||||
{
|
||||
public PinBoxDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
private void PinBox_OnCompleted(object sender, RoutedEventArgs e)
|
||||
public partial class PinBoxDemoCtl
|
||||
{
|
||||
public PinBoxDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void PinBox_OnCompleted(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is PinBox pinBox)
|
||||
{
|
||||
if (e.OriginalSource is PinBox pinBox)
|
||||
{
|
||||
Growl.Info(pinBox.Password);
|
||||
}
|
||||
Growl.Info(pinBox.Password);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class PoptipDemoCtl
|
||||
{
|
||||
public partial class PoptipDemoCtl
|
||||
public PoptipDemoCtl()
|
||||
{
|
||||
public PoptipDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class PreviewSliderDemoCtl
|
||||
{
|
||||
public partial class PreviewSliderDemoCtl
|
||||
public PreviewSliderDemoCtl()
|
||||
{
|
||||
public PreviewSliderDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ProgressBarDemoCtl
|
||||
{
|
||||
public partial class ProgressBarDemoCtl
|
||||
public ProgressBarDemoCtl()
|
||||
{
|
||||
public ProgressBarDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,64 +2,63 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ProgressButtonDemoCtl
|
||||
{
|
||||
public partial class ProgressButtonDemoCtl
|
||||
public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register(
|
||||
"Progress", typeof(int), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(int)));
|
||||
|
||||
public int Progress
|
||||
{
|
||||
public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register(
|
||||
"Progress", typeof(int), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(int)));
|
||||
get => (int) GetValue(ProgressProperty);
|
||||
set => SetValue(ProgressProperty, value);
|
||||
}
|
||||
|
||||
public int Progress
|
||||
public static readonly DependencyProperty IsUploadingProperty = DependencyProperty.Register(
|
||||
"IsUploading", typeof(bool), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(bool)));
|
||||
|
||||
public bool IsUploading
|
||||
{
|
||||
get => (bool) GetValue(IsUploadingProperty);
|
||||
set => SetValue(IsUploadingProperty, value);
|
||||
}
|
||||
|
||||
private readonly DispatcherTimer _timer;
|
||||
|
||||
public ProgressButtonDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = this;
|
||||
|
||||
_timer = new DispatcherTimer
|
||||
{
|
||||
get => (int) GetValue(ProgressProperty);
|
||||
set => SetValue(ProgressProperty, value);
|
||||
}
|
||||
Interval = TimeSpan.FromMilliseconds(200)
|
||||
};
|
||||
_timer.Tick += Timer_Tick;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsUploadingProperty = DependencyProperty.Register(
|
||||
"IsUploading", typeof(bool), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(bool)));
|
||||
|
||||
public bool IsUploading
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Progress++;
|
||||
if (Progress == 100)
|
||||
{
|
||||
get => (bool) GetValue(IsUploadingProperty);
|
||||
set => SetValue(IsUploadingProperty, value);
|
||||
}
|
||||
|
||||
private readonly DispatcherTimer _timer;
|
||||
|
||||
public ProgressButtonDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = this;
|
||||
|
||||
_timer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(200)
|
||||
};
|
||||
_timer.Tick += Timer_Tick;
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Progress++;
|
||||
if (Progress == 100)
|
||||
{
|
||||
Progress = 0;
|
||||
_timer.Stop();
|
||||
IsUploading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonProgress_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_timer.IsEnabled)
|
||||
{
|
||||
_timer.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
_timer.Start();
|
||||
}
|
||||
Progress = 0;
|
||||
_timer.Stop();
|
||||
IsUploading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonProgress_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_timer.IsEnabled)
|
||||
{
|
||||
_timer.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
_timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,31 +1,30 @@
|
||||
using System.Windows;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class PropertyGridDemoCtl
|
||||
{
|
||||
public partial class PropertyGridDemoCtl
|
||||
public PropertyGridDemoCtl()
|
||||
{
|
||||
public PropertyGridDemoCtl()
|
||||
InitializeComponent();
|
||||
|
||||
DemoModel = new PropertyGridDemoModel
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DemoModel = new PropertyGridDemoModel
|
||||
{
|
||||
String = "TestString",
|
||||
Enum = Gender.Female,
|
||||
Boolean = true,
|
||||
Integer = 98,
|
||||
VerticalAlignment = VerticalAlignment.Stretch
|
||||
};
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DemoModelProperty = DependencyProperty.Register(
|
||||
"DemoModel", typeof(PropertyGridDemoModel), typeof(PropertyGridDemoCtl), new PropertyMetadata(default(PropertyGridDemoModel)));
|
||||
|
||||
public PropertyGridDemoModel DemoModel
|
||||
{
|
||||
get => (PropertyGridDemoModel) GetValue(DemoModelProperty);
|
||||
set => SetValue(DemoModelProperty, value);
|
||||
}
|
||||
String = "TestString",
|
||||
Enum = Gender.Female,
|
||||
Boolean = true,
|
||||
Integer = 98,
|
||||
VerticalAlignment = VerticalAlignment.Stretch
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DemoModelProperty = DependencyProperty.Register(
|
||||
"DemoModel", typeof(PropertyGridDemoModel), typeof(PropertyGridDemoCtl), new PropertyMetadata(default(PropertyGridDemoModel)));
|
||||
|
||||
public PropertyGridDemoModel DemoModel
|
||||
{
|
||||
get => (PropertyGridDemoModel) GetValue(DemoModelProperty);
|
||||
set => SetValue(DemoModelProperty, value);
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class RangeSliderDemoCtl
|
||||
{
|
||||
public partial class RangeSliderDemoCtl
|
||||
public RangeSliderDemoCtl()
|
||||
{
|
||||
public RangeSliderDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class RateDemoCtl
|
||||
{
|
||||
public partial class RateDemoCtl
|
||||
public RateDemoCtl()
|
||||
{
|
||||
public RateDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class RelativePanelDemoCtl
|
||||
{
|
||||
public partial class RelativePanelDemoCtl
|
||||
public RelativePanelDemoCtl()
|
||||
{
|
||||
public RelativePanelDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class RunningBlockDemoCtl
|
||||
{
|
||||
public partial class RunningBlockDemoCtl
|
||||
public RunningBlockDemoCtl()
|
||||
{
|
||||
public RunningBlockDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -5,29 +5,28 @@ using System.Windows.Media;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ScreenshotDemoCtl : IDisposable
|
||||
{
|
||||
public partial class ScreenshotDemoCtl : IDisposable
|
||||
public ScreenshotDemoCtl()
|
||||
{
|
||||
public ScreenshotDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
Screenshot.Snapped += Screenshot_Snapped;
|
||||
}
|
||||
|
||||
private void Screenshot_Snapped(object sender, FunctionEventArgs<ImageSource> e)
|
||||
{
|
||||
new HandyControl.Controls.Window
|
||||
{
|
||||
Content = new Image
|
||||
{
|
||||
Source = e.Info,
|
||||
Stretch = Stretch.None
|
||||
},
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen
|
||||
}.ShowDialog();
|
||||
}
|
||||
|
||||
public void Dispose() => Screenshot.Snapped -= Screenshot_Snapped;
|
||||
InitializeComponent();
|
||||
Screenshot.Snapped += Screenshot_Snapped;
|
||||
}
|
||||
}
|
||||
|
||||
private void Screenshot_Snapped(object sender, FunctionEventArgs<ImageSource> e)
|
||||
{
|
||||
new HandyControl.Controls.Window
|
||||
{
|
||||
Content = new Image
|
||||
{
|
||||
Source = e.Info,
|
||||
Stretch = Stretch.None
|
||||
},
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen
|
||||
}.ShowDialog();
|
||||
}
|
||||
|
||||
public void Dispose() => Screenshot.Snapped -= Screenshot_Snapped;
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ScrollViewerDemoCtl
|
||||
{
|
||||
public partial class ScrollViewerDemoCtl
|
||||
public ScrollViewerDemoCtl()
|
||||
{
|
||||
public ScrollViewerDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class SearchBarDemoCtl
|
||||
{
|
||||
public partial class SearchBarDemoCtl
|
||||
public SearchBarDemoCtl()
|
||||
{
|
||||
public SearchBarDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ShieldDemoCtl
|
||||
{
|
||||
public partial class ShieldDemoCtl
|
||||
public ShieldDemoCtl()
|
||||
{
|
||||
public ShieldDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class SideMenuDemoCtl
|
||||
{
|
||||
public partial class SideMenuDemoCtl
|
||||
public SideMenuDemoCtl()
|
||||
{
|
||||
public SideMenuDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,16 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class SplitButtonDemoCtl
|
||||
{
|
||||
public SplitButtonDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("123");
|
||||
}
|
||||
public partial class SplitButtonDemoCtl
|
||||
{
|
||||
public SplitButtonDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("123");
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class SpriteDemoCtl
|
||||
{
|
||||
public partial class SpriteDemoCtl
|
||||
public SpriteDemoCtl()
|
||||
{
|
||||
public SpriteDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class StepBarDemoCtl
|
||||
{
|
||||
public partial class StepBarDemoCtl
|
||||
public StepBarDemoCtl()
|
||||
{
|
||||
public StepBarDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class TabControlDemoCtl
|
||||
{
|
||||
public partial class TabControlDemoCtl
|
||||
public TabControlDemoCtl()
|
||||
{
|
||||
public TabControlDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class TagDemoCtl
|
||||
{
|
||||
public partial class TagDemoCtl
|
||||
public TagDemoCtl()
|
||||
{
|
||||
public TagDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class TextBoxDemoCtl
|
||||
{
|
||||
public partial class TextBoxDemoCtl
|
||||
public TextBoxDemoCtl()
|
||||
{
|
||||
public TextBoxDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +1,19 @@
|
||||
using System;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class TimeBarDemoCtl
|
||||
{
|
||||
public TimeBarDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var hour = 6 * i;
|
||||
TimeBarDemo.Hotspots.Add(new DateTimeRange(DateTime.Today.AddHours(hour), DateTime.Today.AddHours(hour + 1)));
|
||||
TimeBarDemo.Hotspots.Add(new DateTimeRange(DateTime.Today.AddHours(-hour), DateTime.Today.AddHours(-hour + 1)));
|
||||
}
|
||||
public partial class TimeBarDemoCtl
|
||||
{
|
||||
public TimeBarDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var hour = 6 * i;
|
||||
TimeBarDemo.Hotspots.Add(new DateTimeRange(DateTime.Today.AddHours(hour), DateTime.Today.AddHours(hour + 1)));
|
||||
TimeBarDemo.Hotspots.Add(new DateTimeRange(DateTime.Today.AddHours(-hour), DateTime.Today.AddHours(-hour + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class TimePickerDemoCtl
|
||||
{
|
||||
public partial class TimePickerDemoCtl
|
||||
public TimePickerDemoCtl()
|
||||
{
|
||||
public TimePickerDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user