chore: use file-scoped namespace
This commit is contained in:
1 parent
99d2fafb72
commit
bbf1b7d4c6
748 files changed
+57929
-58678
No files matched your search
+40
-41
@@ -4,21 +4,21 @@ using HandyControl.Collections;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class AutoCompleteTextBoxDemoViewModel : ViewModelBase
|
||||
{
|
||||
private string _searchText;
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public string SearchText
|
||||
{
|
||||
get => _searchText;
|
||||
public class AutoCompleteTextBoxDemoViewModel : ViewModelBase
|
||||
{
|
||||
private string _searchText;
|
||||
|
||||
public string SearchText
|
||||
{
|
||||
get => _searchText;
|
||||
#if NET40
|
||||
set
|
||||
{
|
||||
Set(nameof(SearchText), ref _searchText, value);
|
||||
FilterItems(value);
|
||||
}
|
||||
set
|
||||
{
|
||||
Set(nameof(SearchText), ref _searchText, value);
|
||||
FilterItems(value);
|
||||
}
|
||||
#else
|
||||
set
|
||||
{
|
||||
@@ -26,32 +26,31 @@ namespace HandyControlDemo.ViewModel
|
||||
FilterItems(value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public ManualObservableCollection<DemoDataModel> Items { get; set; } = new();
|
||||
|
||||
private readonly List<DemoDataModel> _dataList;
|
||||
|
||||
public AutoCompleteTextBoxDemoViewModel(DataService dataService)
|
||||
{
|
||||
_dataList = dataService.GetDemoDataList(10);
|
||||
}
|
||||
|
||||
private void FilterItems(string key)
|
||||
{
|
||||
Items.CanNotify = false;
|
||||
|
||||
Items.Clear();
|
||||
|
||||
foreach (var data in _dataList)
|
||||
{
|
||||
if (data.Name.ToLower().Contains(key.ToLower()))
|
||||
{
|
||||
Items.Add(data);
|
||||
}
|
||||
}
|
||||
|
||||
Items.CanNotify = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ManualObservableCollection<DemoDataModel> Items { get; set; } = new();
|
||||
|
||||
private readonly List<DemoDataModel> _dataList;
|
||||
|
||||
public AutoCompleteTextBoxDemoViewModel(DataService dataService)
|
||||
{
|
||||
_dataList = dataService.GetDemoDataList(10);
|
||||
}
|
||||
|
||||
private void FilterItems(string key)
|
||||
{
|
||||
Items.CanNotify = false;
|
||||
|
||||
Items.Clear();
|
||||
|
||||
foreach (var data in _dataList)
|
||||
{
|
||||
if (data.Name.ToLower().Contains(key.ToLower()))
|
||||
{
|
||||
Items.Add(data);
|
||||
}
|
||||
}
|
||||
|
||||
Items.CanNotify = true;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,21 @@
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class BadgeDemoViewModel : ViewModelBase
|
||||
{
|
||||
private int _count = 1;
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public int Count
|
||||
{
|
||||
get => _count;
|
||||
public class BadgeDemoViewModel : ViewModelBase
|
||||
{
|
||||
private int _count = 1;
|
||||
|
||||
public int Count
|
||||
{
|
||||
get => _count;
|
||||
#if NET40
|
||||
set => Set(nameof(Count), ref _count, value);
|
||||
set => Set(nameof(Count), ref _count, value);
|
||||
#else
|
||||
set => Set(ref _count, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
public RelayCommand CountCmd => new(() => Count++);
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand CountCmd => new(() => Count++);
|
||||
}
|
||||
@@ -2,26 +2,25 @@
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class CardDemoViewModel : DemoViewModelBase<CardModel>
|
||||
{
|
||||
public class CardDemoViewModel : DemoViewModelBase<CardModel>
|
||||
private readonly DataService _dataService;
|
||||
|
||||
public CardDemoViewModel(DataService dataService)
|
||||
{
|
||||
private readonly DataService _dataService;
|
||||
|
||||
public CardDemoViewModel(DataService dataService)
|
||||
{
|
||||
_dataService = dataService;
|
||||
DataList = dataService.GetCardDataList();
|
||||
}
|
||||
|
||||
public RelayCommand AddItemCmd => new(() => DataList.Insert(0, _dataService.GetCardData()));
|
||||
|
||||
public RelayCommand RemoveItemCmd => new(() =>
|
||||
{
|
||||
if (DataList.Count > 0)
|
||||
{
|
||||
DataList.RemoveAt(0);
|
||||
}
|
||||
});
|
||||
_dataService = dataService;
|
||||
DataList = dataService.GetCardDataList();
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand AddItemCmd => new(() => DataList.Insert(0, _dataService.GetCardData()));
|
||||
|
||||
public RelayCommand RemoveItemCmd => new(() =>
|
||||
{
|
||||
if (DataList.Count > 0)
|
||||
{
|
||||
DataList.RemoveAt(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class CoverViewModel : DemoViewModelBase<CoverViewDemoModel>
|
||||
{
|
||||
public class CoverViewModel : DemoViewModelBase<CoverViewDemoModel>
|
||||
{
|
||||
public CoverViewModel(DataService dataService) => DataList = dataService.GetCoverViewDemoDataList();
|
||||
}
|
||||
}
|
||||
public CoverViewModel(DataService dataService) => DataList = dataService.GetCoverViewDemoDataList();
|
||||
}
|
||||
@@ -11,52 +11,52 @@ using HandyControlDemo.Data;
|
||||
using HandyControlDemo.UserControl;
|
||||
using HandyControlDemo.Window;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class DialogDemoViewModel : ViewModelBase
|
||||
{
|
||||
private string _dialogResult;
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public string DialogResult
|
||||
{
|
||||
get => _dialogResult;
|
||||
public class DialogDemoViewModel : ViewModelBase
|
||||
{
|
||||
private string _dialogResult;
|
||||
|
||||
public string DialogResult
|
||||
{
|
||||
get => _dialogResult;
|
||||
#if NET40
|
||||
set => Set(nameof(DialogResult), ref _dialogResult, value);
|
||||
set => Set(nameof(DialogResult), ref _dialogResult, value);
|
||||
#else
|
||||
set => Set(ref _dialogResult, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand<FrameworkElement> ShowTextCmd => new(ShowText);
|
||||
public RelayCommand<FrameworkElement> ShowTextCmd => new(ShowText);
|
||||
|
||||
private void ShowText(FrameworkElement element)
|
||||
private void ShowText(FrameworkElement element)
|
||||
{
|
||||
if (element == null)
|
||||
{
|
||||
if (element == null)
|
||||
{
|
||||
Dialog.Show(new TextDialog());
|
||||
}
|
||||
else
|
||||
{
|
||||
Dialog.Show(new TextDialog(), MessageToken.DialogContainer);
|
||||
}
|
||||
Dialog.Show(new TextDialog());
|
||||
}
|
||||
else
|
||||
{
|
||||
Dialog.Show(new TextDialog(), MessageToken.DialogContainer);
|
||||
}
|
||||
}
|
||||
|
||||
#if NET40
|
||||
public RelayCommand<bool> ShowInteractiveDialogCmd => new(ShowInteractiveDialog);
|
||||
public RelayCommand<bool> ShowInteractiveDialogCmd => new(ShowInteractiveDialog);
|
||||
|
||||
private void ShowInteractiveDialog(bool withTimer)
|
||||
private void ShowInteractiveDialog(bool withTimer)
|
||||
{
|
||||
if (!withTimer)
|
||||
{
|
||||
if (!withTimer)
|
||||
{
|
||||
Dialog.Show<InteractiveDialog>()
|
||||
.Initialize<InteractiveDialogViewModel>(vm => vm.Message = DialogResult)
|
||||
.GetResultAsync<string>().ContinueWith(str => DialogResult = str.Result);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dialog.Show<TextDialogWithTimer>(MessageToken.MainWindow).GetResultAsync<string>();
|
||||
}
|
||||
Dialog.Show<InteractiveDialog>()
|
||||
.Initialize<InteractiveDialogViewModel>(vm => vm.Message = DialogResult)
|
||||
.GetResultAsync<string>().ContinueWith(str => DialogResult = str.Result);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dialog.Show<TextDialogWithTimer>(MessageToken.MainWindow).GetResultAsync<string>();
|
||||
}
|
||||
}
|
||||
#else
|
||||
public RelayCommand<bool> ShowInteractiveDialogCmd => new(async withTimer => await ShowInteractiveDialog(withTimer));
|
||||
|
||||
@@ -75,11 +75,10 @@ namespace HandyControlDemo.ViewModel
|
||||
}
|
||||
#endif
|
||||
|
||||
public RelayCommand NewWindowCmd => new(() => new DialogDemoWindow
|
||||
{
|
||||
Owner = Application.Current.MainWindow
|
||||
}.Show());
|
||||
public RelayCommand NewWindowCmd => new(() => new DialogDemoWindow
|
||||
{
|
||||
Owner = Application.Current.MainWindow
|
||||
}.Show());
|
||||
|
||||
public RelayCommand<string> ShowWithTokenCmd => new(token => Dialog.Show(new TextDialog(), token));
|
||||
}
|
||||
}
|
||||
public RelayCommand<string> ShowWithTokenCmd => new(token => Dialog.Show(new TextDialog(), token));
|
||||
}
|
||||
@@ -4,97 +4,96 @@ using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControlDemo.Window;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class GrowlDemoViewModel
|
||||
{
|
||||
public class GrowlDemoViewModel
|
||||
private readonly string _token;
|
||||
|
||||
public GrowlDemoViewModel()
|
||||
{
|
||||
private readonly string _token;
|
||||
|
||||
public GrowlDemoViewModel()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
public GrowlDemoViewModel(string token)
|
||||
{
|
||||
_token = token;
|
||||
}
|
||||
|
||||
public GrowlDemoViewModel(string token)
|
||||
{
|
||||
_token = token;
|
||||
}
|
||||
#region Window
|
||||
|
||||
#region Window
|
||||
public RelayCommand InfoCmd => new(() => Growl.Info(Properties.Langs.Lang.GrowlInfo, _token));
|
||||
|
||||
public RelayCommand InfoCmd => new(() => Growl.Info(Properties.Langs.Lang.GrowlInfo, _token));
|
||||
public RelayCommand SuccessCmd => new(() => Growl.Success(Properties.Langs.Lang.GrowlSuccess, _token));
|
||||
|
||||
public RelayCommand SuccessCmd => new(() => Growl.Success(Properties.Langs.Lang.GrowlSuccess, _token));
|
||||
|
||||
public RelayCommand WarningCmd => new(() => Growl.Warning(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlWarning,
|
||||
CancelStr = Properties.Langs.Lang.Ignore,
|
||||
ActionBeforeClose = isConfirmed =>
|
||||
{
|
||||
Growl.Info(isConfirmed.ToString());
|
||||
return true;
|
||||
},
|
||||
Token = _token
|
||||
}));
|
||||
|
||||
public RelayCommand ErrorCmd => new(() => Growl.Error(Properties.Langs.Lang.GrowlError, _token));
|
||||
|
||||
public RelayCommand AskCmd => new(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
|
||||
public RelayCommand WarningCmd => new(() => Growl.Warning(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlWarning,
|
||||
CancelStr = Properties.Langs.Lang.Ignore,
|
||||
ActionBeforeClose = isConfirmed =>
|
||||
{
|
||||
Growl.Info(isConfirmed.ToString());
|
||||
return true;
|
||||
}, _token));
|
||||
},
|
||||
Token = _token
|
||||
}));
|
||||
|
||||
public RelayCommand FatalCmd => new(() => Growl.Fatal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false,
|
||||
Token = _token
|
||||
}));
|
||||
public RelayCommand ErrorCmd => new(() => Growl.Error(Properties.Langs.Lang.GrowlError, _token));
|
||||
|
||||
public RelayCommand ClearCmd => new(() => Growl.Clear(_token));
|
||||
public RelayCommand AskCmd => new(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
|
||||
{
|
||||
Growl.Info(isConfirmed.ToString());
|
||||
return true;
|
||||
}, _token));
|
||||
|
||||
#endregion
|
||||
public RelayCommand FatalCmd => new(() => Growl.Fatal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false,
|
||||
Token = _token
|
||||
}));
|
||||
|
||||
#region Desktop
|
||||
public RelayCommand ClearCmd => new(() => Growl.Clear(_token));
|
||||
|
||||
public RelayCommand InfoGlobalCmd => new(() => Growl.InfoGlobal(Properties.Langs.Lang.GrowlInfo));
|
||||
#endregion
|
||||
|
||||
public RelayCommand SuccessGlobalCmd => new(() => Growl.SuccessGlobal(Properties.Langs.Lang.GrowlSuccess));
|
||||
#region Desktop
|
||||
|
||||
public RelayCommand WarningGlobalCmd => new(() => Growl.WarningGlobal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlWarning,
|
||||
CancelStr = Properties.Langs.Lang.Ignore,
|
||||
ActionBeforeClose = isConfirmed =>
|
||||
{
|
||||
Growl.InfoGlobal(isConfirmed.ToString());
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
public RelayCommand InfoGlobalCmd => new(() => Growl.InfoGlobal(Properties.Langs.Lang.GrowlInfo));
|
||||
|
||||
public RelayCommand ErrorGlobalCmd => new(() => Growl.ErrorGlobal(Properties.Langs.Lang.GrowlError));
|
||||
public RelayCommand SuccessGlobalCmd => new(() => Growl.SuccessGlobal(Properties.Langs.Lang.GrowlSuccess));
|
||||
|
||||
public RelayCommand AskGlobalCmd => new(() => Growl.AskGlobal(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
|
||||
public RelayCommand WarningGlobalCmd => new(() => Growl.WarningGlobal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlWarning,
|
||||
CancelStr = Properties.Langs.Lang.Ignore,
|
||||
ActionBeforeClose = isConfirmed =>
|
||||
{
|
||||
Growl.InfoGlobal(isConfirmed.ToString());
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
}));
|
||||
|
||||
public RelayCommand FatalGlobalCmd => new(() => Growl.FatalGlobal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false
|
||||
}));
|
||||
public RelayCommand ErrorGlobalCmd => new(() => Growl.ErrorGlobal(Properties.Langs.Lang.GrowlError));
|
||||
|
||||
public RelayCommand ClearGlobalCmd => new(Growl.ClearGlobal);
|
||||
public RelayCommand AskGlobalCmd => new(() => Growl.AskGlobal(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
|
||||
{
|
||||
Growl.InfoGlobal(isConfirmed.ToString());
|
||||
return true;
|
||||
}));
|
||||
|
||||
#endregion
|
||||
public RelayCommand FatalGlobalCmd => new(() => Growl.FatalGlobal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false
|
||||
}));
|
||||
|
||||
public RelayCommand NewWindowCmd => new(() => new GrowlDemoWindow
|
||||
{
|
||||
Owner = Application.Current.MainWindow
|
||||
}.Show());
|
||||
}
|
||||
}
|
||||
public RelayCommand ClearGlobalCmd => new(Growl.ClearGlobal);
|
||||
|
||||
#endregion
|
||||
|
||||
public RelayCommand NewWindowCmd => new(() => new GrowlDemoWindow
|
||||
{
|
||||
Owner = Application.Current.MainWindow
|
||||
}.Show());
|
||||
}
|
||||
@@ -2,11 +2,10 @@
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class ImageBrowserDemoViewModel
|
||||
{
|
||||
public class ImageBrowserDemoViewModel
|
||||
{
|
||||
public RelayCommand OpenImgCmd => new(() =>
|
||||
new ImageBrowser(new Uri("pack://application:,,,/Resources/Img/1.jpg")).Show());
|
||||
}
|
||||
}
|
||||
public RelayCommand OpenImgCmd => new(() =>
|
||||
new ImageBrowser(new Uri("pack://application:,,,/Resources/Img/1.jpg")).Show());
|
||||
}
|
||||
+17
-18
@@ -4,34 +4,33 @@ using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControlDemo.UserControl;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class NotificationDemoViewModel : ViewModelBase
|
||||
{
|
||||
public class NotificationDemoViewModel : ViewModelBase
|
||||
public RelayCommand OpenCmd => new(() => Notification.Show(new AppNotification(), ShowAnimation, StaysOpen));
|
||||
|
||||
private ShowAnimation _showAnimation;
|
||||
|
||||
public ShowAnimation ShowAnimation
|
||||
{
|
||||
public RelayCommand OpenCmd => new(() => Notification.Show(new AppNotification(), ShowAnimation, StaysOpen));
|
||||
|
||||
private ShowAnimation _showAnimation;
|
||||
|
||||
public ShowAnimation ShowAnimation
|
||||
{
|
||||
get => _showAnimation;
|
||||
get => _showAnimation;
|
||||
#if NET40
|
||||
set => Set(nameof(ShowAnimation) ,ref _showAnimation, value);
|
||||
set => Set(nameof(ShowAnimation) ,ref _showAnimation, value);
|
||||
#else
|
||||
set => Set(ref _showAnimation, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private bool _staysOpen = true;
|
||||
private bool _staysOpen = true;
|
||||
|
||||
public bool StaysOpen
|
||||
{
|
||||
get => _staysOpen;
|
||||
public bool StaysOpen
|
||||
{
|
||||
get => _staysOpen;
|
||||
#if NET40
|
||||
set => Set(nameof(StaysOpen) ,ref _staysOpen, value);
|
||||
set => Set(nameof(StaysOpen) ,ref _staysOpen, value);
|
||||
#else
|
||||
set => Set(ref _staysOpen, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,114 +5,113 @@ using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class NotifyIconDemoViewModel : ViewModelBase
|
||||
{
|
||||
public class NotifyIconDemoViewModel : ViewModelBase
|
||||
private bool _isCleanup;
|
||||
|
||||
private bool _reversed;
|
||||
|
||||
private string _content = "Hello~~~";
|
||||
|
||||
public string Content
|
||||
{
|
||||
private bool _isCleanup;
|
||||
|
||||
private bool _reversed;
|
||||
|
||||
private string _content = "Hello~~~";
|
||||
|
||||
public string Content
|
||||
{
|
||||
get => _content;
|
||||
get => _content;
|
||||
#if NET40
|
||||
set => Set(nameof(Content), ref _content, value);
|
||||
#else
|
||||
set => Set(ref _content, value);
|
||||
set => Set(ref _content, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private bool _contextMenuIsShow;
|
||||
private bool _contextMenuIsShow;
|
||||
|
||||
public bool ContextMenuIsShow
|
||||
public bool ContextMenuIsShow
|
||||
{
|
||||
get => _contextMenuIsShow;
|
||||
set
|
||||
{
|
||||
get => _contextMenuIsShow;
|
||||
set
|
||||
{
|
||||
#if NET40
|
||||
Set(nameof(ContextMenuIsShow), ref _contextMenuIsShow, value);
|
||||
#else
|
||||
Set(ref _contextMenuIsShow, value);
|
||||
Set(ref _contextMenuIsShow, value);
|
||||
#endif
|
||||
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
|
||||
if (!_isCleanup && !_reversed)
|
||||
{
|
||||
_reversed = true;
|
||||
ContextContentIsShow = !value;
|
||||
_reversed = false;
|
||||
}
|
||||
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
|
||||
if (!_isCleanup && !_reversed)
|
||||
{
|
||||
_reversed = true;
|
||||
ContextContentIsShow = !value;
|
||||
_reversed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _contextMenuIsBlink;
|
||||
private bool _contextMenuIsBlink;
|
||||
|
||||
public bool ContextMenuIsBlink
|
||||
{
|
||||
get => _contextMenuIsBlink;
|
||||
public bool ContextMenuIsBlink
|
||||
{
|
||||
get => _contextMenuIsBlink;
|
||||
#if NET40
|
||||
set => Set(nameof(ContextMenuIsBlink), ref _contextMenuIsBlink, value);
|
||||
#else
|
||||
set => Set(ref _contextMenuIsBlink, value);
|
||||
set => Set(ref _contextMenuIsBlink, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private bool _contextContentIsShow;
|
||||
private bool _contextContentIsShow;
|
||||
|
||||
public bool ContextContentIsShow
|
||||
public bool ContextContentIsShow
|
||||
{
|
||||
get => _contextContentIsShow;
|
||||
set
|
||||
{
|
||||
get => _contextContentIsShow;
|
||||
set
|
||||
{
|
||||
#if NET40
|
||||
Set(nameof(ContextContentIsShow), ref _contextContentIsShow, value);
|
||||
#else
|
||||
Set(ref _contextContentIsShow, value);
|
||||
Set(ref _contextContentIsShow, value);
|
||||
#endif
|
||||
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
|
||||
if (!_isCleanup && !_reversed)
|
||||
{
|
||||
_reversed = true;
|
||||
ContextMenuIsShow = !value;
|
||||
_reversed = false;
|
||||
}
|
||||
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
|
||||
if (!_isCleanup && !_reversed)
|
||||
{
|
||||
_reversed = true;
|
||||
ContextMenuIsShow = !value;
|
||||
_reversed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _contextContentIsBlink;
|
||||
private bool _contextContentIsBlink;
|
||||
|
||||
public bool ContextContentIsBlink
|
||||
{
|
||||
get => _contextContentIsBlink;
|
||||
public bool ContextContentIsBlink
|
||||
{
|
||||
get => _contextContentIsBlink;
|
||||
#if NET40
|
||||
set => Set(nameof(ContextContentIsBlink), ref _contextContentIsBlink, value);
|
||||
#else
|
||||
set => Set(ref _contextContentIsBlink, value);
|
||||
set => Set(ref _contextContentIsBlink, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
public RelayCommand<object> MouseCmd => new(str => Growl.Info(str.ToString()));
|
||||
|
||||
public RelayCommand SendNotificationCmd => new(SendNotification);
|
||||
|
||||
private void SendNotification()
|
||||
{
|
||||
NotifyIcon.ShowBalloonTip("HandyControl", Content, NotifyIconInfoType.None, ContextMenuIsShow ? MessageToken.NotifyIconDemo : MessageToken.NotifyIconContextDemo);
|
||||
}
|
||||
|
||||
public override void Cleanup()
|
||||
{
|
||||
base.Cleanup();
|
||||
|
||||
_isCleanup = true;
|
||||
ContextMenuIsShow = false;
|
||||
ContextMenuIsBlink = false;
|
||||
ContextContentIsShow = false;
|
||||
ContextContentIsBlink = false;
|
||||
GlobalData.NotifyIconIsShow = false;
|
||||
_isCleanup = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand<object> MouseCmd => new(str => Growl.Info(str.ToString()));
|
||||
|
||||
public RelayCommand SendNotificationCmd => new(SendNotification);
|
||||
|
||||
private void SendNotification()
|
||||
{
|
||||
NotifyIcon.ShowBalloonTip("HandyControl", Content, NotifyIconInfoType.None, ContextMenuIsShow ? MessageToken.NotifyIconDemo : MessageToken.NotifyIconContextDemo);
|
||||
}
|
||||
|
||||
public override void Cleanup()
|
||||
{
|
||||
base.Cleanup();
|
||||
|
||||
_isCleanup = true;
|
||||
ContextMenuIsShow = false;
|
||||
ContextMenuIsBlink = false;
|
||||
ContextContentIsShow = false;
|
||||
ContextContentIsBlink = false;
|
||||
GlobalData.NotifyIconIsShow = false;
|
||||
_isCleanup = false;
|
||||
}
|
||||
}
|
||||
@@ -5,50 +5,49 @@ using HandyControl.Data;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class PaginationDemoViewModel : DemoViewModelBase<DemoDataModel>
|
||||
{
|
||||
public class PaginationDemoViewModel : DemoViewModelBase<DemoDataModel>
|
||||
/// <summary>
|
||||
/// 所有数据
|
||||
/// </summary>
|
||||
private readonly List<DemoDataModel> _totalDataList;
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
private int _pageIndex = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
public int PageIndex
|
||||
{
|
||||
/// <summary>
|
||||
/// 所有数据
|
||||
/// </summary>
|
||||
private readonly List<DemoDataModel> _totalDataList;
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
private int _pageIndex = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
public int PageIndex
|
||||
{
|
||||
get => _pageIndex;
|
||||
get => _pageIndex;
|
||||
#if NET40
|
||||
set => Set(nameof(PageIndex), ref _pageIndex, value);
|
||||
#else
|
||||
set => Set(ref _pageIndex, value);
|
||||
set => Set(ref _pageIndex, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
public PaginationDemoViewModel(DataService dataService)
|
||||
{
|
||||
_totalDataList = dataService.GetDemoDataList(100);
|
||||
DataList = _totalDataList.Take(10).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页码改变命令
|
||||
/// </summary>
|
||||
public RelayCommand<FunctionEventArgs<int>> PageUpdatedCmd => new(PageUpdated);
|
||||
|
||||
/// <summary>
|
||||
/// 页码改变
|
||||
/// </summary>
|
||||
private void PageUpdated(FunctionEventArgs<int> info)
|
||||
{
|
||||
DataList = _totalDataList.Skip((info.Info - 1) * 10).Take(10).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PaginationDemoViewModel(DataService dataService)
|
||||
{
|
||||
_totalDataList = dataService.GetDemoDataList(100);
|
||||
DataList = _totalDataList.Take(10).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页码改变命令
|
||||
/// </summary>
|
||||
public RelayCommand<FunctionEventArgs<int>> PageUpdatedCmd => new(PageUpdated);
|
||||
|
||||
/// <summary>
|
||||
/// 页码改变
|
||||
/// </summary>
|
||||
private void PageUpdated(FunctionEventArgs<int> info)
|
||||
{
|
||||
DataList = _totalDataList.Skip((info.Info - 1) * 10).Take(10).ToList();
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,15 @@ using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class SideMenuDemoViewModel : ViewModelBase
|
||||
{
|
||||
public class SideMenuDemoViewModel : ViewModelBase
|
||||
{
|
||||
public RelayCommand<FunctionEventArgs<object>> SwitchItemCmd => new(SwitchItem);
|
||||
public RelayCommand<FunctionEventArgs<object>> SwitchItemCmd => new(SwitchItem);
|
||||
|
||||
private void SwitchItem(FunctionEventArgs<object> info) => Growl.Info((info.Info as SideMenuItem)?.Header.ToString());
|
||||
private void SwitchItem(FunctionEventArgs<object> info) => Growl.Info((info.Info as SideMenuItem)?.Header.ToString());
|
||||
|
||||
public RelayCommand<string> SelectCmd => new(Select);
|
||||
public RelayCommand<string> SelectCmd => new(Select);
|
||||
|
||||
private void Select(string header) => Growl.Success(header);
|
||||
}
|
||||
}
|
||||
private void Select(string header) => Growl.Success(header);
|
||||
}
|
||||
@@ -2,10 +2,9 @@
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class SplitButtonDemoViewModel : ViewModelBase
|
||||
{
|
||||
public class SplitButtonDemoViewModel : ViewModelBase
|
||||
{
|
||||
public RelayCommand<string> SelectCmd => new(str => Growl.Info(str));
|
||||
}
|
||||
}
|
||||
public RelayCommand<string> SelectCmd => new(str => Growl.Info(str));
|
||||
}
|
||||
@@ -2,10 +2,9 @@
|
||||
using HandyControl.Controls;
|
||||
using HandyControlDemo.UserControl;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class SpriteDemoViewModel
|
||||
{
|
||||
public class SpriteDemoViewModel
|
||||
{
|
||||
public RelayCommand OpenCmd => new(() => Sprite.Show(new AppSprite()));
|
||||
}
|
||||
}
|
||||
public RelayCommand OpenCmd => new(() => Sprite.Show(new AppSprite()));
|
||||
}
|
||||
@@ -5,48 +5,47 @@ using HandyControl.Controls;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class StepBarDemoViewModel : DemoViewModelBase<StepBarDemoModel>
|
||||
{
|
||||
public class StepBarDemoViewModel : DemoViewModelBase<StepBarDemoModel>
|
||||
public StepBarDemoViewModel(DataService dataService) => DataList = dataService.GetStepBarDemoDataList();
|
||||
|
||||
private int _stepIndex;
|
||||
|
||||
public int StepIndex
|
||||
{
|
||||
public StepBarDemoViewModel(DataService dataService) => DataList = dataService.GetStepBarDemoDataList();
|
||||
|
||||
private int _stepIndex;
|
||||
|
||||
public int StepIndex
|
||||
{
|
||||
get => _stepIndex;
|
||||
get => _stepIndex;
|
||||
#if NET40
|
||||
set => Set(nameof(StepIndex), ref _stepIndex, value);
|
||||
set => Set(nameof(StepIndex), ref _stepIndex, value);
|
||||
#else
|
||||
set => Set(ref _stepIndex, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下一步
|
||||
/// </summary>
|
||||
public RelayCommand<Panel> NextCmd => new(Next);
|
||||
/// <summary>
|
||||
/// 下一步
|
||||
/// </summary>
|
||||
public RelayCommand<Panel> NextCmd => new(Next);
|
||||
|
||||
/// <summary>
|
||||
/// 上一步
|
||||
/// </summary>
|
||||
public RelayCommand<Panel> PrevCmd => new(Prev);
|
||||
/// <summary>
|
||||
/// 上一步
|
||||
/// </summary>
|
||||
public RelayCommand<Panel> PrevCmd => new(Prev);
|
||||
|
||||
private void Next(Panel panel)
|
||||
private void Next(Panel panel)
|
||||
{
|
||||
foreach (var stepBar in panel.Children.OfType<StepBar>())
|
||||
{
|
||||
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();
|
||||
}
|
||||
stepBar.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Prev(Panel panel)
|
||||
{
|
||||
foreach (var stepBar in panel.Children.OfType<StepBar>())
|
||||
{
|
||||
stepBar.Prev();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,24 +5,23 @@ using HandyControl.Data;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class TabControlDemoViewModel : DemoViewModelBase<TabControlDemoModel>
|
||||
{
|
||||
public class TabControlDemoViewModel : DemoViewModelBase<TabControlDemoModel>
|
||||
public TabControlDemoViewModel(DataService dataService) => DataList = dataService.GetTabControlDemoDataList();
|
||||
|
||||
public RelayCommand<CancelRoutedEventArgs> ClosingCmd => new(Closing);
|
||||
|
||||
private void Closing(CancelRoutedEventArgs args)
|
||||
{
|
||||
public TabControlDemoViewModel(DataService dataService) => DataList = dataService.GetTabControlDemoDataList();
|
||||
|
||||
public RelayCommand<CancelRoutedEventArgs> ClosingCmd => new(Closing);
|
||||
|
||||
private void Closing(CancelRoutedEventArgs args)
|
||||
{
|
||||
Growl.Info($"{(args.OriginalSource as TabItem)?.Header} Closing");
|
||||
}
|
||||
|
||||
public RelayCommand<RoutedEventArgs> ClosedCmd => new(Closed);
|
||||
|
||||
private void Closed(RoutedEventArgs args)
|
||||
{
|
||||
Growl.Info($"{(args.OriginalSource as TabItem)?.Header} Closed");
|
||||
}
|
||||
Growl.Info($"{(args.OriginalSource as TabItem)?.Header} Closing");
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand<RoutedEventArgs> ClosedCmd => new(Closed);
|
||||
|
||||
private void Closed(RoutedEventArgs args)
|
||||
{
|
||||
Growl.Info($"{(args.OriginalSource as TabItem)?.Header} Closed");
|
||||
}
|
||||
}
|
||||
@@ -6,43 +6,42 @@ using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Properties.Langs;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class TagDemoViewModel : ViewModelBase
|
||||
{
|
||||
public class TagDemoViewModel : ViewModelBase
|
||||
public TagDemoViewModel(DataService dataService)
|
||||
{
|
||||
public TagDemoViewModel(DataService dataService)
|
||||
{
|
||||
DataList = new ObservableCollection<DemoDataModel>(dataService.GetDemoDataList(10));
|
||||
}
|
||||
DataList = new ObservableCollection<DemoDataModel>(dataService.GetDemoDataList(10));
|
||||
}
|
||||
|
||||
public ObservableCollection<DemoDataModel> DataList { get; set; }
|
||||
public ObservableCollection<DemoDataModel> DataList { get; set; }
|
||||
|
||||
private string _tagName;
|
||||
private string _tagName;
|
||||
|
||||
public string TagName
|
||||
{
|
||||
get => _tagName;
|
||||
public string TagName
|
||||
{
|
||||
get => _tagName;
|
||||
#if NET40
|
||||
set => Set(nameof(TagName), ref _tagName, value);
|
||||
set => Set(nameof(TagName), ref _tagName, value);
|
||||
#else
|
||||
set => Set(ref _tagName, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
public RelayCommand AddItemCmd => new(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(TagName))
|
||||
{
|
||||
Growl.Warning(Lang.PlsEnterContent);
|
||||
return;
|
||||
}
|
||||
|
||||
public RelayCommand AddItemCmd => new(() =>
|
||||
DataList.Insert(0, new DemoDataModel
|
||||
{
|
||||
if (string.IsNullOrEmpty(TagName))
|
||||
{
|
||||
Growl.Warning(Lang.PlsEnterContent);
|
||||
return;
|
||||
}
|
||||
|
||||
DataList.Insert(0, new DemoDataModel
|
||||
{
|
||||
IsSelected = DataList.Count % 2 == 0,
|
||||
Name = TagName
|
||||
});
|
||||
TagName = string.Empty;
|
||||
IsSelected = DataList.Count % 2 == 0,
|
||||
Name = TagName
|
||||
});
|
||||
}
|
||||
}
|
||||
TagName = string.Empty;
|
||||
});
|
||||
}
|
||||
@@ -2,19 +2,18 @@
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControlDemo.Tools;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class WindowDemoViewModel
|
||||
{
|
||||
public RelayCommand<string> OpenWindowCmd => new(OpenWindow);
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
private void OpenWindow(string windowTag)
|
||||
public class WindowDemoViewModel
|
||||
{
|
||||
public RelayCommand<string> OpenWindowCmd => new(OpenWindow);
|
||||
|
||||
private void OpenWindow(string windowTag)
|
||||
{
|
||||
if (AssemblyHelper.CreateInternalInstance($"Window.{windowTag}") is System.Windows.Window window)
|
||||
{
|
||||
if (AssemblyHelper.CreateInternalInstance($"Window.{windowTag}") is System.Windows.Window window)
|
||||
{
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.ShowDialog();
|
||||
}
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user