コード例 #1
0
        public override void Validate()
        {
            var games = Directory.GetDirectories(System.IO.Path.Join(DirPath, "Games"));

            foreach (var gamePath in games)
            {
                var validator = new GameValidator(gamePath);
                Validators.Add(validator);
            }

            var valid = Validators.All(v => v.Status == ValidationStatus.Pass);

            Messages.Add(valid
                ? "Games validated successfully."
                : "Games not validated successfully. Some or all of your games may not work.");

            Status = valid ? ValidationStatus.Pass : ValidationStatus.Warn;
        }
コード例 #2
0
        /// <summary>
        /// Set value to the property of the bounded entity
        /// </summary>
        /// <param name="value">New value</param>
        protected virtual void BindValueToProperty(TResult value)
        {
            if (InternalSet)
            {
                return;
            }

            var entity = _entity();

            //                      if validators will permit
            if (entity != null && (Validators?.All(v => v.IsValid(value)) ?? true))
            {
                ReflexionEx.SetPropertyValue(entity, value, _result);

                if (OnChanged != null)
                {
                    var property = ReflexionEx.GetPropertyInfo(_result);
                    var args     = new BinderValueChangedArgs <TResult>(value, property.Name);
                    OnChanged?.Invoke(this, args);
                }
            }
        }