예제 #1
0
        public static T GetAncestorOfType <T>(this ITreeNodeDesignerHost host, object component)
        {
            var des = host.GetDesigner(component);

            if (des == null)
            {
                return(default !);
예제 #2
0
        public void Setup()
        {
            mr                    = new MockRepository();
            this.sc               = new ServiceContainer();
            this.node             = mr.StrictMock <ITreeNode>();
            this.host             = mr.StrictMock <ITreeNodeDesignerHost>();
            this.uiSvc            = mr.StrictMock <IDecompilerShellUiService>();
            this.cmdidLoadSymbols = new CommandID(CmdSets.GuidReko, CmdIds.LoadSymbols);
            this.slSvc            = mr.StrictMock <ISymbolLoadingService>();
            this.symSrc           = mr.StrictMock <ISymbolSource>();

            // Add services to the Service container (which in the real program is the Reko "main window")
            this.sc.AddService <ISymbolLoadingService>(slSvc);
            this.sc.AddService <IDecompilerShellUiService>(uiSvc);
        }
예제 #3
0
        public static T GetAncestorOfType <T>(this ITreeNodeDesignerHost host, object component)
        {
            var des = host.GetDesigner(component);

            if (des == null)
            {
                return(default(T));
            }
            for (;;)
            {
                des = des.Parent;
                if (des == null)
                {
                    return(default(T));
                }
                if (des.Component is T)
                {
                    return((T)des.Component);
                }
            }
        }