public override int GetHashCode() { unchecked { int hashCode = (Value != null ? Value.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Label != null ? Label.GetHashCode() : 0); hashCode = (hashCode * 397) ^ LabelColor.GetHashCode(); hashCode = (hashCode * 397) ^ CanEdit.GetHashCode(); hashCode = (hashCode * 397) ^ CanDelete.GetHashCode(); hashCode = (hashCode * 397) ^ Highlight.GetHashCode(); return(hashCode); } }
public bool Equals(ToolbarEntry other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(String.Equals(Value, other.Value) && String.Equals(Label, other.Label) && LabelColor.Equals(other.LabelColor) && CanEdit.Equals(other.CanEdit) && CanDelete.Equals(other.CanDelete) && Highlight.Equals(other.Highlight)); }
internal MainWindowViewModel(AppController controller) { this._controller = controller ?? throw new ArgumentNullException(nameof(controller)); Profiles = _controller.Profiles .ToReadOnlyReactiveCollection(x => new ProfileItemViewModel(_controller, x)) .AddTo(this.Subscription); Profiles .ObserveElementObservableProperty(x => x.Position) .Throttle(TimeSpan.FromMilliseconds(10)) .ObserveOn(SynchronizationContext.Current) .Subscribe(_ => ProfilesView.Refresh()) // ListCollectionView.Refresh method seems not thread-safe. .AddTo(this.Subscription); OrganizesPriority = new ReactiveProperty <bool>() .AddTo(this.Subscription); ShowsAvailable = Settings.Current.ToReactivePropertyAsSynchronized(x => x.ShowsAvailable) .AddTo(this.Subscription); ShowsAvailable .Subscribe(_ => ManageFilter()) .AddTo(this.Subscription); IsUpdating = _controller.IsUpdating .Where(_ => !_controller.IsWorking.Value) //.Select(x => Observable.Empty<bool>() // .Delay(TimeSpan.FromMilliseconds(10)) // .StartWith(x)) //.Concat() .ObserveOnUIDispatcher() .ToReadOnlyReactiveProperty() .AddTo(this.Subscription); #region Work var isNotWorking = _controller.IsWorking .Inverse() .StartWith(true) // This is necessary to start combined sequence. .Publish(); var selectedProfile = Profiles .ObserveElementObservableProperty(x => x.IsSelected) .Where(x => x.Value) .Select(x => x.Instance) .Publish(); var canProfileMovedUp = selectedProfile .Select(x => x.Position.Value > 0); MoveUpCommand = new[] { isNotWorking, canProfileMovedUp } .CombineLatestValuesAreAllTrue() .ObserveOnUIDispatcher() // This is for thread access by ReactiveCommand. .ToReactiveCommand(); MoveUpCommand .Subscribe(async _ => await _controller.MoveUpProfileAsync()) .AddTo(this.Subscription); var canProfileMovedDown = selectedProfile .Select(x => x.Position.Value < x.PositionCount.Value - 1); MoveDownCommand = new[] { isNotWorking, canProfileMovedDown } .CombineLatestValuesAreAllTrue() .ObserveOnUIDispatcher() // This is for thread access by ReactiveCommand. .ToReactiveCommand(); MoveDownCommand .Subscribe(async _ => await _controller.MoveDownProfileAsync()) .AddTo(this.Subscription); var canProfileDeleted = selectedProfile .Select(x => x.IsConnected) .Switch() .Inverse(); CanDelete = new[] { isNotWorking, canProfileDeleted } .CombineLatestValuesAreAllTrue() .ObserveOnUIDispatcher() // This is for thread access by ReactiveCommand. .ToReadOnlyReactiveProperty() .AddTo(this.Subscription); DeleteCommand = CanDelete .ToReactiveCommand(); DeleteCommand .Subscribe(async _ => await _controller.DeleteProfileAsync()) .AddTo(this.Subscription); isNotWorking.Connect().AddTo(this.Subscription); selectedProfile.Connect().AddTo(this.Subscription); #endregion }
public override string ToString() { return("PermissionId = " + PermissionId.ToString() + ",RoleId = " + RoleId.ToString() + ",PageId = " + PageId.ToString() + ",CanCreate = " + CanCreate.ToString() + ",CanDelete = " + CanDelete.ToString() + ",CanUpdate = " + CanUpdate.ToString() + ",CanSelect = " + CanSelect.ToString() + ",AssignedBy = " + AssignedBy.ToString() + ",CompanyId = " + CompanyId.ToString()); }