file-formats-wpf-demos/pdfviewer/ViewModel/LayersViewModel.cs

48 строки
1.4 KiB
C#

#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.IO;
using System.Windows;
using System.Windows.Resources;
namespace syncfusion.pdfviewerdemos.wpf
{
public class LayersViewModel
{
private Stream m_documentStream;
/// <summary>
/// Gets or sets the documnet path.
/// </summary>
public Stream DocumentStream
{
get
{
return m_documentStream;
}
set
{
m_documentStream = value;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="LayersViewModel"/> class.
/// </summary>
public LayersViewModel()
{
m_documentStream = GetFileStream("PdfLayer.pdf");
}
private Stream GetFileStream(string fileName)
{
Uri uriResource = new Uri("/syncfusion.pdfviewerdemos.wpf;component/Assets/" + fileName, UriKind.Relative);
StreamResourceInfo streamResourceInfo = Application.GetResourceStream(uriResource);
return streamResourceInfo.Stream;
}
}
}