Esempio n. 1
0
        public MainViewModel()
        {
            var hockeyClient = (HockeyClient)HockeyClient.Current;

            if (SendTelemetry)
            {
                hockeyClient.Configure(HockeyAppId)
                .RegisterCustomDispatcherUnhandledExceptionLogic(OnUnhandledDispatcherException)
                .UnregisterDefaultUnobservedTaskExceptionHandler();

                var platformHelper = (HockeyPlatformHelperWPF)hockeyClient.PlatformHelper;
                platformHelper.AppVersion = _currentVersion.ToString();

                hockeyClient.TrackEvent(TelemetryEventNames.Start);
            }
            else
            {
                Application.Current.DispatcherUnhandledException += (sender, args) => OnUnhandledDispatcherException(args);

                var platformHelper = new HockeyPlatformHelperWPF {
                    AppVersion = _currentVersion.ToString()
                };
                hockeyClient.PlatformHelper = platformHelper;
                hockeyClient.AppIdentifier  = HockeyAppId;
            }

            NuGet = new NuGetViewModel();
            NuGetConfiguration = new NuGetConfiguration(NuGet.GlobalPackageFolder, NuGetPathVariableName);
            RoslynHost         = new RoslynHost(NuGetConfiguration, new[] { Assembly.Load("RoslynPad.RoslynEditor") });

            NewDocumentCommand          = new DelegateCommand((Action)CreateNewDocument);
            CloseCurrentDocumentCommand = new DelegateCommand(CloseCurrentDocument);
            ClearErrorCommand           = new DelegateCommand(() => LastError = null);
            ReportProblemCommand        = new DelegateCommand((Action)ReportProblem);

            _editorFontSize = Properties.Settings.Default.EditorFontSize;

            DocumentRoot  = CreateDocumentRoot();
            Documents     = DocumentRoot.Children;
            OpenDocuments = new ObservableCollection <OpenDocumentViewModel>(LoadAutoSaves(DocumentRoot.Path));
            OpenDocuments.CollectionChanged += (sender, args) => OnPropertyChanged(nameof(HasNoOpenDocuments));
            if (HasNoOpenDocuments)
            {
                CreateNewDocument();
            }
            else
            {
                CurrentOpenDocument = OpenDocuments[0];
            }

            if (HasCachedUpdate())
            {
                HasUpdate = true;
            }
            else
            {
                Task.Run(CheckForUpdates);
            }
        }
Esempio n. 2
0
        public void Initialize(string currentVersion, IApplicationSettings settings)
        {
            var hockeyClient = (HockeyClient)HockeyClient.Current;

            if (settings.SendErrors)
            {
                hockeyClient.Configure(HockeyAppId)
                .RegisterCustomDispatcherUnhandledExceptionLogic(OnUnhandledDispatcherException)
                .UnregisterDefaultUnobservedTaskExceptionHandler();

                var platformHelper = (HockeyPlatformHelperWPF)hockeyClient.PlatformHelper;
                platformHelper.AppVersion = currentVersion;

#if DEBUG
                hockeyClient.OnHockeySDKInternalException += (sender, args) =>
                {
                    if (Debugger.IsAttached)
                    {
                        Debugger.Break();
                    }
                };
#endif

                var task = HockeyAppWorkaroundInitializer.InitializeAsync();
                task.ContinueWith(t =>
                {
                    Debug.Assert(hockeyClient.IsTelemetryInitialized, "hockeyClient.IsTelemetryInitialized");
                    hockeyClient.TrackEvent(TelemetryEventNames.Start);
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
            else
            {
                Application.Current.DispatcherUnhandledException +=
                    (sender, args) => OnUnhandledDispatcherException(args);

                var platformHelper = new HockeyPlatformHelperWPF {
                    AppVersion = currentVersion
                };
                hockeyClient.PlatformHelper = platformHelper;
                hockeyClient.AppIdentifier  = HockeyAppId;
            }
        }
Esempio n. 3
0
        public void Initialize(string currentVersion)
        {
            var hockeyClient = (HockeyClient)HockeyClient.Current;

            if (Properties.Settings.Default.SendErrors)
            {
                hockeyClient.Configure(HockeyAppId)
                .RegisterCustomDispatcherUnhandledExceptionLogic(OnUnhandledDispatcherException)
                .UnregisterDefaultUnobservedTaskExceptionHandler();

#if DEBUG
                hockeyClient.OnHockeySDKInternalException += (sender, args) =>
                {
                    if (Debugger.IsAttached)
                    {
                        Debugger.Break();
                    }
                };
#endif
                var platformHelper = (HockeyPlatformHelperWPF)hockeyClient.PlatformHelper;
                platformHelper.AppVersion = currentVersion;

                hockeyClient.TrackEvent(TelemetryEventNames.Start);
            }
            else
            {
                Application.Current.DispatcherUnhandledException +=
                    (sender, args) => OnUnhandledDispatcherException(args);

                var platformHelper = new HockeyPlatformHelperWPF {
                    AppVersion = currentVersion
                };
                hockeyClient.PlatformHelper = platformHelper;
                hockeyClient.AppIdentifier  = HockeyAppId;
            }
        }