本文整理汇总了C#中ReactiveProperty.SetValidateNotifyError方法的典型用法代码示例。如果您正苦于以下问题:C# ReactiveProperty.SetValidateNotifyError方法的具体用法?C# ReactiveProperty.SetValidateNotifyError怎么用?C# ReactiveProperty.SetValidateNotifyError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReactiveProperty
的用法示例。
在下文中一共展示了ReactiveProperty.SetValidateNotifyError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SettingsPageViewModel
public SettingsPageViewModel(PageManager pageManager, IReactiveFolderSettings settings)
: base(pageManager)
{
Settings = settings;
ReactionCheckInterval = new ReactiveProperty<string>(settings.DefaultMonitorIntervalSeconds.ToString());
ReactionCheckInterval.Subscribe(x =>
{
settings.DefaultMonitorIntervalSeconds = int.Parse(x);
settings.Save();
});
ReactionCheckInterval.SetValidateNotifyError(x =>
{
int temp;
if (false == int.TryParse(x, out temp))
{
return "Number Only";
}
return null;
});
}
示例2: ReactionViewModel
// Reactionmodelを受け取ってVMを生成する
public ReactionViewModel(FolderReactionModel reaction, PageManager pageManager, IAppPolicyManager appPolicyManager)
{
_CompositeDisposable = new CompositeDisposable();
Reaction = reaction;
PageManager = pageManager;
_AppPolicyManager = appPolicyManager;
IsReactionValid = Reaction.ObserveProperty(x => x.IsValid)
.ToReactiveProperty()
.AddTo(_CompositeDisposable);
ReactionWorkName = Reaction.ToReactivePropertyAsSynchronized(x => x.Name)
.AddTo(_CompositeDisposable);
WorkFolderEditVM = new WorkFolderEditViewModel(PageManager, Reaction);
FilterEditVM = new FilterEditViewModel(PageManager, Reaction);
ActionsEditVM = new ActionsEditViewModel(Reaction, PageManager, _AppPolicyManager);
DestinationEditVM = new DestinationEditViewModel(PageManager, Reaction);
EditVMList = new List<ReactionEditViewModelBase>()
{
WorkFolderEditVM,
FilterEditVM,
ActionsEditVM,
DestinationEditVM
};
IsEnable = Reaction.ToReactivePropertyAsSynchronized(x => x.IsEnable)
.AddTo(_CompositeDisposable);
// [email protected] http://stackoverflow.com/questions/1833830/timespan-parse-time-format-hhmmss
// https://msdn.microsoft.com/en-us/library/ee372286.aspx
MonitorIntervalSeconds = Reaction.ToReactivePropertyAsSynchronized(
x => x.CheckInterval
, convert: (timespan) => ((int)timespan.TotalSeconds).ToString()
, convertBack: (seconds) => TimeSpan.FromSeconds(int.Parse(seconds))
, ignoreValidationErrorValue: true
)
.AddTo(_CompositeDisposable);
MonitorIntervalSeconds.SetValidateNotifyError(text =>
{
int temp;
if (false == int.TryParse(text, out temp))
{
return "Number Only";
}
return null;
});
}