Adjust project structure

This commit is contained in:
NaBian committed 2019-04-10 00:53:59 +08:00
1 parent 89875792aa
commit 16ef430a39
82 files changed
+271 -10113

No files matched your search

@@ -273,8 +273,23 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\TreeViewDemoCtl.xaml.cs">
<DependentUpon>TreeViewDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Basic\ChatBoxViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Basic\InteractiveDialogViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Common\ComboBoxDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\BadgeDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\CoverViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\DialogDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\GrowlDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\ImageBrowserDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\NotifyIconDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\PaginationDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SearchBarDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\StepBarDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\WindowDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\DemoViewModelBase!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Main\ContributorsViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Main\MainViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\ViewModelLocator.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Window\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
@@ -1,98 +0,0 @@
<Grid x:Class="HandyControlDemo.UserControl.NoUserContent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Height="29"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:enum="clr-namespace:HandyControl.Data;assembly=HandyControl">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Stretch" Orientation="Horizontal">
<Button Margin="4,0,0,0" Width="28" Height="29" Style="{StaticResource ButtonCustom}">
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="Click">
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.ShowSystemMenuCommand}" />
</interactivity:EventTrigger>
<interactivity:EventTrigger EventName="MouseDoubleClick">
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.CloseWindowCommand}" />
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
<Path Height="16" Fill="White" Stretch="Uniform" Data="{StaticResource LogoGeometry}"/>
</Button>
<Menu MenuItem.Click="MenuItemLinks_OnClick" Margin="10,0,0,0" Background="Transparent">
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Repository}">
<MenuItem Tag="https://github.com/NaBian/HandyControl" Header="GitHub">
<MenuItem.Icon>
<Path Data="{StaticResource GithubGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Tag="https://www.nuget.org/packages/HandyControl" Header="NuGet">
<MenuItem.Icon>
<Path Data="{StaticResource NugetGeometry}" Fill="#30a5dd"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Foreground="White" Header="{x:Static langs:Lang.About}">
<MenuItem Click="MenuItemQQGroup_OnClick" Header="{x:Static langs:Lang.QQGroup}">
<MenuItem.Icon>
<Path Data="{StaticResource QqGeometry}" Fill="{DynamicResource PrimaryBrush}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Tag="mailto:836904362@qq.com" Header="{x:Static langs:Lang.Email}">
<MenuItem.Icon>
<Path Data="{StaticResource EmailGeometry}" Fill="{DynamicResource WarningBrush}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Tag="https://gitter.im/HandyControl/Lobby" Header="{x:Static langs:Lang.Chatroom}">
<MenuItem.Icon>
<Path Data="{StaticResource GitterGeometry}" Fill="#e52e64"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Tag="https://www.cnblogs.com/nabian" Header="{x:Static langs:Lang.Blog}">
<MenuItem.Icon>
<Path Data="{StaticResource CnblogsGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static langs:Lang.About}" Click="MenuAbout_OnClick">
<MenuItem.Icon>
<Path Data="{StaticResource InfoGeometry}" Fill="{DynamicResource SuccessBrush}"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Click="MenuItemContributors_OnClick" Foreground="White" Header="{x:Static langs:Lang.Contributors}">
<MenuItem.Icon>
<Path Data="{StaticResource ContributorsGeometry}" Fill="#ef6c00"/>
</MenuItem.Icon>
</MenuItem>
</Menu>
</StackPanel>
<Button Grid.Column="1" Click="ButtonConfig_OnClick" Name="ButtonConfig" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource ConfigGeometry}"/>
<Popup AllowsTransparency="True" Grid.Column="1" PlacementTarget="{Binding ElementName=ButtonConfig}" HorizontalOffset="-25" Name="PopupConfig" VerticalOffset="6" StaysOpen="False">
<Border Background="{DynamicResource SecondaryRegionBrush}" CornerRadius="4" Margin="16" Effect="{StaticResource EffectShadow2}">
<StackPanel Orientation="Horizontal">
<StackPanel Button.Click="ButtonLangs_OnClick" Margin="10,10,0,10">
<Button Tag="zh-cn" Style="{StaticResource ButtonCustom}">
<Image Width="32" Source="/HandyControlDemo;component/Resources/Img/Flag/cn.png"/>
</Button>
<Button Tag="en" Style="{StaticResource ButtonCustom}" Margin="0,10,0,0">
<Image Width="32" Source="/HandyControlDemo;component/Resources/Img/Flag/en.png"/>
</Button>
</StackPanel>
<StackPanel Button.Click="ButtonSkins_OnClick" Margin="10,10,10,10">
<Button Tag="{x:Static enum:SkinType.Default}" Style="{StaticResource ButtonCustom}">
<Border Background="White" Width="32" Height="21" CornerRadius="2" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}"/>
</Button>
<Button Tag="{x:Static enum:SkinType.Dark}" Style="{StaticResource ButtonCustom}" Margin="0,10,0,0">
<Border Background="Black" Width="32" Height="21" CornerRadius="2" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}"/>
</Button>
<Button Tag="{x:Static enum:SkinType.Violet}" Style="{StaticResource ButtonCustom}" Margin="0,10,0,0">
<Border Background="DarkViolet" Width="32" Height="21" CornerRadius="2" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}"/>
</Button>
</StackPanel>
</StackPanel>
</Border>
</Popup>
</Grid>
@@ -1,84 +0,0 @@
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using GalaSoft.MvvmLight.Messaging;
using HandyControl.Controls;
using HandyControl.Data;
using HandyControlDemo.Data;
using HandyControlDemo.Tools;
using HandyControlDemo.Window;
namespace HandyControlDemo.UserControl
{
public partial class NoUserContent
{
public NoUserContent()
{
InitializeComponent();
}
private void ButtonLangs_OnClick(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is Button button && button.Tag is string tag)
{
PopupConfig.IsOpen = false;
if (tag.Equals(GlobalData.Config.Lang)) return;
Growl.Ask(Properties.Langs.Lang.ChangeLangAsk, b =>
{
if (!b) return true;
GlobalData.Config.Lang = tag;
GlobalData.Save();
Process.Start(Process.GetCurrentProcess().MainModule.FileName);
Application.Current.Shutdown();
return true;
});
}
}
private void ButtonConfig_OnClick(object sender, RoutedEventArgs e) => PopupConfig.IsOpen = true;
private void ButtonSkins_OnClick(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is Button button && button.Tag is SkinType tag)
{
PopupConfig.IsOpen = false;
if (tag.Equals(GlobalData.Config.Skin)) return;
GlobalData.Config.Skin = tag;
GlobalData.Save();
((App)Application.Current).UpdateSkin(tag);
}
}
private void MenuItemLinks_OnClick(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is MenuItem menuItem && menuItem.Tag is string tag)
{
Process.Start(tag);
}
}
private void MenuItemQQGroup_OnClick(object sender, RoutedEventArgs e)
{
Messenger.Default.Send<object>(null, MessageToken.ClearLeftSelected);
Messenger.Default.Send(true, MessageToken.FullSwitch);
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.QQGroupView}"), MessageToken.LoadShowContent);
}
private void MenuItemContributors_OnClick(object sender, RoutedEventArgs e)
{
Messenger.Default.Send<object>(null, MessageToken.ClearLeftSelected);
Messenger.Default.Send(true, MessageToken.FullSwitch);
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.ContributorsView}"), MessageToken.LoadShowContent);
}
private void MenuAbout_OnClick(object sender, RoutedEventArgs e)
{
new AboutWindow
{
Owner = Application.Current.MainWindow
}.ShowDialog();
}
}
}
@@ -7,7 +7,11 @@ using System.Windows;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using GalaSoft.MvvmLight;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif
using GalaSoft.MvvmLight.Messaging;
using HandyControl.Controls;
using HandyControl.Data;
@@ -43,7 +47,11 @@ namespace HandyControlDemo.ViewModel
public string ChatString
{
get => _chatString;
#if netle40
set => Set(nameof(ChatString), ref _chatString, value);
#else
set => Set(ref _chatString, value);
#endif
}
public ObservableCollection<ChatInfoModel> ChatInfos { get; set; } = new ObservableCollection<ChatInfoModel>();
@@ -1,6 +1,10 @@
using System;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif
using HandyControl.Tools.Extension;
namespace HandyControlDemo.ViewModel.Basic
@@ -14,7 +18,11 @@ namespace HandyControlDemo.ViewModel.Basic
public string Result
{
get => _result;
set => Set(ref _result, value);
#if netle40
set => Set(nameof(Result), ref _result, value);
#else
set => Set(ref _result, value);
#endif
}
private string _message;
@@ -22,7 +30,11 @@ namespace HandyControlDemo.ViewModel.Basic
public string Message
{
get => _message;
#if netle40
set => Set(nameof(Message), ref _message, value);
#else
set => Set(ref _message, value);
#endif
}
public RelayCommand CloseCmd => new Lazy<RelayCommand>(() => new RelayCommand(() => CloseAction?.Invoke())).Value;
@@ -1,6 +1,10 @@
using System;
using GalaSoft.MvvmLight;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif
namespace HandyControlDemo.ViewModel.Controls
{
@@ -11,7 +15,11 @@ namespace HandyControlDemo.ViewModel.Controls
public int Count
{
get => _count;
#if netle40
set => Set(nameof(Count), ref _count, value);
#else
set => Set(ref _count, value);
#endif
}
public RelayCommand CountCmd => new Lazy<RelayCommand>(() =>
@@ -1,7 +1,11 @@
using System;
using System.Threading.Tasks;
using GalaSoft.MvvmLight;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using System.Threading.Tasks;
using GalaSoft.MvvmLight.CommandWpf;
#endif
using HandyControl.Controls;
using HandyControl.Tools.Extension;
using HandyControlDemo.UserControl;
@@ -17,7 +21,11 @@ namespace HandyControlDemo.ViewModel
public string DialogResult
{
get => _dialogResult;
#if netle40
set => Set(nameof(DialogResult), ref _dialogResult, value);
#else
set => Set(ref _dialogResult, value);
#endif
}
public RelayCommand ShowTextCmd => new Lazy<RelayCommand>(() =>
@@ -28,6 +36,17 @@ namespace HandyControlDemo.ViewModel
Dialog.Show(new TextDialog());
}
#if netle40
public RelayCommand ShowInteractiveDialogCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(ShowInteractiveDialog)).Value;
private void ShowInteractiveDialog()
{
Dialog.Show<InteractiveDialog>()
.Initialize<InteractiveDialogViewModel>(vm => vm.Message = DialogResult)
.GetResultAsync<string>().ContinueWith(str => DialogResult = str.Result);
}
#else
public RelayCommand ShowInteractiveDialogCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(async () => await ShowInteractiveDialog())).Value;
@@ -37,5 +56,6 @@ namespace HandyControlDemo.ViewModel
.Initialize<InteractiveDialogViewModel>(vm => vm.Message = DialogResult)
.GetResultAsync<string>();
}
#endif
}
}
@@ -1,5 +1,9 @@
using System;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
using HandyControl.Controls;
using HandyControl.Data;
using HandyControlDemo.Window;
@@ -1,5 +1,9 @@
using System;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
using HandyControl.Controls;
namespace HandyControlDemo.ViewModel
@@ -1,6 +1,10 @@
using System;
using GalaSoft.MvvmLight;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
using HandyControl.Controls;
using HandyControlDemo.Data;
@@ -15,7 +19,11 @@ namespace HandyControlDemo.ViewModel
get => _contextMenuIsShow;
set
{
#if netle40
Set(nameof(ContextMenuIsShow), ref _contextMenuIsShow, value);
#else
Set(ref _contextMenuIsShow, value);
#endif
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
}
}
@@ -25,7 +33,11 @@ namespace HandyControlDemo.ViewModel
public bool ContextMenuIsBlink
{
get => _contextMenuIsBlink;
#if netle40
set => Set(nameof(ContextMenuIsBlink), ref _contextMenuIsBlink, value);
#else
set => Set(ref _contextMenuIsBlink, value);
#endif
}
private bool _contextContentIsShow;
@@ -35,7 +47,11 @@ namespace HandyControlDemo.ViewModel
get => _contextContentIsShow;
set
{
#if netle40
Set(nameof(ContextContentIsShow), ref _contextContentIsShow, value);
#else
Set(ref _contextContentIsShow, value);
#endif
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
}
}
@@ -45,7 +61,11 @@ namespace HandyControlDemo.ViewModel
public bool ContextContentIsBlink
{
get => _contextContentIsBlink;
#if netle40
set => Set(nameof(ContextContentIsBlink), ref _contextContentIsBlink, value);
#else
set => Set(ref _contextContentIsBlink, value);
#endif
}
public RelayCommand<object> MouseCmd => new Lazy<RelayCommand<object>>(() =>
@@ -1,7 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
using HandyControl.Data;
using HandyControlDemo.Data;
using HandyControlDemo.Service;
@@ -26,7 +30,11 @@ namespace HandyControlDemo.ViewModel
public int PageIndex
{
get => _pageIndex;
#if netle40
set => Set(nameof(PageIndex), ref _pageIndex, value);
#else
set => Set(ref _pageIndex, value);
#endif
}
public PaginationDemoViewModel(DataService dataService)
@@ -1,6 +1,10 @@
using System;
using GalaSoft.MvvmLight;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
using HandyControl.Controls;
namespace HandyControlDemo.ViewModel
@@ -1,7 +1,11 @@
using System;
using System.Linq;
using System.Windows.Controls;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
using HandyControl.Controls;
using HandyControlDemo.Data;
using HandyControlDemo.Service;
@@ -1,6 +1,10 @@
using System;
using System.Windows;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
using HandyControlDemo.Tools;
namespace HandyControlDemo.ViewModel
@@ -16,7 +16,11 @@ namespace HandyControlDemo.ViewModel
public IList<T> DataList
{
get => _dataList;
#if netle40
set => Set(nameof(DataList), ref _dataList, value);
#else
set => Set(ref _dataList, value);
#endif
}
}
}
@@ -8,10 +8,17 @@ namespace HandyControlDemo.ViewModel
{
public ContributorsViewModel(DataService dataService)
{
#if netle40
Task.Factory.StartNew(() =>
{
DataList = dataService.GetContributorDataList();
});
#else
Task.Run(() =>
{
DataList = dataService.GetContributorDataList();
});
#endif
}
}
}
@@ -1,6 +1,10 @@
using System;
using System.Windows.Controls;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
#endif
using GalaSoft.MvvmLight.Messaging;
using HandyControlDemo.Data;
using HandyControlDemo.Service;
@@ -10,7 +14,7 @@ namespace HandyControlDemo.ViewModel
{
public class MainViewModel : DemoViewModelBase<DemoDataModel>
{
#region 字段
#region 字段
/// <summary>
/// 内容标题
@@ -27,7 +31,7 @@ namespace HandyControlDemo.ViewModel
/// </summary>
private ListBoxItem _listBoxItemCurrent;
#endregion
#endregion
public MainViewModel(DataService dataService)
{
@@ -48,7 +52,7 @@ namespace HandyControlDemo.ViewModel
DataList = dataService.GetDemoDataList();
}
#region 属性
#region 属性
/// <summary>
/// 子内容
@@ -56,7 +60,11 @@ namespace HandyControlDemo.ViewModel
public object SubContent
{
get => _subContent;
#if netle40
set => Set(nameof(SubContent), ref _subContent, value);
#else
set => Set(ref _subContent, value);
#endif
}
/// <summary>
@@ -65,7 +73,11 @@ namespace HandyControlDemo.ViewModel
public object ContentTitle
{
get => _contentTitle;
#if netle40
set => Set(nameof(ContentTitle), ref _contentTitle, value);
#else
set => Set(ref _contentTitle, value);
#endif
}
#endregion
@@ -79,9 +91,9 @@ namespace HandyControlDemo.ViewModel
new Lazy<RelayCommand<SelectionChangedEventArgs>>(() =>
new RelayCommand<SelectionChangedEventArgs>(SwitchDemo)).Value;
#endregion
#endregion
#region 方法
#region 方法
/// <summary>
/// 切换例子
@@ -108,6 +120,6 @@ namespace HandyControlDemo.ViewModel
}
}
#endregion
#endregion
}
}