private void Source_StatusChanged(object sender, ChangeEventArgs e) { if (StatusChanged != null && Listen) { Sources[sender as IChangeSource] = e.Status; ValueStatus status = ValueStatus.Clean; foreach (ValueStatus each in Sources.Values) { if (each == ValueStatus.Dirty) { status = ValueStatus.Dirty; break; } } if (CurrentStatus != status) StatusChanged(this, new ChangeEventArgs(status)); CurrentStatus = status; } }
/// <summary> /// 當資料有被變更異動時發生(需配合 WatchChange 方法)。 /// </summary> /// <param name="e"></param> protected virtual void OnDirtyStatusChanged(ChangeEventArgs e) { SaveButtonVisible = (e.Status == ValueStatus.Dirty); CancelButtonVisible = (e.Status == ValueStatus.Dirty); }