I'm developing an application to run on WinPE.
I use C# and WPF(.Net Framework 4.5)
But I face some problems.
I would like to use select file using FileOpenDialog. it is not operated in WinPE(version 6.3)
I tried two way to use FileOpenDialog
System.Windows.Forms.FileOpenDialog - Not happed anything
Microsoft.Win32.FileOpenDialog - Exception Occurred
Another problem is a Image.
I want to use image but some images will not be appeared.
The image has small size under 1KB appear normally. But the image has large size over 400KB do not appear on the screen.
All functions are normally operated on Windows 10 But these problems only appear in WinPE.
How do I solve these problems?
to get the fileDialog running, you need to copy ExplorerFrame.dll from a running windows 10 system. The file is located in system32 folder. keep an eye on the architecture.
You need to add the following registry modification to your WinPE-registry, too. This helped me out with the same issue several months ago. Depending on your app, you'll need to install WinPE-WMI.cab, WinPE-PowerShell.cab, WinPE-NetFx.cab and their language-packs as well. These can be found in MS ADK.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SW\Classes\CLSID\{AE054212-3535-4430-83ED-D501AA6680E6}]
#="Shell Name Space ListView"
[HKEY_LOCAL_MACHINE\SW\Classes\CLSID\{AE054212-3535-4430-83ED-D501AA6680E6}\InProcServer32]
#=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,65,00,78,00,\
70,00,6c,00,6f,00,72,00,65,00,72,00,66,00,72,00,61,00,6d,00,65,00,2e,00,64,\
00,6c,00,6c,00,00,00
"ThreadingModel"="Apartment"
Hello fellow programmers.
I recently made a mistake while using the SQLite-NET package for Windows Phone 8.1. When opening a new SQLiteConnection, I would give as parameter to its constructor the string "data.db", without being actually aware of what was going on under the hood. Later on, I noticed that the file wouldn't be deleted, even if I uninstalled the application (since I would have in my app the same entries that I had before uninstalling it); I assume that I should be using the local folder for application data instead.
However, here is the real question: what the hell is the folder where the data.db file was created? I tried to figure it out with the following piece of code:
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///data.db"));
System.Diagnostics.Debug.WriteLine(file.Path);
and what I got as output of the WriteLine method was the path
C:\Data\SharedData\PhoneTools\AppxLayouts\f7529f24-ba24-4fdb-8353-cff9214180a0VS.Debug_ARM.Valbrand\data.db,
which only got me even more confused. I couldn't find any satisfactory info on this, and I would REALLY like to further my understanding of what happened here.
Thanks in advance!
The path you are looking at is the install directory of your app. You have a Silverlight 8.1 app, so the path is slightly different than a Silverlight 8.0 app, but the articles here and here will help you get a rough understanding.
The recommended usage of this directory is to take the resources that you want backed up out of it on first run and move them to the app data container, so they can be backed up by the system.
C:\Data\SharedData\PhoneTools\AppxLayouts\f7529f24-ba24-4fdb-8353-cff9214180a0VS.Debug_ARM.Valbrand\data.db
This is the path on your phone/emulator.
And This is not the location where you can find in your PC.
this might be a stupid question, but I just can't seem to figure out how to access my text files that I embedded in my app. I know several ways to do it for desktop apps (through searching for ways to do it for rt apps) but have never found a way to do it for rt apps. This has been bugging me for MONTHS!
Anything in your app package can be referred to using an ms-appx:/// URI (the three /// are important), and opened with StorageFile.GetFromApplicationUriAsync (a static method, see http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefile.getfilefromapplicationuriasync.aspx).
You can also get your package's StorageFolder object through Windows.ApplicationModel.Package.InstalledLocation, see http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.package.installedlocation.aspx. Then you use StorageFolder.GetFileAsync (http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefolder.getfileasync.aspx) with a relative pathname.
I'm creating Windows Phone 8 Direct3D application with XAML (C++).
I have to process several files in my C++ code before I can use them. These files are added to the Component project and marked as content.
After I processed them, I want to use them from my XAML C# application.
What path should I use to access these files?
It seems that
ApplicationData.Current.LocalFolder
doesn't contain any of them.
Or what conception should I use in my application to solve the problem?
Those items will be in Windows.ApplicationModel.Package.Current.InstalledLocation but you should copy files to ApplicationData.Current.LocalFolder on first launch.
Pretty much I must find a way to populate image boxes with the corresponding information to the images, if it's possible in a Windows 8/Metro/Store App. I have a database with all the physical paths of the images which are stored on the local computer e.g: "c:\BookImages\spud.jpg". Now when i pull the information from the database with information about the book, I also take the file path of image("c:\BookImages\spud.jpg"). All i need to now do is to fetch the image and display it in a image box. But i do not how to do this, i have been researching for a while now, and I'm coming to the understanding that i cannot select file's from other than the actual install directory of the windows app. Unless i use a FileOpenPicker, which will be a useless for the user to select the folder which contains the images every time they run the app. If anyone has a solution to my problem please let me know it will be much appreciated.
See If all the directories were given access for a win rt app then it would be a security risk
So some specific folder are available try storing user data in there . After that only File Picker can Help.
Heres the link
Folders for winrt
Its a Microsoft policy so Please design app accordingly. You might needd to set capabilities in the app manifest file for some folders. Please go through it :)
The short answer is to have the user pick the folder once and save the StorageFolder in the Windows.Storage.AccessCache.
The long answer is that all this boils down to having your data store in a place that is programmatically accessible.
One option, as Anobik pointed out, is to use either your appdata folders (where you have open access), or something like the Pictures Library, which you can access given a capability in the manifest. This way you don't need to ask the user.
If you use the file picker to let the user select a folder for the data store, he or she has granted permission to access that folder programmatically, including its contained files.
The important thing is that you have to preserve that permission across sessions, which is the purpose of the AccessCache.
Think of a StorageFolder object (and a StorageFile) as an abstraction for a pathname--you never really want to save pathname strings unless you have inherent programmatic access to that location. This isn't true for stuff from the file picker, so you have to use the AccessCache to essentially save the folder reference and its permissions.
Kraig Brockschmidt
Author, Programming Windows 8 Apps with HTML, CSS, and JavaScript, a free ebook from Microsoft Press (also see second edition preview)