コード例 #1
0
        public void LoadFromResource(string assemblyName,MvxResourcePath resourcePath)
        {
            var resourceName = resourcePath.GetResourcePath (".",true);
            var strm = Assembly.Load (new AssemblyName(assemblyName)).GetManifestResourceStream(resourceName);

            bitmap = BitmapFactory.DecodeStream (strm);
        }
コード例 #2
0
        public void LoadFromResource(string assemblyName, MvxResourcePath resourceName)
        {
            //Package.Current.InstalledLocation.GetFileAsync()
            var path = resourceName.GetResourcePath(".", true);
            //   bitmap = new BitmapImage(new Uri("ms-appx:///" + assemblyName + "/" + path, UriKind.RelativeOrAbsolute));
            var strm = Assembly.Load(new AssemblyName(assemblyName)).GetManifestResourceStream(path);
            byte[] bts = new byte[strm.Length];
            strm.Read(bts, 0, (int)strm.Length);
            InMemoryRandomAccessStream ras = new InMemoryRandomAccessStream();

            ras.GetOutputStreamAt(0).WriteAsync(bts.AsBuffer());
            //strm.CopyToAsync(ras.AsStreamForWrite()).Wait();

            ras.Seek(0);
            bitmap = new BitmapImage();
            bitmap.SetSource(ras);
            ras.Dispose();
            strm.Dispose();
        }