Ejemplo n.º 1
0
		public void Save(Uri uri)
		{
			Write(uri, new PowerpraiseSongWriter());
			this.Uri = uri;
			this.uriResolver = SongUriResolver.Default;
			OnPropertyChanged("Uri");

			IsModified = false;
			IsImported = false;
		}
Ejemplo n.º 2
0
		public static async Task<Song> LoadAsync(Uri uri, SongUriResolver resolver, ISongReader reader, CancellationToken cancellation = default(CancellationToken))
		{
			var song = new Song();
			song.Uri = uri;
			song.uriResolver = resolver;

			if (reader.NeedsTemplate)
			{
				song.LoadClearTemplate();
			}

			using (Stream stream = await song.uriResolver.GetAsync(uri, cancellation))
			{
				cancellation.ThrowIfCancellationRequested();
				reader.Read(song, stream);
			}

			if (!(reader is PowerpraiseSongReader))
			{
				song.IsImported = true;
			}

			return song;
		}
Ejemplo n.º 3
0
		public static Task<Song> LoadAsync(Uri uri, SongUriResolver resolver, CancellationToken cancellation = default(CancellationToken))
		{
			return LoadAsync(uri, resolver, new PowerpraiseSongReader(), cancellation);
		}
Ejemplo n.º 4
0
		public Song(Uri uri, SongUriResolver resolver, ISongReader reader) : this()
		{
			this.Uri = uri;
			this.uriResolver = resolver;

			if (reader.NeedsTemplate)
			{
				LoadClearTemplate();
			}

			using (Stream stream = uriResolver.Get(uri))
			{
				reader.Read(this, stream);
			}

			if (!(reader is PowerpraiseSongReader))
			{
				IsImported = true;
			}
		}
Ejemplo n.º 5
0
		public Song(Uri uri, SongUriResolver resolver) : this(uri, resolver, new PowerpraiseSongReader()) { }
Ejemplo n.º 6
0
		private Song()
		{
			// this constructor must always be called
			this.uriResolver = SongUriResolver.Default;
			AddSource(String.Empty);
			Sources = new ReadOnlyObservableCollection<SongSource>(sources);
			Parts = new ReadOnlyObservableCollection<SongPart>(parts);
			Order = new ReadOnlyObservableCollection<SongPartReference>(order);
			Backgrounds = new ReadOnlyObservableCollection<SongBackground>(backgrounds);
		}