Synchronize the Net40
This commit is contained in:
1 parent
5f299e988e
commit
a5a20d51ae
23 files changed
+394
-226
No files matched your search
@@ -0,0 +1,9 @@
|
||||
namespace HandyControlDemo.Data
|
||||
{
|
||||
public class CoverViewDemoModel
|
||||
{
|
||||
public string ImgPath { get; set; }
|
||||
|
||||
public string BackgroundToken { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Data\Model\ChatInfoModel.cs" />
|
||||
<Compile Include="Data\Model\ContributorModel.cs" />
|
||||
<Compile Include="Data\Model\CoverViewDemoModel.cs" />
|
||||
<Compile Include="Data\Model\DemoDataModel.cs" />
|
||||
<Compile Include="Data\Model\StepBarDemoModel.cs" />
|
||||
<Compile Include="Properties\Langs\Lang.Designer.cs">
|
||||
@@ -97,6 +98,7 @@
|
||||
<DependentUpon>Lang.en.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Service\DataService.cs" />
|
||||
<Compile Include="Tools\Converter\String2BrushConverter.cs" />
|
||||
<Compile Include="Tools\Helper\AssemblyHelper.cs" />
|
||||
<Compile Include="Tools\Helper\CommonHelper.cs" />
|
||||
<Compile Include="Tools\Converter\StringRepeatConverter.cs" />
|
||||
@@ -313,6 +315,8 @@
|
||||
</Compile>
|
||||
<Compile Include="ViewModel\Basic\ChatBoxViewModel.cs" />
|
||||
<Compile Include="ViewModel\Common\ComboBoxDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\Controls\CoverViewModel.cs" />
|
||||
<Compile Include="ViewModel\DemoViewModelBase!1.cs" />
|
||||
<Compile Include="ViewModel\Main\ContributorsViewModel.cs" />
|
||||
<Compile Include="ViewModel\Controls\GrowlDemoViewModel.cs" />
|
||||
<Compile Include="ViewModel\Controls\ImageBrowserDemoViewModel.cs" />
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
xmlns:converter="clr-namespace:HandyControlDemo.Tools.Converter">
|
||||
|
||||
<converter:StringRepeatConverter x:Key="StringRepeatConverter"/>
|
||||
<converter:String2BrushConverter x:Key="String2BrushConverter"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using HandyControl.Data;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Tools.Converter;
|
||||
using Newtonsoft.Json;
|
||||
@@ -125,5 +127,62 @@ namespace HandyControlDemo.Service
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
internal ObservableCollection<CoverViewDemoModel> GetCoverViewDemoDataList()
|
||||
{
|
||||
return new ObservableCollection<CoverViewDemoModel>
|
||||
{
|
||||
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
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
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(Brush);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,89 +3,22 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
DataContext="{Binding CoverView,Source={StaticResource Locator}}"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<controls:TransitioningContentControl>
|
||||
<controls:CoverView Margin="27" Width="880" Height="432" ItemWidth="160" ItemHeight="160">
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/1.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource SuccessBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/2.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource PrimaryBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/3.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource WarningBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/4.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource DangerBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/5.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource SuccessBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/6.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource PrimaryBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/7.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource InfoBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/8.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource WarningBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/9.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource PrimaryBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverViewItem>
|
||||
<controls:CoverViewItem.Header>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg"/>
|
||||
</controls:CoverViewItem.Header>
|
||||
<Border Margin="10" Height="300" Background="{DynamicResource DangerBrush}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</controls:CoverViewItem>
|
||||
<controls:CoverView Margin="27" Width="880" Height="432" ItemWidth="160" ItemHeight="160" ItemsSource="{Binding DataList}">
|
||||
<controls:CoverView.ItemHeaderTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="{Binding ImgPath}"/>
|
||||
</DataTemplate>
|
||||
</controls:CoverView.ItemHeaderTemplate>
|
||||
<controls:CoverView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Margin="10" Height="300" Background="{Binding BackgroundToken,Converter={StaticResource String2BrushConverter}}">
|
||||
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</controls:CoverView.ItemTemplate>
|
||||
</controls:CoverView>
|
||||
</controls:TransitioningContentControl>
|
||||
</UserControl>
|
||||
</UserControl>
|
||||
@@ -1,25 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using GalaSoft.MvvmLight;
|
||||
using HandyControlDemo.Service;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class ComboBoxDemoViewModel : ViewModelBase
|
||||
public class ComboBoxDemoViewModel : DemoViewModelBase<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
private List<string> _dataList;
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
public List<string> DataList
|
||||
{
|
||||
get => _dataList;
|
||||
set => Set(nameof(DataList), ref _dataList, value);
|
||||
}
|
||||
|
||||
public ComboBoxDemoViewModel(DataService dataService) => DataList = dataService.GetComboBoxDemoDataList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class CoverViewModel : DemoViewModelBase<CoverViewDemoModel>
|
||||
{
|
||||
public CoverViewModel(DataService dataService) => DataList = dataService.GetCoverViewDemoDataList();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Data;
|
||||
using HandyControlDemo.Data;
|
||||
@@ -8,27 +7,13 @@ using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class PaginationDemoViewModel : ViewModelBase
|
||||
public class PaginationDemoViewModel : DemoViewModelBase<DemoDataModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// 所有数据
|
||||
/// </summary>
|
||||
private readonly List<DemoDataModel> _totalDataList;
|
||||
|
||||
/// <summary>
|
||||
/// 显示的数据
|
||||
/// </summary>
|
||||
private List<DemoDataModel> _dataList;
|
||||
|
||||
/// <summary>
|
||||
/// 显示的数据
|
||||
/// </summary>
|
||||
public List<DemoDataModel> DataList
|
||||
{
|
||||
get => _dataList;
|
||||
set => Set(nameof(DataList), ref _dataList, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
using HandyControlDemo.Data;
|
||||
@@ -9,26 +7,9 @@ using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class StepBarDemoViewModel : ViewModelBase
|
||||
public class StepBarDemoViewModel : DemoViewModelBase<StepBarDemoModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
private List<StepBarDemoModel> _dataList;
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
public List<StepBarDemoModel> DataList
|
||||
{
|
||||
get => _dataList;
|
||||
set => Set(nameof(DataList), ref _dataList, value);
|
||||
}
|
||||
|
||||
public StepBarDemoViewModel(DataService dataService)
|
||||
{
|
||||
DataList = dataService.GetStepBarDemoDataList();
|
||||
}
|
||||
public StepBarDemoViewModel(DataService dataService) => DataList = dataService.GetStepBarDemoDataList();
|
||||
|
||||
private RelayCommand<Panel> _nextCmd;
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class DemoViewModelBase<T> : ViewModelBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
private IList<T> _dataList;
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
public IList<T> DataList
|
||||
{
|
||||
get => _dataList;
|
||||
set => Set(nameof(DataList), ref _dataList, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using GalaSoft.MvvmLight;
|
||||
using System.Threading;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class ContributorsViewModel : ViewModelBase
|
||||
public class ContributorsViewModel : DemoViewModelBase<ContributorModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
private List<ContributorModel> _dataList;
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
public List<ContributorModel> DataList
|
||||
{
|
||||
get => _dataList;
|
||||
set => Set(nameof(DataList), ref _dataList, value);
|
||||
}
|
||||
|
||||
public ContributorsViewModel(DataService dataService)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Controls;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using HandyControlDemo.Data;
|
||||
@@ -10,7 +8,7 @@ using HandyControlDemo.Tools;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
public class MainViewModel : DemoViewModelBase<DemoDataModel>
|
||||
{
|
||||
#region 字段
|
||||
|
||||
@@ -24,11 +22,6 @@ namespace HandyControlDemo.ViewModel
|
||||
/// </summary>
|
||||
private object _subContent;
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
private List<DemoDataModel> _dataList;
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中的列表项
|
||||
/// </summary>
|
||||
@@ -57,15 +50,6 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
#region 属性
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
public List<DemoDataModel> DataList
|
||||
{
|
||||
get => _dataList;
|
||||
set => Set(nameof(DataList), ref _dataList, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 子内容
|
||||
/// </summary>
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace HandyControlDemo.ViewModel
|
||||
SimpleIoc.Default.Register<StepBarDemoViewModel>();
|
||||
SimpleIoc.Default.Register<PaginationDemoViewModel>();
|
||||
SimpleIoc.Default.Register<ChatBoxViewModel>();
|
||||
SimpleIoc.Default.Register<CoverViewModel>();
|
||||
}
|
||||
|
||||
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
|
||||
@@ -48,6 +49,8 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public ChatBoxViewModel ChatBox => new ChatBoxViewModel();
|
||||
|
||||
public CoverViewModel CoverView => ServiceLocator.Current.GetInstance<CoverViewModel>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user