delete lazy code in viewmodels
This commit is contained in:
1 parent
066cedeb73
commit
700f54ab2b
23 files changed
+141
-214
No files matched your search
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
@@ -23,94 +22,79 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
#region Window
|
||||
|
||||
public RelayCommand InfoCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Info(Properties.Langs.Lang.GrowlInfo, _token))).Value;
|
||||
public RelayCommand InfoCmd => new(() => Growl.Info(Properties.Langs.Lang.GrowlInfo, _token));
|
||||
|
||||
public RelayCommand SuccessCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Success(Properties.Langs.Lang.GrowlSuccess, _token))).Value;
|
||||
public RelayCommand SuccessCmd => new(() => Growl.Success(Properties.Langs.Lang.GrowlSuccess, _token));
|
||||
|
||||
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;
|
||||
},
|
||||
Token = _token
|
||||
}))).Value;
|
||||
|
||||
public RelayCommand ErrorCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Error(Properties.Langs.Lang.GrowlError, _token))).Value;
|
||||
|
||||
public RelayCommand AskCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => 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))).Value;
|
||||
},
|
||||
Token = _token
|
||||
}));
|
||||
|
||||
public RelayCommand FatalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Fatal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false,
|
||||
Token = _token
|
||||
}))).Value;
|
||||
public RelayCommand ErrorCmd => new(() => Growl.Error(Properties.Langs.Lang.GrowlError, _token));
|
||||
|
||||
public RelayCommand ClearCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Clear(_token))).Value;
|
||||
public RelayCommand AskCmd => new(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
|
||||
{
|
||||
Growl.Info(isConfirmed.ToString());
|
||||
return true;
|
||||
}, _token));
|
||||
|
||||
public RelayCommand FatalCmd => new(() => Growl.Fatal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false,
|
||||
Token = _token
|
||||
}));
|
||||
|
||||
public RelayCommand ClearCmd => new(() => Growl.Clear(_token));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Desktop
|
||||
|
||||
public RelayCommand InfoGlobalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.InfoGlobal(Properties.Langs.Lang.GrowlInfo))).Value;
|
||||
public RelayCommand InfoGlobalCmd => new(() => Growl.InfoGlobal(Properties.Langs.Lang.GrowlInfo));
|
||||
|
||||
public RelayCommand SuccessGlobalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.SuccessGlobal(Properties.Langs.Lang.GrowlSuccess))).Value;
|
||||
public RelayCommand SuccessGlobalCmd => new(() => Growl.SuccessGlobal(Properties.Langs.Lang.GrowlSuccess));
|
||||
|
||||
public RelayCommand WarningGlobalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.WarningGlobal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlWarning,
|
||||
CancelStr = Properties.Langs.Lang.Ignore,
|
||||
ActionBeforeClose = isConfirmed =>
|
||||
{
|
||||
Growl.InfoGlobal(isConfirmed.ToString());
|
||||
return true;
|
||||
}
|
||||
}))).Value;
|
||||
|
||||
public RelayCommand ErrorGlobalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.ErrorGlobal(Properties.Langs.Lang.GrowlError))).Value;
|
||||
|
||||
public RelayCommand AskGlobalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => 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;
|
||||
}))).Value;
|
||||
}
|
||||
}));
|
||||
|
||||
public RelayCommand FatalGlobalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.FatalGlobal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false
|
||||
}))).Value;
|
||||
public RelayCommand ErrorGlobalCmd => new(() => Growl.ErrorGlobal(Properties.Langs.Lang.GrowlError));
|
||||
|
||||
public RelayCommand ClearGlobalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(Growl.ClearGlobal)).Value;
|
||||
public RelayCommand AskGlobalCmd => new(() => Growl.AskGlobal(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
|
||||
{
|
||||
Growl.InfoGlobal(isConfirmed.ToString());
|
||||
return true;
|
||||
}));
|
||||
|
||||
public RelayCommand FatalGlobalCmd => new(() => Growl.FatalGlobal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false
|
||||
}));
|
||||
|
||||
public RelayCommand ClearGlobalCmd => new(Growl.ClearGlobal);
|
||||
|
||||
#endregion
|
||||
|
||||
public RelayCommand NewWindowCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => new GrowlDemoWindow
|
||||
{
|
||||
Owner = Application.Current.MainWindow
|
||||
}.Show())).Value;
|
||||
public RelayCommand NewWindowCmd => new(() => new GrowlDemoWindow
|
||||
{
|
||||
Owner = Application.Current.MainWindow
|
||||
}.Show());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user