コード例 #1
0
        public HashStructProjectionModel(StructProjectionInfo structProjectionInfo)
        {
            var controller = new HashStructProjectionController(this);

            Pattern = "*";

            this.WhenActivated(disposables =>
            {
                var key        = structProjectionInfo.ResultProjectionInfo.Value;
                var targetInfo = structProjectionInfo.ResultProjectionInfo.Result.TargetInfo;

                controller.BindLength(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindScanCommand(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindAddCommand(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindDeleteCommand(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindEditCommand(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindCancelCommand()
                .DisposeWith(disposables);

                controller.ExecuteScanCommand()
                .DisposeWith(disposables);
            });
        }
コード例 #2
0
        public ListStructProjectionModel(StructProjectionInfo structProjectionInfo)
        {
            var controller = new ListStructProjectionController(this);

            StartIndex = "0";
            StopIndex  = "9";
            Range      = Tuple.Create(0, 9);

            this.WhenActivated(disposables =>
            {
                var key        = structProjectionInfo.ResultProjectionInfo.Value;
                var targetInfo = structProjectionInfo.ResultProjectionInfo.Result.TargetInfo;

                controller.BindLength(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindStartIndex()
                .DisposeWith(disposables);

                controller.BindStopIndex()
                .DisposeWith(disposables);

                controller.BindRange()
                .DisposeWith(disposables);

                controller.BindRangeCommand(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindAddCommand(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindDeleteCommand(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindEditCommand(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindCancelCommand()
                .DisposeWith(disposables);

                controller.ExecuteRangeCommand()
                .DisposeWith(disposables);
            });
        }
コード例 #3
0
        public StringStructProjectionModel(StructProjectionInfo structProjectionInfo)
        {
            var controller = new StringStructProjectionController(this);

            this.WhenActivated(disposables =>
            {
                var key        = structProjectionInfo.ResultProjectionInfo.Value;
                var targetInfo = structProjectionInfo.ResultProjectionInfo.Result.TargetInfo;

                controller.BindMimeTypes()
                .DisposeWith(disposables);

                controller.BindLength(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindValue(key, targetInfo)
                .DisposeWith(disposables);

                controller.BindSaveCommand(key, targetInfo)
                .DisposeWith(disposables);
            });
        }
コード例 #4
0
        private StructProjectionModel CreateProjectionModel(
            StructProjectionInfo structProjectionInfo)
        {
            switch (structProjectionInfo.Kind)
            {
            case StructProjectionKind.String:
                return(new StringStructProjectionModel(structProjectionInfo));

            case StructProjectionKind.List:
                return(new ListStructProjectionModel(structProjectionInfo));

            case StructProjectionKind.Hash:
                return(new HashStructProjectionModel(structProjectionInfo));

            case StructProjectionKind.Set:
                return(new SetStructProjectionModel(structProjectionInfo));

            case StructProjectionKind.ZSet:
                return(new ZSetStructProjectionModel(structProjectionInfo));
            }

            return(new NoneStructProjectionModel());
        }