private IObservable <ListStructItemModel> ExecuteEdit( byte[] key, RedisTargetInfo targetInfo, ListStructItemModel listItem) { var editedListItem = new ListStructItemModel { Index = listItem.Index, Value = listItem.Value, IsChecked = listItem.IsChecked, IsEnabled = listItem.IsEnabled, CheckAction = listItem.CheckAction, EditAction = listItem.EditAction }; return(_dialogManager.Open(EditorDialogModel.UpdateListItem( listItem.Index, listItem.Value, target => { return _clientAccessor.With(targetInfo, client => { var isValueEmpty = string.IsNullOrEmpty(target.Value); if (!isValueEmpty) { client.LSet(ustring.Make(key).ToString(), listItem.Index, target.Value); editedListItem.Value = target.Value; } return new EditorResult { ValueError = isValueEmpty ? "Value is empty" : null, Action = target.Action }; }); })) .Select(wasEdited => wasEdited ? editedListItem : null)); }
private void EditItem(ListStructItemModel item) { if (item.IsEditing) { return; } item.IsEditing = true; _model.EditCommand.Execute(item) .SubscribeOn(RxApp.TaskpoolScheduler) .ObserveOn(RxApp.MainThreadScheduler) .SubscribeWithLog(_ => { item.IsEditing = false; }); }
private void CheckItem(ListStructItemModel item) { ChangeFlags(); }