示例#1
0
        public override async Task StartAsync()
        {
            var targetMethodList = new List <TargetMethodViewModel>();

            var componentModel = (IComponentModel)Package.GetGlobalService(typeof(SComponentModel));

            _containerAndScanner = componentModel.GetService <ContainerAndScanner>();

            var solutionBind = _containerAndScanner.Binds;

            if (solutionBind != null)
            {
                foreach (var clusterBind in solutionBind.ClusterBindContainers)
                {
                    foreach (var mpair in clusterBind.GetMethodBindContainerDict())
                    {
                        var methodBind = mpair.Value;

                        targetMethodList.Add(
                            new TargetMethodViewModel(
                                methodBind
                                )

                            );
                    }
                }
            }

            if (targetMethodList.Count <= 0)
            {
                return;
            }


            foreach (var bm in targetMethodList.OrderBy(bm => bm.MethodBindContainer.ClusterTypeInfo.FullDisplayName))
            {
                TargetMethodList.Add(bm);
            }

            if (_choosedParameters.ChoosedTargetMethod != null)
            {
                var foundTargetMethod = TargetMethodList.FirstOrDefault(tm => tm.MethodBindContainer.MethodDeclaration == _choosedParameters.ChoosedTargetMethod.MethodDeclaration);
                if (foundTargetMethod != null)
                {
                    foundTargetMethod.IsChecked = true;
                    return;
                }
            }

            TargetMethodList[0].IsChecked = true;
        }
示例#2
0
 private IMethodBindContainer GetChoosedTargetMethod()
 {
     return(TargetMethodList.First(t => t.IsChecked).MethodBindContainer);
 }