/// <summary>
        /// Standard constructor for the tool window.
        /// </summary>
        public MyToolWindow()
            : base(null)
        {
            try
            {
                // Set the window title reading it from the resources.
                Caption = Resources.ToolWindowTitle;

                // Set the image that will appear on the tab of the window frame when docked with an other window.
                // The resource ID correspond to the one defined in the resx file while the Index is the offset in the bitmap strip.
                // Each image in the strip being 16x16.
                BitmapResourceID = 301;
                BitmapIndex      = 1;

                var path = Path.GetDirectoryName(GetType().Assembly.Location);
                Contract.Assume(path != null);

                _compositionHost.AddCatalog(new DirectoryCatalog(path, @"*.dll"));
                _compositionHost.ComposeExportedValue((IVsServiceProvider)this);
                _compositionHost.ComposeExportedValue((ISourceFilesProvider)this);

                _trace             = _compositionHost.GetExportedValue <ITracer>();
                _performanceTracer = _compositionHost.GetExportedValue <PerformanceTracer>();
                _configuration     = _compositionHost.GetExportedValue <Configuration>();

                _resourceManager = _compositionHost.GetExportedValue <ResourceManager>();
                _resourceManager.BeginEditing += ResourceManager_BeginEditing;

                VisualComposition.Error += VisualComposition_Error;
            }
            catch (Exception ex)
            {
                _trace.TraceError("MyToolWindow .ctor failed: " + ex);
                MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.ExtensionLoadingError, ex.Message));
            }
        }
        /// <summary>
        /// Standard constructor for the tool window.
        /// </summary>
        public MyToolWindow() :
            base(null)
        {
            Caption = Resources.ToolWindowTitle;

            BitmapResourceID = 301;
            BitmapIndex      = 1;

            var path = Path.GetDirectoryName(GetType().Assembly.Location);

            var context = CreateRegistrationContext();

            _compositionHost.AddCatalog(new DirectoryCatalog(path, "*.dll", context));
            _compositionHost.ComposeExportedValue((IVsServiceProvider)this);

            _tracer = _compositionHost.GetExportedValue <ITracer>();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Standard constructor for the tool window.
        /// </summary>
        public MyToolWindow() :
            base(null)
        {
            Caption = Resources.ToolWindowTitle;

            BitmapResourceID = 301;
            BitmapIndex      = 1;

            var path = Path.GetDirectoryName(GetType().Assembly.Location);

            var context = CreateRegistrationContext();

            // ReSharper disable once AssignNullToNotNullAttribute
            _compositionHost.AddCatalog(new DirectoryCatalog(path, "ProjectConfigurationManager*.dll", context));
            _compositionHost.ComposeExportedValue((IVsServiceProvider)this);

            _tracer = _compositionHost.GetExportedValue <ITracer>();
        }