/// <summary>
        /// Handler for when the Launch settings file changes. Actually, we watch the project root so any
        /// file with the name LaunchSettings.json. We don't need to special case because, if a file with this name
        /// changes we will only check if the one we cared about was modified.
        /// </summary>
        protected void LaunchSettingsFile_Changed(object sender, FileSystemEventArgs e)
        {
            if (!IgnoreFileChanges)
            {
#pragma warning disable CS0618  // We're in a synchronous callback
                string fileName = LaunchSettingsFile;
#pragma warning restore CS0618

                // Only do something if the file is truly different than what we synced. Here, we want to
                // throttle.
                if (!FileManager.FileExists(fileName) || FileManager.LastFileWriteTime(fileName) != LastSettingsFileSyncTime)
                {
                    FileChangeScheduler.ScheduleAsyncTask(async token =>
                    {
                        if (token.IsCancellationRequested)
                        {
                            return;
                        }

                        // Updates need to be sequenced
                        await _sequentialTaskQueue.ExecuteTask(async() =>
                        {
                            await UpdateProfilesAsync(null).ConfigureAwait(false);
                        }).ConfigureAwait(false);
                    });
                }
            }
        }
Exemplo n.º 2
0
        protected Task HandleLaunchSettingsFileChangedAsync()
        {
            if (!IgnoreFileChanges)
            {
#pragma warning disable CS0618  // We're in a synchronous callback
                string fileName = LaunchSettingsFile;
#pragma warning restore CS0618

                // Only do something if the file is truly different than what we synced. Here, we want to
                // throttle.
                if (!_fileSystem.FileExists(fileName) || _fileSystem.LastFileWriteTime(fileName) != LastSettingsFileSyncTime)
                {
                    return(FileChangeScheduler.ScheduleAsyncTask(token =>
                    {
                        if (token.IsCancellationRequested)
                        {
                            return Task.CompletedTask;
                        }

                        // Updates need to be sequenced
                        return _sequentialTaskQueue.ExecuteTask(() => UpdateProfilesAsync(null));
                    }).Task);
                }
            }

            return(Task.CompletedTask);
        }
        /// <summary>
        /// Handler for when the Launch settings file changes. Actually, we watch the project root so any
        /// file with the name LaunchSettings.json. We don't need to special case because, if a file with this name
        /// changes we will only check if the one we cared about was modified.
        /// </summary>
        protected void LaunchSettingsFile_Changed(object sender, FileSystemEventArgs e)
        {
            if (!IgnoreFileChanges)
            {
                // Only do something if the file is truly different than what we synced. Here, we want to
                // throttle.
                if (!FileManager.FileExists(LaunchSettingsFile) || FileManager.LastFileWriteTime(LaunchSettingsFile) != LastSettingsFileSyncTime)
                {
                    FileChangeScheduler.ScheduleAsyncTask(async token => {
                        if (token.IsCancellationRequested)
                        {
                            return;
                        }

                        await UpdateProfilesAsync(null).ConfigureAwait(false);
                    });
                }
            }
        }