Beispiel #1
0
		public App()
		{
			string profilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"GitBlame\Profile");
			Directory.CreateDirectory(profilePath);
			ProfileOptimization.SetProfileRoot(profilePath);
			ProfileOptimization.StartProfile("Startup");

			Log.DebugFormat("Starting new application; version {0}.", Assembly.GetExecutingAssembly().GetName().Version);

			m_analyticsClient = new GoogleAnalyticsClient("UA-25641987-2", "GitBlame", new GoogleAnalyticsStatisticsProvider());
#if !DEVELOPMENT
			BugSense.Init("w8cfcffb");
#endif

			AppDomain.CurrentDomain.UnhandledException += (s, ea) =>
			{
				var exception = ea.ExceptionObject as Exception;
				if (exception != null)
				{
					Log.FatalFormat("Unhandled Exception: {0} {1}", exception, exception.GetType(), exception.Message);
#if !DEVELOPMENT
					m_analyticsClient.SubmitExceptionAsync(exception, true);
#endif
				}
				else
				{
					Log.FatalFormat("Unhandled Error: {0}", ea.ExceptionObject);
				}
			};

			m_app = new AppModel();
		}
Beispiel #2
0
        private static void IntegrateWithVisualStudio(IObserver <VisualStudioNotification> observer, string commandPath, VisualStudioNotification model, bool integrate)
        {
            string preference = string.Join(";", model.Versions.Select(x => GetEffectivePreference(integrate, x)));

            AppModel.SetRegistrySetting("VisualStudioIntegration", preference);

            if (integrate)
            {
                Log.InfoFormat("Integrating with {0}", string.Join(", ", model.Versions.Select(x => "({0}, {1}, {2})".FormatInvariant(x.Version, x.IntegrationStatus, x.IsChecked))));
                // TODO: Delete tools where !x.IsChecked && x.IntegrationStatus == VisualStudioIntegrationStatus.Installed
                IntegrateWithVisualStudio(commandPath, model.Versions.Where(x => x.IsChecked && x.IntegrationStatus == VisualStudioIntegrationStatus.Available));
            }

            Log.Info("Completing observer");
            observer.OnNext(null);
            observer.OnCompleted();
        }