Allow users to select objects using pickers
C#using CI.WSANative.Pickers;
Returns an object that wraps the native StorageFile representing the chosen file
You can access the underlying StorageFile by using the result.OriginalFile property but any calls to this must be wrapped in a ENABLE_WINMD_SUPPORT block as it is not editor safe
Use result.ReadBytes() and result.ReadText() to read the files content - calls to these functions should be wrapped in a try catch block
C#WSANativeFilePicker.PickSingleFile("Select", WSAPickerViewMode.Thumbnail, WSAPickerLocationId.PicturesLibrary, new[] { ".png", ".jpg" }, result =>
{
if (result != null)
{
byte[] fileBytes = result.ReadBytes();
string fileString = result.ReadText();
}
});
Returns a list of objects that wraps the native StorageFile representing the chosen file
You can access the underlying StorageFile by using the result.OriginalFile property but any calls to this must be wrapped in a ENABLE_WINMD_SUPPORT block as it is not editor safe
Use result.ReadBytes() and result.ReadText() to read the files content - calls to these functions should be wrapped in a try catch block
C#WSANativeFilePicker.PickMultipleFiles("Select", WSAPickerViewMode.Thumbnail, WSAPickerLocationId.PicturesLibrary, new[] { ".png", ".jpg" }, result =>
{
if (result != null)
{
foreach (WSAStorageFile file in result)
{
byte[] fileBytes = file.ReadBytes();
string fileString = file.ReadText();
}
}
});
Returns an object that wraps the native StorageFile representing the chosen file
You can access the underlying StorageFile by using the result.OriginalFile property but any calls to this must be wrapped in a ENABLE_WINMD_SUPPORT block as it is not editor safe
Use result.WriteBytes() and result.WriteText() to write the files content - calls to these functions should be wrapped in a try catch block
C#WSANativeFilePicker.PickSaveFile("Save", ".jpg", "Test Image", WSAPickerLocationId.DocumentsLibrary, new List<KeyValuePair<string, IList<string>>>() { new KeyValuePair<string, IList<string>>("Image Files", new List<string>() { ".png", ".jpg" }) }, result =>
{
if (result != null)
{
result.WriteBytes(new byte[2]);
result.WriteText("Hello World");
}
});
Returns an object that wraps the native StorageFolder representing the chosen folder
You can access the underlying StorageFolder by using the result.OriginalFolder property but any calls to this must be wrapped in a ENABLE_WINMD_SUPPORT block as it is not editor safe
The result have various options for accessing files and folders in the selected folder
C#WSANativeFolderPicker.PickSingleFolder("Ok", WSAPickerViewMode.List, WSAPickerLocationId.DocumentsLibrary, null, result =>
{
if (result != null)
{
}
});
Returns an object that wraps the native Contact representing the chosen contact
You can access the underlying Contact by using the result.OriginalContact property but any calls to this must be wrapped in a ENABLE_WINMD_SUPPORT block as it is not editor safe
C#WSANativeContactPicker.PickContact(result =>
{
if (result != null)
{
string fullName = result.FullName;
}
});
Returns a list of objects that wraps the native Contact representing the chosen contact
You can access the underlying Contact by using the result.OriginalContact property but any calls to this must be wrapped in a ENABLE_WINMD_SUPPORT block as it is not editor safe
C#WSANativeContactPicker.PickContacts(result =>
{
if (result != null)
{
foreach (WSAContact contact in result)
{
string fullName = result.FullName;
}
}
});