windows 8 - Sharing video and photo in metro apps through share charm -


i trying take picture , video within app , trying share through share charm having problem doing that. after take pic ,the share charm says has trouble sharing image. code .can please let me know doing wrong.

namespace temp {     /// <summary>     /// empty page can used on own or navigated within frame.     /// </summary>     public sealed partial class page1 : page     {          private storagefile _photo; // photo file share         private storagefile _video; // video file share              private async void oncapturephoto(object sender, tappedroutedeventargs e)         {             var camera = new cameracaptureui();             var file = await camera.capturefileasync(cameracaptureuimode.photo);              if (file != null)             {                 _photo = file;                 datatransfermanager.showshareui();             }         }            private async void oncapturevideo(object sender, tappedroutedeventargs e)         {             var camera = new cameracaptureui();             camera.videosettings.format = cameracaptureuivideoformat.wmv;             var file = await camera.capturefileasync(cameracaptureuimode.video);              if (file != null)             {                 _video = file;                 datatransfermanager.showshareui();             }         }          void ondatarequested(datatransfermanager sender, datarequestedeventargs args)         {             var request = args.request;               if (_photo != null)             {                 request.data.properties.description = "component photo";                 var reference = windows.storage.streams.randomaccessstreamreference.createfromfile(_photo);                 request.data.properties.thumbnail = reference;                 request.data.setbitmap(reference);                 _photo = null;              }             else if (_video != null)             {                 request.data.properties.description = "component video";                 list<storagefile> items = new list<storagefile>();                 items.add(_video);                 request.data.setstorageitems(items);                 _video = null;             }          }        }           protected override void onnavigatedto(navigationeventargs e)         {              datatransfermanager.getforcurrentview().datarequested += ondatarequested;          }        } 

in order app share, must set title of datapackagepropertyset , @ least 1 of "setxxx" methods. if not, you'll see following message when trying share "there problem data ."

so add request.data.properties.title = "title_of_photo_or_video"; in ondatarequested event.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -