Synchronize the Net40

This commit is contained in:
NaBian committed 2019-02-14 10:46:52 +08:00
1 parent 5f299e988e
commit a5a20d51ae
23 files changed
+394 -226

No files matched your search

@@ -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
}
}