Synchronize the Net40
This commit is contained in:
1 parent
b3c3173c46
commit
ab6e2efe21
87 files changed
+2743
-349
No files matched your search
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class GrowlDemoViewModel
|
||||
{
|
||||
public RelayCommand InfoCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Info(Properties.Langs.Lang.GrowlInfo))).Value;
|
||||
|
||||
public RelayCommand SuccessCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Success(Properties.Langs.Lang.GrowlSuccess))).Value;
|
||||
|
||||
public RelayCommand WarningCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Warning(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlWarning,
|
||||
CancelStr = Properties.Langs.Lang.Ignore,
|
||||
ActionBeforeClose = isConfirmed =>
|
||||
{
|
||||
Growl.Info(isConfirmed.ToString());
|
||||
return true;
|
||||
}
|
||||
}))).Value;
|
||||
|
||||
public RelayCommand ErrorCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Error(Properties.Langs.Lang.GrowlError))).Value;
|
||||
|
||||
public RelayCommand AskCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
|
||||
{
|
||||
Growl.Info(isConfirmed.ToString());
|
||||
return true;
|
||||
}))).Value;
|
||||
|
||||
public RelayCommand FatalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Fatal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false
|
||||
}))).Value;
|
||||
|
||||
public RelayCommand ClearCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(Growl.Clear)).Value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class ImageBrowserDemoViewModel
|
||||
{
|
||||
private RelayCommand _openImgCmd;
|
||||
|
||||
public RelayCommand OpenImgCmd =>
|
||||
_openImgCmd ?? (_openImgCmd = new RelayCommand(() =>
|
||||
new ImageBrowser(new Uri("pack://application:,,,/Resources/Img/1.jpg")).Show()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Data;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class PaginationDemoViewModel : ViewModelBase
|
||||
{
|
||||
/// <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>
|
||||
private int _pageIndex = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
public int PageIndex
|
||||
{
|
||||
get => _pageIndex;
|
||||
set => Set(nameof(PageIndex), ref _pageIndex, value);
|
||||
}
|
||||
|
||||
public PaginationDemoViewModel(DataService dataService)
|
||||
{
|
||||
_totalDataList = dataService.GetDemoDataList(100);
|
||||
DataList = _totalDataList.Take(10).ToList();
|
||||
}
|
||||
|
||||
private RelayCommand<FunctionEventArgs<int>> _pageUpdatedCmd;
|
||||
|
||||
/// <summary>
|
||||
/// 页码改变命令
|
||||
/// </summary>
|
||||
public RelayCommand<FunctionEventArgs<int>> PageUpdatedCmd =>
|
||||
_pageUpdatedCmd ?? (_pageUpdatedCmd = new RelayCommand<FunctionEventArgs<int>>(PageUpdated));
|
||||
|
||||
/// <summary>
|
||||
/// 页码改变
|
||||
/// </summary>
|
||||
private void PageUpdated(FunctionEventArgs<int> info)
|
||||
{
|
||||
DataList = _totalDataList.Skip((info.Info - 1) * 10).Take(10).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class StepBarDemoViewModel : ViewModelBase
|
||||
{
|
||||
/// <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();
|
||||
}
|
||||
|
||||
private RelayCommand<Panel> _nextCmd;
|
||||
|
||||
/// <summary>
|
||||
/// 下一步
|
||||
/// </summary>
|
||||
public RelayCommand<Panel> NextCmd => _nextCmd ?? (_nextCmd = new RelayCommand<Panel>(Next));
|
||||
|
||||
private RelayCommand<Panel> _prevCmd;
|
||||
|
||||
/// <summary>
|
||||
/// 上一步
|
||||
/// </summary>
|
||||
public RelayCommand<Panel> PrevCmd => _prevCmd ?? (_prevCmd = new RelayCommand<Panel>(Prev));
|
||||
|
||||
private void Next(Panel panel)
|
||||
{
|
||||
foreach (var stepBar in panel.Children.OfType<StepBar>())
|
||||
{
|
||||
stepBar.Next();
|
||||
}
|
||||
}
|
||||
|
||||
private void Prev(Panel panel)
|
||||
{
|
||||
foreach (var stepBar in panel.Children.OfType<StepBar>())
|
||||
{
|
||||
stepBar.Prev();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Windows;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControlDemo.Tools;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class WindowDemoViewModel
|
||||
{
|
||||
private RelayCommand<string> _openWindowCmd;
|
||||
|
||||
public RelayCommand<string> OpenWindowCmd =>
|
||||
_openWindowCmd ?? (_openWindowCmd = new RelayCommand<string>(OpenWindow));
|
||||
|
||||
private void OpenWindow(string windowTag)
|
||||
{
|
||||
if (AssemblyHelper.CreateInternalInstance($"Window.{windowTag}") is System.Windows.Window window)
|
||||
{
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user