Пример #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);
            }
        }
Пример #2
0
        public NuGetDocumentViewModel(NuGetViewModel nuGetViewModel)
        {
            _nuGetViewModel = nuGetViewModel;

            InstallPackageCommand = new DelegateCommand <PackageData>(InstallPackage);

            IsEnabled = true;
        }
Пример #3
0
        public MainViewModel()
        {
            _telemetryClient = new TelemetryClient {
                InstrumentationKey = ApplicationInsightsInstrumentationKey
            };
            _telemetryClient.Context.Component.Version = _currentVersion.ToString();
#if DEBUG
            _telemetryClient.Context.Properties["DEBUG"] = "1";
#endif
            if (SendTelemetry)
            {
                _telemetryClient.TrackEvent(TelemetryEventNames.Start);
            }

            Application.Current.DispatcherUnhandledException += (o, e) => OnUnhandledDispatcherException(e);
            AppDomain.CurrentDomain.UnhandledException       += (o, e) => OnUnhandledException((Exception)e.ExceptionObject, flushSync: true);
            TaskScheduler.UnobservedTaskException            += (o, e) => OnUnhandledException(e.Exception);

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

            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);
            }
        }
Пример #4
0
 public MainViewModel(IServiceProvider serviceProvider, ITelemetryProvider telemetryProvider, ICommandProvider commands, IApplicationSettings settings, NuGetViewModel nugetViewModel, DocumentFileWatcher documentWatcher) : base(serviceProvider, telemetryProvider, commands, settings, nugetViewModel, documentWatcher)
 {
 }
Пример #5
0
 public MainViewModel(IServiceProvider serviceProvider, IExceptionManager exceptionManager, ICommandProvider commands, IApplicationSettings settings, NuGetViewModel nugetViewModel, DocumentFileWatcher documentFileWatcher) :
     base(serviceProvider, exceptionManager, commands, settings, nugetViewModel, documentFileWatcher)
 {
 }
Пример #6
0
 public MainViewModel()
 {
     NuGet      = new NuGetViewModel();
     RoslynHost = new RoslynHost(new NuGetProvider(NuGet.GlobalPackageFolder, NuGetPathVariableName));
 }
Пример #7
0
 public MainViewModel(IServiceProvider serviceProvider, ITelemetryProvider telemetryProvider, ICommandProvider commands, IApplicationSettings settings, NuGetViewModel nugetViewModel) : base(serviceProvider, telemetryProvider, commands, settings, nugetViewModel)
 {
 }