Ejemplo n.º 1
0
        public void RegisterForBeingWatched(IValueChangeWatcher watcher, ICommand command)
        {
            this.RequestCommentsCommand = command;
            // in the beginning we memorize the original values so that we can use the original values to detemine whether the value was changed later
            this.OriginalEditedValue = this.EditedValue;
            this.OriginalComment     = this.Comment;

            this.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "EditedValue")
                {
                    this.RaisePropertyChanged("IsModified");
                    if (this.EditedValue == this.OriginalEditedValue)
                    {
                        return;
                    }
                    watcher.GetNotifiedAboutChangedValue(this);
                }
                else if (e.PropertyName == "Comment")
                {
                    if (this.OriginalComment == this.Comment)
                    {
                        return;
                    }
                    watcher.GetNotifiedAboutChangedValue(this);
                }
            };
        }
Ejemplo n.º 2
0
 public RegisterResidentsForValueChangeWatch_IGlobeResidentResolver(IValueChangeWatcher watcher)
 {
     this.watcher = watcher;
 }