Example #1
0
        public ConstructorArgumentsViewModel(
            ChoosedParameters choosedParameters,
            Func <Task> previousStepAction,
            Func <Task> nextStepAction
            )
        {
            if (choosedParameters is null)
            {
                throw new ArgumentNullException(nameof(choosedParameters));
            }

            if (previousStepAction is null)
            {
                throw new ArgumentNullException(nameof(previousStepAction));
            }

            if (nextStepAction is null)
            {
                throw new ArgumentNullException(nameof(nextStepAction));
            }

            _choosedParameters  = choosedParameters;
            _previousStepAction = previousStepAction;
            _nextStepAction     = nextStepAction;
        }
        private void CreateBinding_OnMouseLeftButtonUp(
            object sender,
            MouseButtonEventArgs e
            )
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var tag = (sender as FrameworkElement)?.Tag as DpdtBindingReferenceSetViewModel;

            if (tag is null)
            {
                return;
            }

            ThreadHelper.ThrowIfNotOnUIThread();

            var codelensTarget = tag.Target as CodeLensTarget;

            var window = new AddBindingWindow(
                async anw =>
            {
                var choosedParameters = new ChoosedParameters(codelensTarget);

                var apcs = new AdditionalParametersChainStep(
                    anw,
                    anw.CenterContentControl,
                    choosedParameters
                    );

                var tmcs = new TargetMethodsChainStep(
                    anw.CenterContentControl,
                    choosedParameters
                    );

                var bfcs = new BindsFromChainStep(
                    anw.CenterContentControl,
                    choosedParameters
                    );

                var cacs = new ConstructorArgumentsChainStep(
                    anw.CenterContentControl,
                    choosedParameters
                    );

                var clcs = new ConstructorListChainStep(
                    anw.CenterContentControl,
                    choosedParameters
                    );

                apcs.SetSteps(tmcs);
                tmcs.SetSteps(bfcs, apcs);
                bfcs.SetSteps(cacs, clcs, tmcs);
                cacs.SetSteps(clcs, bfcs);
                clcs.SetSteps(cacs, bfcs);

                await clcs.CreateAsync();
            }
                );


            window.ShowModal();
        }