public MainViewModel() { 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(); NuGetProvider = new NuGetProviderImpl(NuGet.GlobalPackageFolder, NuGetPathVariableName); RoslynHost = new RoslynHost(NuGetProvider); ChildProcessManager = new ChildProcessManager(); NewDocumentCommand = new DelegateCommand((Action)CreateNewDocument); ClearErrorCommand = new DelegateCommand(() => LastError = null); 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); } }
public NuGetDocumentViewModel(NuGetViewModel nuGetViewModel) { _nuGetViewModel = nuGetViewModel; InstallPackageCommand = new DelegateCommand<PackageData>(InstallPackage); IsEnabled = true; }