public ClassFactory()
            {
                var             cpServProv   = ICPServiceProvider.GetProvider();
                ICPEventService cpEvsService = new CPEventService();

                cpServProv.RegisterService <ICPEventService>(cpEvsService);
                constrEvents = cpEvsService.GetConstructEvents();
                cpServProv.RegisterService <ICPTrackService>(new CPTrackService());
            }
Beispiel #2
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>
        protected override void Initialize()
        {
            base.Initialize();
            ICPServiceProvider cpServProv = ICPServiceProvider.GetProvider();

            cpServProv.RegisterService <ICPTracerService>(new CPTracerService());

            IVsDebugger vsDebugService = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsShellDebugger)) as IVsDebugger;

            if (vsDebugService != null)
            {
                cpServProv.RegisterService <ICPDebugService>(new CPDebugService(vsDebugService));
            }

            ICPExtension extensionServ = new CPExtension();

            cpServProv.RegisterService <ICPExtension>(extensionServ);

            Globals.dte = (DTE)GetService(typeof(DTE));
            //factory = new ChartPntFactoryImpl();
            if (Globals.processor == null)
            {
                Globals.processor = CP.Utils.IClassFactory.GetInstance().CreateCPProc();
            }
            Globals.orchestrator = CP.Utils.IClassFactory.GetInstance().CreateCPOrchestrator();
            IVsSolution vsSolution = GetService(typeof(SVsSolution)) as IVsSolution;
            object      objLoadMgr = this; //the class that implements IVsSolutionManager

            vsSolution.SetProperty((int)__VSPROPID4.VSPROPID_ActiveSolutionLoadManager, objLoadMgr);
            solEvents = new VsSolutionEvents(this);
            uint solEvsCookie;

            vsSolution.AdviseSolutionEvents(solEvents, out solEvsCookie);
            buildManager3 = GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager3;
            cmdEvsHandler = new CmdEventsHandler(vsSolution);

            string vsixInstPath = extensionServ.GetVSIXInstallPath();
            string regSrvFName  = vsixInstPath + "\\cper.exe";

            if (File.Exists(regSrvFName))
            {
                string            message = "First time registration.\nAdministration privileges needed.";
                string            caption = "ChartPoints";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, caption, buttons);
                var p = new System.Diagnostics.Process();
                p.StartInfo.FileName    = regSrvFName;
                p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                p.StartInfo.Verb        = "runas";
                if (p.Start())
                {
                    p.WaitForExit();
                    File.Delete(regSrvFName);
                }
            }
        }
        public CPTrackService()
        {
            ICPServiceProvider cpServProv = ICPServiceProvider.GetProvider();
            ICPEventService    cpEvsService;

            cpServProv.GetService <ICPEventService>(out cpEvsService);
            IConstructEvents constrEvents = cpEvsService.GetConstructEvents();

            constrEvents.createdFileCPsEvent += OnFileCPsCreated;
            constrEvents.deletedFileCPsEvent += OnFileCPsDeleted;
        }
Beispiel #4
0
 public CPOrchestrator()
 {
     cpServProv = ICPServiceProvider.GetProvider();
     cpServProv.GetService <ICPDebugService>(out debugServ);
     if (debugServ != null)
     {
         debugServ.debugProcCreateCPEvent  += OnProcDebugCreate;
         debugServ.debugProcDestroyCPEvent += OnProcDebugDestroy;
     }
     cpServProv.GetService <ICPExtension>(out extensionServ);
 }
Beispiel #5
0
        public TextChangedListener()
        {
            var cpServProv = ICPServiceProvider.GetProvider();

            cpServProv.GetService <ICPTrackService>(out cpTrackServ);
            if (cpTrackServ == null)
            {
                cpTrackServ = new CPTrackService();
                cpServProv.RegisterService(cpTrackServ);
            }
            cpTrackServ.addFTrackerEvent += OnAddFTracker;
            cpTrackServ.remFTrackerEvent += OnRemFTracker;
        }
Beispiel #6
0
        public CPListTWCtrl()
        {
            InitializeComponent();
            this.list.CellDoubleClick  += OnListOnCellDoubleClick;
            this.list.KeyDown          += OnListOnKeyDown;
            this.list.CellValueChanged += OnCellValueChanged;
            this.list.CellMouseUp      += OnCellMouseUp;
            ICPServiceProvider cpServProv = ICPServiceProvider.GetProvider();
            ICPEventService    cpEvsService;

            cpServProv.GetService <ICPEventService>(out cpEvsService);
            IConstructEvents constrEvents = cpEvsService.GetConstructEvents();

            constrEvents.createdLineCPsEvent += OnCreatedLineCPsEvent;
            constrEvents.createdFileCPsEvent += OnCreatedFileCPsEvent;
        }
        public CPTraceHandler(ulong _id, string name)
        {
            id = _id;
            ICPServiceProvider cpServProv = ICPServiceProvider.GetProvider();
            ICPTracerService   traceServ;

            cpServProv.GetService <ICPTracerService>(out traceServ);
            traceServ.RegProcTracer(_id, name, out localProcTracer);

            //Globals.outputWindow.GetPane(Microsoft.VisualStudio.VSConstants.OutputWindowPaneGuid.DebugPane_guid, out outputWindowPane);
            //if (outputWindowPane != null)
            //  outputWindowPane.Activate();
            if (TraceTransport.GetProcTracer(id, out procTracer))
            {
                procTracer.OnRegElem += RegElem;
                procTracer.OnTrace   += Trace;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ChartPntToggleCmd"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private ChartPntToggleCmd(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;
            cpServProv   = ICPServiceProvider.GetProvider();
            cpServProv.GetService <ICPExtension>(out extensionServ);

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
                menuItem.BeforeQueryStatus += CheckAvailability;
                commandService.AddCommand(menuItem);
            }
        }