Ejemplo n.º 1
0
        public static string ToFriendlyString(this VisualStudioVersion self)
        {
            if (self == VisualStudioVersion.Unknown)
            {
                return(self.ToString());
            }

            return(self.ToString().Substring(2));
        }
Ejemplo n.º 2
0
        public BuildVisionPackage()
        {
            _logger.Information("Starting {ProductName} with Version {PackageVersion}", Resources.ProductName, ApplicationInfo.GetPackageVersion(this));

            PresentationTraceSources.Refresh();
            PresentationTraceSources.DataBindingSource.Listeners.Add(new SerilogTraceListener.SerilogTraceListener(_logger));
            PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error | SourceLevels.Critical | SourceLevels.Warning;

            if (Application.Current != null)
            {
                Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
            }

            DiagnosticsClient.Initialize(GetEdition(), VisualStudioVersion.ToString(), "c437ad44-0c76-4006-968d-42d4369bc0ed");
        }
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            _dte2 = await GetServiceAsync(typeof(DTE)) as DTE2;

            Assumes.Present(_dte2);

            if (_dte2 == null)
            {
                return;
            }

            var oleMenuCommandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            if (oleMenuCommandService != null)
            {
                var menuCommandId3 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidDgmlBuild);
                var menuItem3 = new OleMenuCommand(async(s, e) => await OnProjectContextMenuInvokeHandlerAsync(s, e), null,
                                                   async(s, e) => await OnProjectMenuBeforeQueryStatusAsync(s, e), menuCommandId3);
                oleMenuCommandService.AddCommand(menuItem3);

                var menuCommandId5 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidReverseEngineerCodeFirst);
                var menuItem5 = new OleMenuCommand(async(s, e) => await OnProjectContextMenuInvokeHandlerAsync(s, e), null,
                                                   async(s, e) => await OnProjectMenuBeforeQueryStatusAsync(s, e), menuCommandId5);
                oleMenuCommandService.AddCommand(menuItem5);

                var menuCommandId7 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidAbout);
                var menuItem7 = new OleMenuCommand(async(s, e) => await OnProjectContextMenuInvokeHandlerAsync(s, e), null,
                                                   async(s, e) => await OnProjectMenuBeforeQueryStatusAsync(s, e), menuCommandId7);
                oleMenuCommandService.AddCommand(menuItem7);

                var menuCommandId8 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidDgmlNuget);
                var menuItem8 = new OleMenuCommand(async(s, e) => await OnProjectContextMenuInvokeHandlerAsync(s, e), null,
                                                   async(s, e) => await OnProjectMenuBeforeQueryStatusAsync(s, e), menuCommandId8);
                oleMenuCommandService.AddCommand(menuItem8);

                var menuCommandId9 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidSqlBuild);
                var menuItem9 = new OleMenuCommand(async(s, e) => await OnProjectContextMenuInvokeHandlerAsync(s, e), null,
                                                   async(s, e) => await OnProjectMenuBeforeQueryStatusAsync(s, e), menuCommandId9);
                oleMenuCommandService.AddCommand(menuItem9);

                var menuCommandId10 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                    (int)PkgCmdIDList.cmdidDebugViewBuild);
                var menuItem10 = new OleMenuCommand(async(s, e) => await OnProjectContextMenuInvokeHandlerAsync(s, e), null,
                                                    async(s, e) => await OnProjectMenuBeforeQueryStatusAsync(s, e), menuCommandId10);
                oleMenuCommandService.AddCommand(menuItem10);

                var menuCommandId11 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                    (int)PkgCmdIDList.cmdidMigrationStatus);
                var menuItem11 = new OleMenuCommand(async(s, e) => await OnProjectContextMenuInvokeHandlerAsync(s, e), null,
                                                    async(s, e) => await OnProjectMenuBeforeQueryStatusAsync(s, e), menuCommandId11);
                oleMenuCommandService.AddCommand(menuItem11);

                var menuCommandId12 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                    (int)PkgCmdIDList.cmdidDbCompare);
                var menuItem12 = new OleMenuCommand(async(s, e) => await OnProjectContextMenuInvokeHandlerAsync(s, e), null,
                                                    async(s, e) => await OnProjectMenuBeforeQueryStatusAsync(s, e), menuCommandId12);
                oleMenuCommandService.AddCommand(menuItem12);

                var menuCommandId1101 = new CommandID(GuidList.guidReverseEngineerMenu,
                                                      (int)PkgCmdIDList.cmdidReverseEngineerEdit);
                var menuItem251 = new OleMenuCommand(async(s, e) => await OnReverseEngineerConfigFileMenuInvokeHandlerAsync(s, e), null,
                                                     async(s, e) => await OnReverseEngineerConfigFileMenuBeforeQueryStatusAsync(s, e), menuCommandId1101);
                oleMenuCommandService.AddCommand(menuItem251);

                var menuCommandId1102 = new CommandID(GuidList.guidReverseEngineerMenu,
                                                      (int)PkgCmdIDList.cmdidReverseEngineerRefresh);
                var menuItem252 = new OleMenuCommand(async(s, e) => await OnReverseEngineerConfigFileMenuInvokeHandlerAsync(s, e), null,
                                                     async(s, e) => await OnReverseEngineerConfigFileMenuBeforeQueryStatusAsync(s, e), menuCommandId1102);
                oleMenuCommandService.AddCommand(menuItem252);
            }
            typeof(Microsoft.Xaml.Behaviors.Behavior).ToString();
            typeof(Microsoft.VisualStudio.ProjectSystem.ProjectCapabilities).ToString();
            typeof(Xceed.Wpf.Toolkit.SplitButton).ToString();

            Telemetry.Enabled = Properties.Settings.Default.ParticipateInTelemetry;
            if (Telemetry.Enabled)
            {
                Telemetry.Initialize(Dte2,
                                     System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                     VisualStudioVersion.ToString(),
                                     "00dac4de-337c-4fed-a835-70db30078b2a");
            }
            Telemetry.TrackEvent("Platform: Visual Studio " + VisualStudioVersion.ToString(1));
        }
        protected override void Initialize()
        {
            base.Initialize();

            _dte2 = GetService(typeof(DTE)) as DTE2;

            if (_dte2 == null)
            {
                return;
            }

            var oleMenuCommandService
                = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (oleMenuCommandService != null)
            {
                var menuCommandId3 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidDgmlBuild);
                var menuItem3 = new OleMenuCommand(OnProjectContextMenuInvokeHandler, null,
                                                   OnProjectMenuBeforeQueryStatus, menuCommandId3);
                oleMenuCommandService.AddCommand(menuItem3);

                var menuCommandId4 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidReverseEngineerDgml);
                var menuItem4 = new OleMenuCommand(OnProjectContextMenuInvokeHandler, null,
                                                   OnProjectMenuBeforeQueryStatus, menuCommandId4);
                oleMenuCommandService.AddCommand(menuItem4);

                var menuCommandId5 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidReverseEngineerCodeFirst);
                var menuItem5 = new OleMenuCommand(OnProjectContextMenuInvokeHandler, null,
                                                   OnProjectMenuBeforeQueryStatus, menuCommandId5);
                oleMenuCommandService.AddCommand(menuItem5);

                var menuCommandId7 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidAbout);
                var menuItem7 = new OleMenuCommand(OnProjectContextMenuInvokeHandler, null,
                                                   OnProjectMenuBeforeQueryStatus, menuCommandId7);
                oleMenuCommandService.AddCommand(menuItem7);

                var menuCommandId8 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidDgmlNuget);
                var menuItem8 = new OleMenuCommand(OnProjectContextMenuInvokeHandler, null,
                                                   OnProjectMenuBeforeQueryStatus, menuCommandId8);
                oleMenuCommandService.AddCommand(menuItem8);

                var menuCommandId9 = new CommandID(GuidList.guidDbContextPackageCmdSet,
                                                   (int)PkgCmdIDList.cmdidSqlBuild);
                var menuItem9 = new OleMenuCommand(OnProjectContextMenuInvokeHandler, null,
                                                   OnProjectMenuBeforeQueryStatus, menuCommandId9);
                oleMenuCommandService.AddCommand(menuItem9);
            }

            //Boot Telemetry
            Telemetry.Enabled = true;
            if (Telemetry.Enabled)
            {
                Telemetry.Initialize(Dte2,
                                     Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                     VisualStudioVersion.ToString(),
                                     "d4881a82-2247-42c9-9272-f7bc8aa29315");
            }
            Telemetry.TrackEvent("Platform: Visual Studio " + VisualStudioVersion.ToString(1));

            // AssemblyBindingRedirectHelper.ConfigureBindingRedirects();
        }