49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
![]() |
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Collections.ObjectModel;
|
|||
|
using System.IO;
|
|||
|
using System.Linq;
|
|||
|
using System.Net.Http;
|
|||
|
using System.Text.RegularExpressions;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows;
|
|||
|
using System.Windows.Media;
|
|||
|
using Prism.Ioc;
|
|||
|
using Unity;
|
|||
|
|
|||
|
namespace CAD.Extend
|
|||
|
{
|
|||
|
public class GlobalObject
|
|||
|
{
|
|||
|
public static IContainerExtension _prismContainer;
|
|||
|
public enum dialogPar
|
|||
|
{
|
|||
|
info,
|
|||
|
para1,
|
|||
|
para2
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取图片
|
|||
|
/// </summary>
|
|||
|
/// <param name="resName">包括命名空间</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static System.Windows.Media.ImageSource ImageSourceFromEmbeddedResourceStream(string resName)
|
|||
|
{
|
|||
|
System.Reflection.Assembly assy = System.Reflection.Assembly.GetExecutingAssembly();
|
|||
|
//foreach (string resource in assy.GetManifestResourceNames())
|
|||
|
//{
|
|||
|
// Console.WriteLine(resource);//遍历所有的内嵌资源
|
|||
|
//}
|
|||
|
System.IO.Stream stream = assy.GetManifestResourceStream(resName);
|
|||
|
if (stream == null)
|
|||
|
return null;
|
|||
|
System.Windows.Media.Imaging.BitmapImage img = new System.Windows.Media.Imaging.BitmapImage();
|
|||
|
img.BeginInit();
|
|||
|
img.StreamSource = stream;
|
|||
|
img.EndInit();
|
|||
|
return img;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|