protected virtual void OnErrorsChanged(DataErrorsChangedEventArgs e)
 {
     EventHandler<DataErrorsChangedEventArgs> handler = ErrorsChanged;
     if (handler != null) {
         handler(this, e);
     }
 }
 protected virtual void OnErrorsChanged( DataErrorsChangedEventArgs e )
 {
     if( ErrorsChanged != null )
     {
         ErrorsChanged( this, e );
     }
 }
 private void MetadataProviderErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     EventHandler handler = CanExecuteChanged;
     if (handler != null)
     {
         handler(this, new EventArgs());
     }
 }
Beispiel #4
0
 protected virtual void OnErrorsChanged(DataErrorsChangedEventArgs args)
 {
     var handler = ErrorsChanged;
     if (handler != null)
     {
         handler(this, args);
     }
 }
 private void sourceObject_ErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     var errors = _sourceObject.GetErrors(_sourceProperty) as IEnumerable<string>;
     if (errors != null && errors.Any())
     {
         _target.Error = errors.First();
     }
     else if (!string.IsNullOrEmpty(_target.Error))
     {
         _target.Error = null;
     }
 }
 private void ErrorsChangedCallback(object sender, DataErrorsChangedEventArgs args)
 {
     if (this.weakErrorsChangedListener == null)
     {
         return;
     }
     IErrorsChangedListener target = this.weakErrorsChangedListener.Target as IErrorsChangedListener;
     if (target == null)
     {
         this.Disconnect();
         return;
     }
     target.OnErrorsChanged(sender, this.notifyChild, args);
 }
 protected virtual void OnErrorsChanged(DataErrorsChangedEventArgs e)
 {
     this.ErrorsChanged?.Invoke(this, e);
 }
        /// <summary>
        /// Handles the asynchronous INDEI errors that occur while the DataGrid is in editing mode.
        /// </summary>
        /// <param name="sender">INDEI item whose errors changed.</param>
        /// <param name="e">Error event arguments.</param>
        private void ValidationItem_ErrorsChanged(object sender, DataErrorsChangedEventArgs e)
        {
            INotifyDataErrorInfo indei = sender as INotifyDataErrorInfo;
            if (this._validationItems.ContainsKey(indei))
            {
                Debug.Assert(this.EditingRow != null);

                // Determine the binding path.
                string bindingPath = this._validationItems[indei];
                if (string.IsNullOrEmpty(bindingPath))
                {
                    bindingPath = e.PropertyName;
                }
                else if (!string.IsNullOrEmpty(e.PropertyName) && e.PropertyName.IndexOf(TypeHelper.LeftIndexerToken) >= 0)
                {
                    bindingPath += TypeHelper.RemoveDefaultMemberName(e.PropertyName);
                }
                else
                {
                    bindingPath += TypeHelper.PropertyNameSeparator + e.PropertyName;
                }

                // Remove the old errors.
                List<ValidationResult> validationResults = new List<ValidationResult>();
                foreach (ValidationResult validationResult in this._validationResults)
                {
                    ValidationResult oldValidationResult = this._indeiValidationResults.FindEqualValidationResult(validationResult);
                    if (oldValidationResult != null && oldValidationResult.ContainsMemberName(bindingPath))
                    {
                        this._indeiValidationResults.Remove(oldValidationResult);
                    }
                    else
                    {
                        validationResults.Add(validationResult);
                    }
                }

                // Find any new errors and update the visuals.
                this.ValidateIndei(indei, e.PropertyName, bindingPath, null, validationResults, false /*wireEvents*/);
                this.UpdateValidationResults(validationResults, false /*scrollIntoView*/);
                
                // If we're valid now then reset our status.
                if (this.IsValid)
                {
                    this.ResetValidationStatus();
                }
            }
            else if (indei != null)
            {
                indei.ErrorsChanged -= new EventHandler<DataErrorsChangedEventArgs>(ValidationItem_ErrorsChanged);
            }
        }
 private void _model_ErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     if (ErrorsChanged != null)
         ErrorsChanged(sender, e);
 }
Beispiel #10
0
		void NotifyErrorsChanged (object o, DataErrorsChangedEventArgs e)
		{
			string property = "";
			if (PropertyPathWalker.FinalNode.PropertyInfo != null)
				property = PropertyPathWalker.FinalNode.PropertyInfo.Name;
			Console.WriteLine ("Errors changed on: {0} / {1}", property, e.PropertyName);
			if (e.PropertyName == property) {
				var errors = CurrentNotifyError.GetErrors (property);
				if (errors != null) {
					var errorList = CurrentNotifyError.GetErrors (property).Cast <object> ().ToArray ();
					if (errorList.Length > 0) {
						foreach (var v in errorList) {
							MaybeEmitError (v, v as Exception);
						}
					} else {
						MaybeEmitError (null, null);
					}
				} else {
					MaybeEmitError (null, null);
				}
			}
		}
 private void OnErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     // Notify the UI that the property has changed so that the validation error gets displayed (or removed).
     RaisePropertyChanged(e.PropertyName);
 }
Beispiel #12
0
 void IErrorsChangedListener.OnErrorsChanged(object sender, bool notifyChild, DataErrorsChangedEventArgs e)
 {
     if (notifyChild)
     {
         this.NotifyChildDataErrorInfo_ErrorsChanged(sender, e);
         return;
     }
     this.NotifyDataErrorInfo_ErrorsChanged(sender, e);
 }
 private void Vm_ErrorsChanged(object sender, System.ComponentModel.DataErrorsChangedEventArgs e)
 {
     Erori = new ObservableCollection <string>(Osoba.Errors.Errors.Values.SelectMany(x => x).ToList());
 }
 void OnErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     if (e.PropertyName == SourcePropertyName)
     {
         _host.OnDataErrorsChanged((INotifyDataErrorInfo)sender, e.PropertyName);
     }
 }
        private void OnErrorsChanged(DataErrorsChangedEventArgs e)
        {
            var handler = this.ErrorsChanged;

            if (handler != null)
                handler(this, e);
        }
 protected void OnErrorsChanged(DataErrorsChangedEventArgs e)
 {
     var handler = ErrorsChanged;
     if (handler != null) handler(this, e);
 }
Beispiel #17
0
 private void NotifyChildDataErrorInfo_ErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     if (string.IsNullOrEmpty(e.PropertyName))
     {
         this.NotifyOldDataErrorInfos(true);
         if (this.listener != null)
         {
             INotifyDataErrorInfo leafValue = this.listener.LeafValue as INotifyDataErrorInfo;
             if (leafValue != null)
             {
                 this.NotifyNewDataErrorInfos(string.Empty, leafValue, true);
             }
         }
     }
 }
Beispiel #18
0
 public void RaiseErrorsChanged(string propertyName)
 {
     EventHandler<DataErrorsChangedEventArgs> handler = ErrorsChanged;
     if (handler == null) return;
     var arg = new DataErrorsChangedEventArgs(propertyName);
     handler.Invoke(this, arg);
 }
Beispiel #19
0
		public void RaiseErrorsChanged(DataErrorsChangedEventArgs args)
		{
			if (ErrorsChanged != null)
			{
				ErrorsChanged(this, args);
			}
		}
Beispiel #20
0
        /// <summary>
        /// Called when the errors on the model have changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.ComponentModel.DataErrorsChangedEventArgs"/> instance containing the event data.</param>
        private void OnModelErrorsChanged(object sender, DataErrorsChangedEventArgs e)
        {
            var notifyDataErrorInfo = ((INotifyDataErrorInfo)_model);
            var errors = notifyDataErrorInfo.GetErrors(e.PropertyName);

            if (string.IsNullOrEmpty(e.PropertyName))
            {
                HandleBusinessRuleErrors(errors);
            }
            else
            {
                HandleFieldErrors(e.PropertyName, errors);
            }

            Updated.SafeInvoke(this);
        }
 private void OnErrorsChanged(object sender, DataErrorsChangedEventArgs e) {
     AllErrors = new ReadOnlyCollection<string>(SelectedPersonVM.GetAllErrors().Values.SelectMany(c => c).ToList());
 }
Beispiel #22
0
 private void RaiseCanExecuteChanged(object sender, DataErrorsChangedEventArgs dataErrorsChangedEventArgs)
 {
     SaveCommand.RaiseCanExecuteChanged();
 }
Beispiel #23
0
 /// <summary>
 /// Raises the <see cref="ErrorsChanged"/> event.
 /// </summary>
 /// <param name="e">The argument for the event.</param>
 protected virtual void OnErrorsChanged(DataErrorsChangedEventArgs e)
 {
     var handler = this.ErrorsChanged;
     if (handler != null)
     {
         handler(this, e);
     }
 }
        //
        //  Private Methods
        //

        // event handler for ErrorsChanged event
        private void OnErrorsChanged(object sender, DataErrorsChangedEventArgs args)
        {
            DeliverEvent(sender, args);
        }
Beispiel #25
0
 private void NotifyDataErrorInfo_ErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     if (this.listener != null && this.listener.FullPathExists)
     {
         string empty = string.Empty;
         INotifyDataErrorInfo leafItem = this.listener.LeafItem as INotifyDataErrorInfo;
         if (leafItem != null)
         {
             empty = this.listener.LeafPropertyName;
         }
         if (string.CompareOrdinal(empty, e.PropertyName) == 0 || (e.PropertyName == null && empty == string.Empty))
         {
             this.NotifyOldDataErrorInfos(false);
             this.NotifyNewDataErrorInfos(empty, leafItem, false);
         }
     }
 }
Beispiel #26
0
 private void Vm_ErrorsChanged(object sender, System.ComponentModel.DataErrorsChangedEventArgs e)
 {
     //event koji ce se pozvati kad dodje do neispravne validacije
     //daj sve greske i pretvori ih u listu stringova da se mogu ispisati
     Erori = new ObservableCollection <string>(Kupac.Errors.Errors.Values.SelectMany(x => x).ToList());
 }
 void Receipt_ErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     RaisePropertyChanged("IsSaveEnabled");
 }
 void OnErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     // if notification was on the right thread, just do the work (normal case)
     if (Dispatcher.Thread == Thread.CurrentThread)
     {
         UpdateNotifyDataErrors(DependencyProperty.UnsetValue);
     }
     else if (!IsDataErrorsChangedPending)
     {
         // otherwise invoke an operation to do the work on the right context
         IsDataErrorsChangedPending = true;
         Engine.Marshal(
             (arg) => {  UpdateNotifyDataErrors(DependencyProperty.UnsetValue);
                          return null; }, null);
     }
 }
 protected void OnDataErrorsChanged(DataErrorsChangedEventArgs e)
 {
     if (ErrorsChanged != null)
     { ErrorsChanged(_dataObject, e); }
 }
Beispiel #30
0
 void OnErrorsChanged(object sender, DataErrorsChangedEventArgs e)
 {
     SubmitCommand.RaiseCanExecuteChanged();
 }
Beispiel #31
0
        //
        //  Private Methods
        //

        // event handler for ErrorsChanged event
        private void OnErrorsChanged(object sender, DataErrorsChangedEventArgs args)
        {
            DeliverEvent(sender, args);
        }
        void OpenItem_Errors(object sender, DataErrorsChangedEventArgs e)
        {
            OpenItemSearch openItem;

            openItem = sender as OpenItemSearch;

            if (openItem != null)
            {
                if (openItem.HasErrors)
                {
                    AddErrorMessage(e.PropertyName + openItem.OpenItemID.ToString(), openItem.GetErrorMessage(e.PropertyName).FirstOrDefault());
                }
                else
                {
                    RemoveErrorMessage(e.PropertyName + openItem.OpenItemID.ToString());
                }
            }
        }
 public void DataErrorsChangedEventArgs_Test()
 {
     var propertyName = "abc";
     var target = new DataErrorsChangedEventArgs(propertyName);
     Assert.AreEqual(propertyName, target.PropertyName);
 }