public CollectionEditor() : base() { Uri resourceLocater = new Uri("/UtilityWpf.View;component/Themes/CollectionEditor.xaml", System.UriKind.Relative); ResourceDictionary resourceDictionary = (ResourceDictionary)Application.LoadComponent(resourceLocater); Style = resourceDictionary["CollectionEditorStyle"] as Style; //DeletedSubject.OnNext(new object()); //NewItemS //Observable.FromEventPattern<EventHandler, EventArgs>(_ => this.Initialized += _, _ => this.Initialized -= _) // .CombineLatest(NewItemsSubject, (a, b) => b) // .CombineLatest(KeySubject, (item, key) => new { item, key }) // .Subscribe(_ => React(_.item, _.key)); var obs = ItemsSourceSubject.Where(_ => _ != null) .Take(1) .Select(_ => (_.First())) .Concat(SelectedItemSubject) .DistinctUntilChanged(); InputSubject.WithLatestFrom(obs, (input, item) => new { input, item }) .Subscribe(_ => { switch (_.input) { case (DatabaseCommand.Delete): DeletedSubject.OnNext(_.item); break; case (DatabaseCommand.Update): break; case (DatabaseCommand.Clear): ClearedSubject.OnNext(null); break; } }); Action <DatabaseCommand> av = (a) => this.Dispatcher.InvokeAsync(() => InputSubject.OnNext(a), System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken)); var items = ButtonDefinitionHelper.GetCommandOutput <DatabaseCommand>(typeof(DatabaseCommand)) ?.Select(meas => new ViewModel.ButtonDefinition { Command = new RelayCommand(() => av(meas.Value())), Content = meas.Key }); if (items == null) { Console.WriteLine("measurements-service equals null in collectionviewmodel"); } else { this.Dispatcher.InvokeAsync(() => Buttons = items.ToList(), System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken)); } }
protected void HandleConflictResolutionResult(IConflictResolutionResult <TThreadsafe> result) { switch (result) { case DeleteResult <TThreadsafe> d: DeletedSubject.OnNext(d.Id); return; case CreateResult <TThreadsafe> c: CreatedSubject.OnNext(c.Entity); return; case UpdateResult <TThreadsafe> u: UpdatedSubject.OnNext(new EntityUpdate <TThreadsafe>(u.OriginalId, u.Entity)); return; } }
public void OnTimeEntrySoftDeleted(IThreadSafeTimeEntry timeEntry) { DeletedSubject.OnNext(timeEntry.Id); }
public IObservable <Unit> SoftDelete(IThreadSafeTimeEntry timeEntry) => Observable.Return(timeEntry) .Select(TimeEntry.DirtyDeleted) .SelectMany(Repository.Update) .Do(entity => DeletedSubject.OnNext(entity.Id)) .Select(_ => Unit.Default);
public override IObservable <Unit> Delete(long id) => base.Delete(id) .Do(_ => DeletedSubject.OnNext(id));