Ejemplo n.º 1
0
        public (StartDebuggingOptions options, StartDebuggingOptionsInfoFlags flags) GetStartDebuggingOptions(string?defaultBreakKind)
        {
            var breakKind = defaultBreakKind ?? PredefinedBreakKinds.DontBreak;
            var filename  = GetCurrentFilename();
            var context   = new StartDebuggingOptionsPageContext(filename);
            var pages     = GetStartDebuggingOptionsPages(context);

            Debug.Assert(pages.Length != 0, "No debug engines!");
            if (pages.Length == 0)
            {
                return(default);
        public override IEnumerable <StartDebuggingOptionsPage> Create(StartDebuggingOptionsPageContext context)
        {
            yield return(new DotNetFrameworkStartDebuggingOptionsPage(pickFilename, pickDirectory));

            yield return(new DotNetCoreStartDebuggingOptionsPage(pickFilename, pickDirectory));
        }
Ejemplo n.º 3
0
        public StartDebuggingOptions GetStartDebuggingOptions(string defaultBreakKind)
        {
            var breakKind = defaultBreakKind ?? PredefinedBreakKinds.DontBreak;
            var filename  = GetCurrentFilename();
            var context   = new StartDebuggingOptionsPageContext(filename);
            var pages     = GetStartDebuggingOptionsPages(context);

            Debug.Assert(pages.Length != 0, "No debug engines!");
            if (pages.Length == 0)
            {
                return(null);
            }

            var oldOptions  = mru.TryGetOptions(filename);
            var lastOptions = mru.TryGetLastOptions();

            foreach (var page in pages)
            {
                if (oldOptions?.pageGuid == page.Guid)
                {
                    page.InitializePreviousOptions(WithBreakKind(oldOptions.Value.options, defaultBreakKind));
                }
                else if (oldOptions == null && lastOptions?.pageGuid == page.Guid)
                {
                    page.InitializeDefaultOptions(filename, breakKind, WithBreakKind(lastOptions.Value.options, defaultBreakKind));
                }
                else
                {
                    page.InitializeDefaultOptions(filename, breakKind, null);
                }
            }

            // If there's an exact match ('oldOptions'), then prefer it.
            // Otherwise ask code that knows what kind of exe it is, but prefer the last selected guid if there are multiple matches.
            // Else use last page guid.
            var selectedPageGuid =
                oldOptions?.pageGuid ??
                GetDefaultPageGuid(pages, filename, lastOptions?.pageGuid) ??
                lastOptions?.pageGuid ??
                Guid.Empty;

            var dlg = new DebugProgramDlg();
            var vm  = new DebugProgramVM(pages, selectedPageGuid);

            dlg.DataContext = vm;
            dlg.Owner       = appWindow.MainWindow;
            var res = dlg.ShowDialog();

            vm.Close();
            if (res != true)
            {
                return(null);
            }
            var info = vm.StartDebuggingOptions;

            if (info.Filename != null)
            {
                mru.Add(info.Filename, info.Options, vm.SelectedPageGuid);
            }
            return(info.Options);
        }