private void FlagManager_ItemCreated(object sender, JryFlag e) { lock (this.journals) { this.journals.Add(new FlagCreatedJournal(e.Type, e.Value)); } }
public void InitializeEditor(JryFlag flag) { this.OriginFlag = flag; this.EditFlagUserControl.FlagType = flag.Type; this.EditFlagUserControl.ViewModel.ModifyMode(flag); this.EditFlagUserControl.ViewModel.Updated += (z, x) => this.GetUIDispatcher().BeginInvoke(() => this.DialogResult = true); this.TitleTextBlock.Text = string.Format( Properties.Resources.FlagEditorWindow_Title_Format, flag.Type.GetLocalizeString()); this.OriginValueTextBlock.Text = flag.Value; }
public void InitializeEditor(JryFlag flag) { this.OriginFlag = flag; this.EditFlagUserControl.ViewModel.FlagType = flag.Type; this.EditFlagUserControl.ViewModel.ModifyMode(flag); this.EditFlagUserControl.ViewModel.Updated += (z, x) => this.GetUIDispatcher().BeginInvoke(() => this.DialogResult = true); this.TitleTextBlock.Text = string.Format( Properties.Resources.FlagEditorWindow_Title_Format, flag.Type.GetLocalizeString()); this.OriginValueTextBlock.Text = flag.Value; }
/// <summary> /// 当在派生类中重写时,对值执行验证检查。 /// </summary> /// <returns> /// <see cref="T:System.Windows.Controls.ValidationResult"/> 对象。 /// </returns> /// <param name="value">要检查的来自绑定目标的值。</param><param name="cultureInfo">要在此规则中使用的区域性。</param> public override ValidationResult Validate(object value, CultureInfo cultureInfo) { var text = value as string; if (text == null) { return(new ValidationResult(false, "please input value.")); } if (JryFlag.IsValueInvalid(text)) { return(new ValidationResult(false, "can not be empty.")); } return(ValidationResult.ValidResult); }
public override async Task FixAsync(DataCenter dataCenter) { switch (this.Type) { case ErrorType.FlagCount: var flag = await dataCenter.FlagManager.FindAsync(JryFlag.BuildFlagId(this.type, this.value)); if (flag != null) { flag.Count = this.count; await dataCenter.FlagManager.UpdateAsync(flag); } else { Debug.Assert(false); } break; default: throw new ArgumentOutOfRangeException(); } }
private async Task BuildFlagAsync() { await this.dataCenter.FlagManager.Source.CursorAsync(z => { var type = (int)z.Type; var dest = this.flagRefs.GetOrCreateValue(type); if (string.IsNullOrEmpty(z.Value) || z.Id != JryFlag.BuildFlagId(z.Type, z.Value)) { if (Debugger.IsAttached) { Debugger.Break(); } Debug.Assert(false); } dest.Add(z.Value, z.Count); }); foreach (var dictPair in this.flagRefs) { var d = new Dictionary <string, int>(dictPair.Value.Count); d.AddRange(dictPair.Value.ToList()); this.originFlagRefs[dictPair.Key] = d; } }
public Task<bool> UpgradeAsync(JryFlag item) => TrueTask;
public FlagEditableViewModel(JryFlag source) : base(source) { }