Exemple #1
0
 public ExecutionHost(string hostPath, string initialWorkingDirectory,
                      IEnumerable <string> references, IEnumerable <string> imports,
                      NuGetConfiguration nuGetConfiguration, ChildProcessManager childProcessManager)
 {
     HostPath = hostPath;
     _initialWorkingDirectory = initialWorkingDirectory;
     _references          = references;
     _imports             = imports;
     _nuGetConfiguration  = nuGetConfiguration;
     _childProcessManager = childProcessManager;
 }
        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 ExecutionHost(string hostPath, string initialWorkingDirectory,
     IEnumerable<string> references, IEnumerable<string> imports,
     INuGetProvider nuGetProvider, ChildProcessManager childProcessManager)
 {
     HostPath = hostPath;
     _initialWorkingDirectory = initialWorkingDirectory;
     _references = references;
     _imports = imports;
     _nuGetProvider = nuGetProvider;
     _childProcessManager = childProcessManager;
     var serverProvider = new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full };
     _serverChannel = new IpcServerChannel(GenerateUniqueChannelLocalName(), "Channel-" + Guid.NewGuid(), serverProvider);
     ChannelServices.RegisterChannel(_serverChannel, ensureSecurity: false);
 }