예제 #1
0
        protected override void OnTargetStateChanged()
        {
            base.OnTargetStateChanged();
            if (IsRunning)
            {
                return;
            }
            // synchronize
            var newItems = Target.GetBreakpointList();
            var oldItems = _breakpoints.Select(arg => arg.Entity);
            var add      = newItems
                           .Except(oldItems)
                           .Select(arg => new BreakpointViewModel(arg))
                           .ToList();
            var del = oldItems
                      .Except(newItems)
                      .Select(arg => _breakpoints.First(bp => bp.Entity == arg))
                      .ToList();

            if (SelectedBreakpoint != null &&
                del.Any(arg => arg == SelectedBreakpoint))
            {
                SelectedBreakpoint = null;
            }
            del.ForEach(arg => _breakpoints.Remove(arg));
            add.ForEach(arg => _breakpoints.Add(arg));
        }
예제 #2
0
        public static BreakpointDetailViewModel CreateScopedBreakpointDetailViewModel(this IServiceScope serviceScope,
                                                                                      BreakpointViewModel breakpointViewModel, BreakpointDetailDialogMode mode)
        {
            var viewModel = ActivatorUtilities.CreateInstance <BreakpointDetailViewModel>(serviceScope.ServiceProvider,
                                                                                          serviceScope.ServiceProvider.GetRequiredService <ILogger <BreakpointDetailViewModel> >(),
                                                                                          serviceScope.ServiceProvider.GetRequiredService <BreakpointsViewModel>(),
                                                                                          breakpointViewModel, mode);

            return(viewModel);
        }