Beispiel #1
0
        public void ShouldHandleMultipleTypes()
        {
            string code =
                @"using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }

    delegate void Test();
    class MyClass
    {

    }

    class MyClass1
    {

    }

    class MyClass2
    {

        class MyClass2A
        {

        }   
    }
}
";
            var result = Parser.FindTypeDeclarations(code).ToArray();

            //remove nested classes
            var rootTypes = result.ToArray()
                            .Where(x => !result.Any(y => y.StartLine <x.StartLine && y.EndLine> x.EndLine))
                            .ToArray();

            var dialog = new TypeToMoveSelection(result);

            dialog.ShowDialog();

            //Assert.True(result.Success);
            //Assert.Equal(9, result.StartLine);
        }
Beispiel #2
0
        public static IEnumerable <Parser.Result> SelectTypesManually(IEnumerable <Parser.Result> items)
        {
            var dialog = new TypeToMoveSelection(items);

            IVsUIShell uiShell = (IVsUIShell)Global.GetService(typeof(SVsUIShell));
            IntPtr     mainWnd;

            uiShell.GetDialogOwnerHwnd(out mainWnd);

            WindowInteropHelper helper = new WindowInteropHelper(dialog);

            helper.Owner = mainWnd;
            dialog.ShowDialog();

            return(dialog.SelectedItem);
        }