private IObservable <HashStructItemModel> ExecuteEdit( byte[] key, RedisTargetInfo targetInfo, HashStructItemModel hashItem) { var editedHashItem = new HashStructItemModel { Key = hashItem.Key, Value = hashItem.Value, IsChecked = hashItem.IsChecked, IsEnabled = hashItem.IsEnabled, CheckAction = hashItem.CheckAction, EditAction = hashItem.EditAction }; return(_dialogManager.Open(EditorDialogModel.UpdateHashItem( hashItem.Key, hashItem.Value, target => { return _clientAccessor.With(targetInfo, client => { var isValueEmpty = string.IsNullOrEmpty(target.Value); if (!isValueEmpty) { client.HSet(ustring.Make(key).ToString(), hashItem.Key, target.Value); editedHashItem.Value = target.Value; } return new EditorResult { ValueError = isValueEmpty ? "Value is empty" : null, Action = target.Action }; }); })) .Select(wasEdited => wasEdited ? editedHashItem : null)); }
private void EditItem(HashStructItemModel 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(HashStructItemModel item) { ChangeActionsMode(); }