예제 #1
0
        public static MefServices GetForTextBuffer(ITextBuffer buf)
        {
            if (buf == null)
            {
                return(null);
            }

            MefServices svc;

            if (buf.Properties.TryGetProperty <MefServices>(typeof(MefServices), out svc) && svc != null)
            {
                return(svc);
            }

            svc = new MefServices();
            buf.Properties[typeof(MefServices)] = svc;
            return(svc);
        }
예제 #2
0
        private static MefServices GetForTextView(IWpfTextView wpfView)
        {
            if (wpfView == null)
            {
                return(null);
            }

            MefServices svc;

            if (wpfView.Properties.TryGetProperty <MefServices>(typeof(MefServices), out svc) && svc != null)
            {
                return(svc);
            }

            svc = new MefServices();
            wpfView.Properties[typeof(MefServices)] = svc;
            return(svc);
        }