Exemplo n.º 1
0
        public int GetFirstLineOfMethod(MethodViewModel methodViewModel)
        {
            Method method          = MethodModelByIdDict[methodViewModel.Id];
            var    firstLineNumber = method.FirstLineNumber;

            return(firstLineNumber);
        }
Exemplo n.º 2
0
        public string GetSourceFilePathForMethod(MethodViewModel methodViewModel)
        {
            Method method     = MethodModelByIdDict[methodViewModel.Id];
            string sourceFile = method.SourceFile;

            return(sourceFile);
        }
Exemplo n.º 3
0
        public void ActivateCriterion(Criterion criterion)
        {
            if (MethodVMByIdDict == null)
            {
                return;
            }
            ActiveCriterion = criterion;
            foreach (var kvp in MethodVMByIdDict)
            {
                uint            methodId        = kvp.Key;
                MethodViewModel methodViewModel = kvp.Value;

                Method method = MethodModelByIdDict[methodId];
                Contract.Assume(method.Id == methodViewModel.Id);
                IValue activeValue = method.GetValueFor(criterion);
                IValue maxValue    = CriteriaContext.GetMaxValueFor(criterion);

                methodViewModel.Opacity     = activeValue.ConvertToZeroOneScale(maxValue) * 0.8 + 0.1;
                methodViewModel.ActiveValue = activeValue;
            }

            var newSortedMethodVMs = SortedMethodVMs.OrderByDescending(mvm => mvm.ActiveValue).ToArray();

            SortedMethodVMs.Clear();
            foreach (var methodVM in newSortedMethodVMs)
            {
                SortedMethodVMs.Add(methodVM);
            }
        }
Exemplo n.º 4
0
        public void OnMethodClick(MethodViewModel methodViewModel)
        {
            Action <MethodViewModel> handler = MethodClick;

            if (handler != null)
            {
                handler(methodViewModel);
            }
        }
Exemplo n.º 5
0
 public void InitAllMethodViewModels()
 {
     foreach (var kvp in MethodVMByIdDict)
     {
         MethodViewModel methodViewModel = kvp.Value;
         methodViewModel.Activate   += MethodActivate;
         methodViewModel.Deactivate += MethodDeactivated;
         methodViewModel.Highlight  += OnMethodClick;
     }
 }
Exemplo n.º 6
0
 public void MethodDeactivated(MethodViewModel methodVM)
 {
     if (ActiveMethodVM == null)
     {
         return;
     }
     Contract.Assume(ActiveMethodVM.Id == methodVM.Id);
     ActiveMethodVM.Opacity = ActiveMethodVM.OpacityTemp;
     ActiveMethodVM         = null;
     methodVM.BorderBrush   = MethodView.MethodBorderColor.ToBrush();
     methodVM.IsActive      = false;
 }
Exemplo n.º 7
0
        public void MethodActivate(MethodViewModel methodVM)
        {
            if (ActiveMethodVM != null && ActiveMethodVM.IsActive)
            {
                MethodDeactivated(ActiveMethodVM);
            }

            ActiveMethodVM             = methodVM;
            methodVM.IsActive          = true;
            methodVM.BorderBrush       = MethodView.ActiveMethodBorderColor.ToBrush();
            ActiveMethodVM.OpacityTemp = ActiveMethodVM.Opacity;
            ActiveMethodVM.Opacity     = 1;
            ShowMethodInDetail(methodVM.Id);
        }
Exemplo n.º 8
0
 public void OnMethodClick(MethodViewModel methodViewModel)
 {
     Action<MethodViewModel> handler = MethodClick;
     if (handler != null)
     {
         handler(methodViewModel);
     }
 }
Exemplo n.º 9
0
 public void MethodDeactivated(MethodViewModel methodVM)
 {
     if (ActiveMethodVM == null) return;
     Contract.Assume(ActiveMethodVM.Id == methodVM.Id);
     ActiveMethodVM.Opacity = ActiveMethodVM.OpacityTemp;
     ActiveMethodVM = null;
     methodVM.BorderBrush = MethodView.MethodBorderColor.ToBrush();
     methodVM.IsActive = false;
 }
Exemplo n.º 10
0
        public void MethodActivate(MethodViewModel methodVM)
        {
            if (ActiveMethodVM != null && ActiveMethodVM.IsActive)
            {
                MethodDeactivated(ActiveMethodVM);
            }

            ActiveMethodVM = methodVM;
            methodVM.IsActive = true;
            methodVM.BorderBrush = MethodView.ActiveMethodBorderColor.ToBrush();
            ActiveMethodVM.OpacityTemp = ActiveMethodVM.Opacity;
            ActiveMethodVM.Opacity = 1;
            ShowMethodInDetail(methodVM.Id);
        }
Exemplo n.º 11
0
 public string GetSourceFilePathForMethod(MethodViewModel methodViewModel)
 {
     Method method = MethodModelByIdDict[methodViewModel.Id];
     string sourceFile = method.SourceFile;
     return sourceFile;
 }
Exemplo n.º 12
0
 public int GetFirstLineOfMethod(MethodViewModel methodViewModel)
 {
     Method method = MethodModelByIdDict[methodViewModel.Id];
     var firstLineNumber = method.FirstLineNumber;
     return firstLineNumber;
 }
        private void OnMethodClick(UILogic uiLogic, MethodViewModel mvm)
        {
            string sourcePath = uiLogic.GetSourceFilePathForMethod(mvm);
            _dte.ItemOperations.OpenFile(sourcePath);

            //TODO when the adornment layer is stable, enable this line moving.
            //var firstLineOfMethod = uiLogic.GetFirstLineOfMethod(mvm);
            //var commandName = "Edit.GoTo " + firstLineOfMethod;
            //_dte.ExecuteCommand(commandName);
        }