How to pick an Image and crop it before upload? - c#

I need to pick an image from photo galley or take new one, and after that crop the image by x*x (like Skype profile image picker for windows phone) and save it. I am developing an universal windows app with c# for windows 10 mobile and desktop.
I need use tools that the OS give me . and before in windows 8 and 8.1 there was PhotoChooserTask for this work but not in UWP windows 10
in screen there is a camera button for take new image or choose one of Photos and after pick one of them we can crop it.

You can use the FileOpenPicker to let the end user choose a picture :
var picker = new FileOpenPicker();
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
And then use XamlCropControl to let him crop the picture
https://xamlcropcontrol.codeplex.com/

Related

Touchscreen friendly file picker in Windows 10

I am looking for a touchscreen-friendly file picker for Windows 10. In Windows 8 and 8.1, i used FileOpenPicker:
FileOpenPicker fileOpenPicker = new FileOpenPicker();
fileOpenPicker.FileTypeFilter.Add(".wma");
fileOpenPicker.FileTypeFilter.Add(".mp3");
fileOpenPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
fileOpenPicker.ViewMode = PickerViewMode.List;
IReadOnlyList<StorageFile> files = await fileOpenPicker.PickMultipleFilesAsync();
which produced a nice interface (example), but in Windows 10, the same code displays the same interface as OpenFileDialog would (example), which is very hard to use on a touchscreen. Does anyone know how to get Windows 8/8.1 style FileOpenPicker in Windows 10, or knows an alternative?
In my application I have ask user to select folder (with standard folder picker that is not much touch friendly), but after this I have shown my own custom control that have display files in folder and let them select in touch friendly manner.

How can I open an image in the default photos app?

I have an app that captures images from the device's camera and saves them as StorageFiles to a folder in my app's roaming data. I've been trying to make a page that will open the image and show a preview, but I've been having many problems doing that, so I want to just open the image in the default photos app. However, I can't find any way to do that. Using await Launcher.LaunchUriAsync(new Uri(#"ms-appdata:///roaming/folder/img.jpg")); asks if I want to search for an app in the Store (searches for "ms-appdata"). Does the native Photos app for Windows (Phone) have a dedicated URI scheme? Also, I am targeting Windows 10 with this app, so the URI schemes (if any) may have changed.
Launcher.LaunchUriAsync is for launching an application using the URI scheme, this is not what you want.
Instead you'll want to launch an app based on a file:
Get the image as a StorageFile
var imageFile = await StorageFile.GetFileFromPathAsync(#"ms-appdata:///roaming/folder/img.jpg");
Then you tell the OS to launch an app to handle that file. It's then up to the user to choose which app to handle the image file:
var success = await Windows.System.Launcher.LaunchFileAsync(imageFile);
You can read more about "launching" files here.

bitmap image saving as blank image

I need to capture client screen so i reffered http://www.csharphelp.com/2006/11/capturing-the-screen-image-using-c/
its working fine on local but on server my image is saving as blank image
System.Drawing.Bitmap outputImage = CaptureScreen.CaptureScreen.GetDesktopImage();
string path = HttpContext.Current.Server.MapPath("~/" + "Corporate/testimages/ab1.png");
outputImage.Save(path);
help me out thanks in advance...
I think the problem is, that your application is running by an user without a desktop environment.
There are detected Windows Users for something like Web Applications and this user doesn't have an screen.
You should think about extracting the Screening process in a separate program.
EDIT:
Kratika doesn't want to screen the clients screen, (s)he wants to screen an other website and provide the download link.

So there is no way to access videos on Windows Phone 8?

I need to access videos on camera roll and also on Music+Video. but it seems there is no way at all.
Here in the documentation says we can use:
MediaLibrary library = new MediaLibrary();
But it only can access musics.
Can we say I should forget this thing for ever in WP8?
Unfortunately, there is no way to access videos in Media Library.
You have read-write access only to audio and photos.
See this answer: https://stackoverflow.com/a/13473349/1029518
There are a couple answers in the following thread which points out it is now feasible to read the video files via KnownFolders if you upgrade to Windows Phone 8.1: Windows Phone 8: Media file access
Here is an alternative option for accessing the videos (also in Windows Phone 8.1):
FileOpenPicker picker = new FileOpenPicker();
picker.ViewMode = PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
picker.FileTypeFilter.Add(".mp4");
picker.PickSingleFileAndContinue();
Once you have the file you should be able to play it back.

windows phone 7 Download files and save it in phone storage

am developing an application which can fetch files from internet.. how do i download and save a "docx" or "wav" file from internet within the application and use it later with other application likes office or windows media player.
You can download files in the background (ie. they will continue even when your application is not running).
Having said that, you should research the types of files you need to support. For example, you can play an audio file (if the format is supported) or add it to Music hub but you cannot open a file in Office. Very few filetypes can be integrated with, so do some research before you start writing your app otherwise you might be disappointed.
place an image control in your page. here im1 is controls name.
it is working for me
string imgurl="http://.........";(path)
Uri addrs=new Uri(imgurl,UriKind.Absolute);
BitmapImage bitmap = new BitmapImage(addrs);
im1.Source = bitmap;

Categories

Resources