private void EditItem(SetStructItemModel item)
        {
            if (item.IsEditing)
            {
                return;
            }

            item.IsEditing = true;

            _model.EditCommand.Execute(item)
            .SubscribeOn(RxApp.TaskpoolScheduler)
            .ObserveOn(RxApp.MainThreadScheduler)
            .SubscribeWithLog(_ => { item.IsEditing = false; });
        }
        private IObservable <(SetStructItemModel, SetStructItemModel)> ExecuteEdit(
            byte[] key, RedisTargetInfo targetInfo, SetStructItemModel setItem)
        {
            var editedSetItem = new SetStructItemModel
            {
                Value       = setItem.Value,
                IsChecked   = setItem.IsChecked,
                IsEnabled   = setItem.IsEnabled,
                CheckAction = setItem.CheckAction,
                EditAction  = setItem.EditAction
            };

            return(_dialogManager.Open(EditorDialogModel.ReplaceSetItem(
                                           setItem.Value, target =>
            {
                return _clientAccessor.With(targetInfo, client =>
                {
                    var isValueEmpty = string.IsNullOrEmpty(target.Value);
                    var alreadyExists = !isValueEmpty &&
                                        setItem.Value != target.Value &&
                                        client.SIsMember(ustring.Make(key).ToString(), target.Value);

                    if (!isValueEmpty && !alreadyExists)
                    {
                        client.Multi();
                        client.SRem(ustring.Make(key).ToString(), setItem.Value);
                        client.SAdd(ustring.Make(key).ToString(), target.Value);
                        client.Exec();

                        editedSetItem.Value = target.Value;
                    }

                    return new EditorResult
                    {
                        ValueError = isValueEmpty
                                        ? "Value is empty"
                                        : (alreadyExists ? "Value already exists" : null),
                        Action = target.Action
                    };
                });
            }))
                   .Select(wasEdited => wasEdited ? (setItem, editedSetItem) : (null, null)));
        }
 private void CheckItem(SetStructItemModel item)
 {
     ChangeActionsMode();
 }