public TyeExplorerToolWindow() : base(null)
        {
            Caption = "Tye Explorer";

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            Content = _control = new TyeExplorerToolWindowControl();
            ToolBar = new CommandID(PackageGuids.guidTyeExplorerCommandsAndMenus, PackageIds.TyeExplorer_Toolbar);

            _control.AttachToReplica     += OnAttachToReplica;
            _control.AttachToService     += OnAttachToService;
            _control.SelectedItemChanged += OnSelectedItemChanged;
            _control.ShowServiceLogs     += OnShowServiceLogs;

            var servicesProvider = TyeExplorerServices.Get <TyeServicesProvider>();

            servicesProvider.ServicesRequestStarted += OnServicesRequestStarted;
            servicesProvider.ServicesReceived       += OnServicesReceived;
            servicesProvider.ServiceRequestFailure  += ServicesProviderOnServiceRequestFailure;

            var services = servicesProvider.Services;

            if (services != null)
            {
                _control.SetServices(services.ToArray());
            }
        }
        public TyeExplorerServices(AsyncPackage package)
        {
            AddService(package);
            AddService(this);

            _instance = this;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
        /// <param name="progress">A provider for progress updates.</param>
        /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(DisposalToken);

            var services = new TyeExplorerServices(this);

            services.GetService <TyeCommandManager>().Initialize(this);
            services.GetService <TyeExplorerLogger>().Initialize();
            services.GetService <TyeServicesProvider>().EnableBackgroundRefresh();
        }
        private void OnAttachToReplica(object sender, ReplicaEventArgs e)
        {
            if (e.Replica.Pid == null)
            {
                return;
            }

            ThreadHelper.ThrowIfNotOnUIThread();

            TyeExplorerServices.Get <DebuggerAttacher>().Attach(e.Replica);
        }
Exemplo n.º 5
0
 public TyeCommandManager(TyeExplorerServices serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
 private void OnShowServiceLogs(object sender, ServiceEventArgs e)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     TyeExplorerServices.Get <TyeServiceOutputManager>().Attach(e.Service);
 }
 private void OnAttachToService(object sender, ServiceEventArgs e)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     TyeExplorerServices.Get <DebuggerAttacher>().Attach(e.Service.Replicas.Values);
 }
 private void OnSelectedItemChanged(object sender, ItemEventArgs e)
 {
     TyeExplorerServices.Get <TyeServicesProvider>().SelectedService = e.Item;
 }