Tag: windows rt

缩放用户控件中的裁剪像素

我开发了一个用户控件。 用户控制就像一个放大镜玻璃。 用户控件具有图像按钮,其显示逐像素裁剪的图像。 StorageFile storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(“ms-appx:///Assets/wallpaper.jpg”, UriKind.RelativeOrAbsolute)); using (Windows.Storage.Streams.IRandomAccessStream fileStream = await storageFile.OpenAsync(FileAccessMode.Read)) { BitmapImage bitmapImage = new BitmapImage(); await bitmapImage.SetSourceAsync(fileStream); WriteableBitmap writeableBitmap = new WriteableBitmap(bitmapImage.PixelWidth, bitmapImage.PixelHeight); fileStream.Seek(0); await writeableBitmap.SetSourceAsync(fileStream); writeableBitmap = writeableBitmap.Crop(Convert.ToInt32(xValue), Convert.ToInt32(yValue), 100, 100); MagnifyTip.image1.ImageSource = writeableBitmap; 现在,MagnifyTip.image1具有一个设置为裁剪图像的图像源。 我的要求是缩放裁剪区域,然后将其指定给图像源。 用户控件看起来像这样 帮助将不胜感激

从canvas保存的图像无法正确呈现

我正在尝试使用以下代码将myCanvas的内容保存为库中的图像文件(对于Windows Phone 8.1,而不是Silverlight)。 当我运行应用程序时,图像被保存但是它被扭曲了。 我究竟做错了什么? 我上传了结果图像和预期结果。 public async void SaveFileToPhone() { var file = await KnownFolders.PicturesLibrary.CreateFileAsync(“bug.png”, CreationCollisionOption.GenerateUniqueName); await SaveVisualElementToFile(myCanvas, file); } async Task SaveVisualElementToFile(FrameworkElement element, StorageFile file) { var renderTargetBitmap = new RenderTargetBitmap(); await renderTargetBitmap.RenderAsync(element, (int)element.Width, (int)element.Height); var pixels = await renderTargetBitmap.GetPixelsAsync(); txt_bug.Text = “Width: ” + (int)element.Width + ” Height:” + (int)element.Height; using (IRandomAccessStream […]

无法接收UDP Windows RT

我正在为Windows 8 / RT编写一个Windows Store / Metro / Modern / RT应用程序,它需要在端口49030上接收UDP数据包,但我似乎无法接收任何数据包。 我已经按照教程使用DatagramSocket来写信了,我什么也没得到。 我知道我的发送程序正在发送数据,因为我可以在wireshark上看到它。 我还编写了一个测试C#控制台应用程序,它使用通过UDP正确接收数据的常规BSD套接字API(System.Net.Sockets.Socket)。 这是有效的代码: Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); s.Bind(new IPEndPoint(IPAddress.Any, 49030)); byte[] buf = new byte[5000]; while (true) { Console.WriteLine(“Received ” + s.Receive(buf) + ” bytes.”); } 这将输出报告正在发送的字节数的行,如预期的那样。 我的RT应用程序代码: public async void StartListening() { DatagramSocket s = new DatagramSocket(); s.MessageReceived += […]

关闭Windows 8 Charm Bar

我有一个Surface Pro,我需要“锁定”作为一种Kiosk模式。 我知道有一个更新正在为“Kiosk模式”..但是我需要在此之前这样做。 我在互联网上搜索过,但看起来你无法通过屏幕上的滑动禁用魅力栏。 我已经找到了禁用触控板的方法..但不幸的是,由于这款平板电脑将在没有键盘的情况下使用,我需要禁用魅力吧。 我的新想法是将整个Charm条HWND移出屏幕数千个像素,或者,可能在其上设置一个窗口样式,以便它不会出现。 我试图使用Spy ++和一个基于EnumWindows的自定义控制台应用程序来给我一些Window句柄..但是我无法让Charm栏保持足够长的时间以使它们生效。 所以我的问题是:如何在Windows 8中找到Charm Bar的窗口句柄( HWND )? 或者,如何以其他方式获取对Charm栏的引用以便在其上抛出SetWindowLong或SetWindowPos ?

如何在Windows 10应用程序中实施应用程序内购买?

我想在我的Windows通用应用程序中集成应用程序内购买。 我在编码之前做了以下事情。 在Windows开发人员中心制作应用程序 在IAP部分添加包含详细信息的产品,并提交到商店,如图所示 之后,我在我的应用程序中使用以下代码获取应用程序内购买产品列表和购买产品按钮。 我在我的代码中也使用了CurrentApp而不是CurrentAppSimulator ,但它是exception的。 private async void RenderStoreItems() { picItems.Clear(); try { //StoreManager mySM = new StoreManager(); ListingInformation li = await CurrentAppSimulator.LoadListingInformationAsync(); System.Diagnostics.Debug.WriteLine(li); foreach (string key in li.ProductListings.Keys) { ProductListing pListing = li.ProductListings[key]; System.Diagnostics.Debug.WriteLine(key); string status = CurrentAppSimulator.LicenseInformation.ProductLicenses[key].IsActive ? “Purchased” : pListing.FormattedPrice; string imageLink = string.Empty; picItems.Add( new ProductItem { imgLink = […]

Windows RT和c#

我需要使用C#和XAML开发Metro风格应用程序,它必须在Windows RT设备和完整的Windows 8操作系统上运行。 所以我只允许在没有任何.net框架程序集的情况下使用WinRT。 我读过这个问题 Microsoft Surface Tablet:为两种设备编写应用程序? 这个非常有用的post: http : //blogs.msdn.com/b/jasonz/archive/2012/06/12/what-you-need-to-know-about-developing-for-windows-on-arm- woa.aspx ,但我仍然有疑问:当我甚至创建一个空白的Metro风格应用程序项目时,我有.NET组合地铁风格。 我是自己删除它还是做错了什么? 如果需要使用像Prism fw移植到WinRT或mvvvm光的东西我该怎么办? 它们是否允许我仅在本机WinRT上开发WOA应用程序? 这些时刻对我来说并不清楚。 你能解释我在ARM上的Windows RT和Windows之间的区别我是否只需要使用WinRT(不带.net)来开发WindowsRT操作系统? 希望您能够帮助我。