예제 #1
0
 private void FlagManager_ItemCreated(object sender, JryFlag e)
 {
     lock (this.journals)
     {
         this.journals.Add(new FlagCreatedJournal(e.Type, e.Value));
     }
 }
예제 #2
0
 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;
        }
예제 #4
0
        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;
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
            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();
                }
            }
예제 #7
0
        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;
            }
        }
예제 #8
0
 public Task<bool> UpgradeAsync(JryFlag item) => TrueTask;
예제 #9
0
 public FlagEditableViewModel(JryFlag source)
     : base(source)
 {
 }
예제 #10
0
 public FlagEditableViewModel(JryFlag source)
     : base(source)
 {
 }