private void Button_Click(object sender, RoutedEventArgs e) { try { ToSaveAwayPlayerListBox.Visibility = Visibility.Visible; var bmp = new WriteableBitmap(Convert.ToInt32(ToSaveAwayPlayerListBox.ActualWidth), Convert.ToInt32(ToSaveAwayPlayerListBox.ActualHeight)); bmp.Render(ToSaveAwayPlayerListBox, null); bmp.Invalidate(); var width = (int)ToSaveAwayPlayerListBox.ActualWidth; var height = (int)ToSaveAwayPlayerListBox.ActualHeight; using (var ms = new MemoryStream(width * height * 4)) { bmp.SaveJpeg(ms, width, height, 0, 100); ms.Seek(0, SeekOrigin.Begin); var lib = new MediaLibrary(); var picture = lib.SavePicture(string.Format("uTrackSoccer_GameStats"), ms); var task = new ShareMediaTask(); task.FilePath = picture.GetPath(); task.Show(); } ToSaveAwayPlayerListBox.Visibility = Visibility.Collapsed; } catch (Exception ex) { // Debug.WriteLine(ex.ToString()); } }
void photoChooserTask_Completed(object sender, PhotoResult e) { ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = e.OriginalFileName; shareMediaTask.Show(); }
void ShowShareMediaTask(string path) { ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = path; shareMediaTask.Show(); }
private void btnOk_Click(object sender, RoutedEventArgs e) { WriteableBitmap wb = new WriteableBitmap(msgCanvas, new ScaleTransform()); wb.Render(msgCanvas, new ScaleTransform()); wb.Invalidate(); //save the image using (var ms = new MemoryStream()) { wb.SaveJpeg(ms, (int)msgCanvas.Width, (int)msgCanvas.Height, 0, 100); ms.Seek(0, SeekOrigin.Begin); var lib = new MediaLibrary(); var picture = lib.SavePicture(string.Format("img.jpg"), ms); var toast = new ToastPrompt { Title = "St!ck!es", Message = "Image saved to Saved Pictures", ImageSource = new BitmapImage(new Uri("..\\Ok.png", UriKind.RelativeOrAbsolute)) }; toast.Completed += toast_Completed; toast.Show(); var task = new ShareMediaTask(); task.FilePath = picture.GetPath(); task.Show(); } }
void PhotoChooserTaskCompleted(object sender, PhotoResult e) { var share_media = new ShareMediaTask { FilePath = e.OriginalFileName }; share_media.Show(); }
private static void Share(string media) { ShareMediaTask mediaTask = new ShareMediaTask(); mediaTask.FilePath = media; mediaTask.Show(); }
private void AppBarShareButton_Click(object sender, EventArgs e) { // To share an image through the ShareMediaTask it need to be saved locally // Here we need the path of the saved image to deliver it to the MediaShareTask ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = SaveImage(); shareMediaTask.Show(); }
private void ExecuteSendCommand(object obj) { byte[] b = Extensions.Extensions.ImageToBytes(Collage); MediaLibrary lib = new MediaLibrary(); Picture picture = lib.SavePicture("test.jpg", b); ShareMediaTask task = new ShareMediaTask(); task.FilePath = picture.GetPath(); task.Show(); }
private void ct_Completed(object sender, PhotoResult e) { if (e.ChosenPhoto != null) { BitmapImage bmp = new BitmapImage(); bmp.SetSource(e.ChosenPhoto); MyImage.Source = bmp; ShareMediaTask smt = new ShareMediaTask(); smt.FilePath = e.OriginalFileName; smt.Show(); } }
public void SharePhoto() { #if WP8 SavePhotoAsync(path => { var task = new ShareMediaTask { FilePath = path }; task.Show(); }); #endif }
private void ShareExecute() { using (var fileStream = _isoStore.CreateFile(SharedFileName)) { MainImage.SaveJpeg(fileStream, ImageWidth, ImageHeight, 0, 100); var task = new ShareMediaTask { FilePath = SharedFileName }; task.Show(); } }
private void AskToShare(object sender, EventArgs e) { try { ShareMediaTask task = new ShareMediaTask(); task.FilePath = ScreenShot.Take(LayoutRoot).GetPath(); task.Show(); } catch (Exception ex) { MessageBox.Show("Sorry we can't share at the moment"); } }
private void ShareExecute() { using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication()) using (var fileStream = isoStore.CreateFile(SharedFileName)) { BlendedImage.SaveJpeg(fileStream, BlendedImage.PixelWidth, BlendedImage.PixelHeight, 0, 100); var task = new ShareMediaTask { FilePath = SharedFileName }; task.Show(); } }
private async void ApplicationBarIconButton_Click_1(object sender, EventArgs e) { MediaLibrary mediaLibrary = new MediaLibrary(); string url = models.Data.item.image; HttpClient client = new HttpClient(); byte[] responseBytes = await client.GetByteArrayAsync(url); var picture = mediaLibrary.SavePicture(Path.GetFileName(models.Data.item.image), responseBytes); Microsoft.Phone.Tasks.ShareMediaTask smt = new ShareMediaTask(); smt.FilePath = picture.GetPath(); smt.Show(); }
void btnShareShareTask_Click(object sender, EventArgs e) { ShareMediaTask shareMediaTask = new ShareMediaTask(); if (null != item.UserImages && item.UserImages.Count > 0) { shareMediaTask.FilePath = string.Format("{0}", item.UserImages[0]); } else { shareMediaTask.FilePath = string.Format("{0}", item.GetImageUri()); } shareMediaTask.Show(); }
private void InitialiseCommands() { this.OpenPhotoCommand = new RelayCommand(() => { PhotoChooserTask photoChooser = new PhotoChooserTask { ShowCamera = true }; photoChooser.Completed += PickImageCallback; photoChooser.Show(); }); this.SavePhotoCommand = new RelayCommand(() => { this.Message = Resources.AppResources.SavingPhotoText; this.IsBusy = true; this.modifiedFileName = "KollageBurst_" + DateTime.Now.ToString("ddMMyyyy_HHmm"); this.ModifiedPhoto.PhotoImage.SaveToMediaLibrary(this.modifiedFileName); MessageBox.Show(Resources.AppResources.PhotoSavedConfirmationText); this.IsBusy = false; GoogleAnalytics.EasyTracker.GetTracker().SendEvent("Photo saved", "User saved photo.", string.Empty, 0); }, () => this.ModifiedPhoto != null); this.ShowSettingsCommand = new RelayCommand(() => { Messenger.Default.Send <NavigateToPageMessage>(new NavigateToPageMessage("SettingsPage")); }); this.SharePhotoCommand = new RelayCommand(() => { if (String.IsNullOrEmpty(this.modifiedFileName)) { this.SavePhotoCommand.Execute(null); } ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = System.IO.Path.Combine(this.SavePicturesPath, this.modifiedFileName) + ".jpg"; shareMediaTask.Show(); GoogleAnalytics.EasyTracker.GetTracker().SendEvent("Photo shared", "User shared photo.", string.Empty, 0); }, () => this.ModifiedPhoto != null); this.ShowAboutPageCommand = new RelayCommand(() => { MessageBox.Show("Created by beetrootSOUP"); }); }
public void shareVia(string jsonArgs) { var options = JsonHelper.Deserialize<string[]>(jsonArgs); var type = options[4]; var message = options[0]; var title = options[1]; var image = JsonHelper.Deserialize<string[]>(options[2]); if (!"null".Equals(image) && "image".Equals(type)) { ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = image[0]; shareMediaTask.Show(); } DispatchCommandResult(new PluginResult(PluginResult.Status.OK)); }
public void shareVia(string jsonArgs) { var options = JsonHelper.Deserialize <string[]>(jsonArgs); var type = options[4]; var message = options[0]; var title = options[1]; var image = JsonHelper.Deserialize <string[]>(options[2]); if (!"null".Equals(image) && "image".Equals(type)) { ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = image[0]; shareMediaTask.Show(); } DispatchCommandResult(new PluginResult(PluginResult.Status.OK)); }
private void Button_Click(object sender, RoutedEventArgs e) { try { // var bmp = new WriteableBitmap(AwayPlayerGrid, null); // var width = (int)bmp.PixelWidth; // var height = (int)bmp.PixelHeight; comingFromSendScreen = true; ToSaveAwayPlayerListBox.Visibility = Visibility.Visible; // System.Threading.Thread.Sleep(1000); var bmp = new WriteableBitmap(Convert.ToInt32(ToSaveAwayPlayerListBox.ActualWidth), Convert.ToInt32(ToSaveAwayPlayerListBox.ActualHeight)); bmp.Render(ToSaveAwayPlayerListBox, null); bmp.Invalidate(); var width = (int)ToSaveAwayPlayerListBox.ActualWidth; var height = (int)ToSaveAwayPlayerListBox.ActualHeight; using (var ms = new MemoryStream(width * height * 4)) { bmp.SaveJpeg(ms, width, height, 0, 100); ms.Seek(0, SeekOrigin.Begin); var lib = new MediaLibrary(); var picture = lib.SavePicture(string.Format("TimeLine.jpg"), ms); //ShareLinkTask a = new ShareLinkTask(); //string test = @"<a href=""http://www.utracksports.com"" target=""_blank"" <img src=""" + picture.GetPath().ToString() + @""" />"; //a.LinkUri = new Uri(test, UriKind.Absolute); //a.Show(); var task = new ShareMediaTask(); task.FilePath = picture.GetPath(); task.Show(); } ToSaveAwayPlayerListBox.Visibility = Visibility.Collapsed; } catch (Exception ex) { //Debug.WriteLine(ex.ToString()); } }
private async Task Share(StorageFile file) { var ml = new MediaLibrary(); Picture pic = null; using (var stream = await m_selectedFile.OpenStreamForReadAsync()) { pic = ml.SavePicture("Shared_" + m_selectedFile.Name, stream); stream.Close(); } ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = pic.GetPath(); shareFileName = shareMediaTask.FilePath; shareMediaTask.Show(); }
void WebClientOpenReadShareCompleted(object sender, OpenReadCompletedEventArgs e) { const string tempJpeg = "TempJPEG"; var streamResourceInfo = new StreamResourceInfo(e.Result, null); var userStoreForApplication = IsolatedStorageFile.GetUserStoreForApplication(); if (userStoreForApplication.FileExists(tempJpeg)) { userStoreForApplication.DeleteFile(tempJpeg); } var isolatedStorageFileStream = userStoreForApplication.CreateFile(tempJpeg); var bitmapImage = new BitmapImage { CreateOptions = BitmapCreateOptions.None }; bitmapImage.SetSource(streamResourceInfo.Stream); var writeableBitmap = new WriteableBitmap(bitmapImage); writeableBitmap.SaveJpeg(isolatedStorageFileStream, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight, 0, 85); isolatedStorageFileStream.Close(); isolatedStorageFileStream = userStoreForApplication.OpenFile(tempJpeg, FileMode.Open, FileAccess.Read); // Save the image to the camera roll or saved pictures album. var mediaLibrary = new MediaLibrary(); // Save the image to the saved pictures album. var picture = mediaLibrary.SavePicture(string.Format("FbViral-SavedPicture{0}.jpg", DateTime.Now), isolatedStorageFileStream); isolatedStorageFileStream.Close(); var shareMediaTask = new ShareMediaTask(); shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = picture.GetPath(); // requires using Microsoft.Xna.Framework.Media.PhoneExtensions; shareMediaTask.Show(); progressIndicator.Text = AppResources.PhotoDownloadedSuccessfully; progressIndicator.IsVisible = false; progressIndicator.IsIndeterminate = false; }
public void sharePicture(string jsonArgs) { try { var options = JsonHelper.Deserialize <string[]>(jsonArgs); string path = options[0]; Microsoft.Phone.Tasks.ShareMediaTask smt = new ShareMediaTask(); smt.FilePath = path; smt.Show(); DispatchCommandResult(new PluginResult(PluginResult.Status.OK, path)); } catch (Exception ex) { DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, ex.Message)); } }
public void Share(string path) { var file = this.GetService <IMvxSimpleFileStoreService>(); using (var ms = new MemoryStream()) { file.TryReadBinaryFile(path, stream => { stream.CopyTo(ms); return(true); }); ms.Seek(0, SeekOrigin.Begin); var lib = new MediaLibrary(); var picture = lib.SavePicture(string.Format("test.jpg"), ms); var task = new ShareMediaTask(); task.FilePath = picture.GetPath(); task.Show(); } }
public void Share(Stream fileStream) { if (fileStream == null) { return; } var photoUrl = Guid.NewGuid().ToString(); //.jpg will be added automatically var mediaLibrary = new MediaLibrary(); var picture = mediaLibrary.SavePicture(photoUrl, fileStream); #if WP8 var task = new ShareMediaTask { FilePath = picture.GetPath() }; task.Show(); #endif }
#pragma warning restore 0067 public async void Execute(object parameter) { var item = parameter as FeaturedEventsSchema; if (item != null) { var result = await ImageServices.ChoosePhoto(); if (result.Error != null || result.TaskResult != Microsoft.Phone.Tasks.TaskResult.OK) { return; } else { ShareMediaTask smt = new ShareMediaTask(); smt.FilePath = result.OriginalFileName; smt.Show(); } } }
public PhotoPage() { InitializeComponent(); _cameraCaptureTask.Completed += _cameraCaptureTask_Completed; this.OrientationChanged += PhotoPage_OrientationChanged; library = new MediaLibrary(); Loaded += PhotoPage_Loaded; LoadAppBar(); App.colorText = Colors.White; App.txtArtistSize = 55; App.txtSongSize = 55; App.txtNowPlayingSize = 32; App.txtTimeSize = 32; App.txtAddressSize = 32; App.txtLyricsSize = 23; cameBack = false; savedPicture = false; try { App.txtNowPlaying = "#NowPlaying"; App.txtArtist = MediaPlayer.Queue.ActiveSong.Artist.Name; App.txtSong = MediaPlayer.Queue.ActiveSong.Name; App.txtLyrics = String.Empty; } catch (Exception) {} mediaTask = new ShareMediaTask(); pictureTask = new PhotoChooserTask(); pictureTask.Completed += pictureTask_Completed; watcher = new GeoCoordinateWatcher(); watcher.MovementThreshold = 500; watcher.PositionChanged += watcher_PositionChanged; watcher.StatusChanged += watcher_StatusChanged; }
public void Share() { #if WP8 var message = CurrentItem as TLMessage; if (message == null) { return; } var mediaPhoto = message.Media as TLMessageMediaPhoto; if (mediaPhoto != null) { SavePhotoAsync(mediaPhoto, path => { var task = new ShareMediaTask { FilePath = path }; task.Show(); }); } #endif }
public void Share(byte[] data, string dataFilename, string text, string title, string desc, SocialShareDataTypes type) { #if WINDOWS_PHONE if (data != null) { string filename; using (var m = new MediaLibrary()) using (var image = m.SavePicture(dataFilename + (type == SocialShareDataTypes.Image_PNG ? ".png" : ".jpg"), data)) { filename = MediaLibraryExtensions.GetPath(image); } var shareTask = new ShareMediaTask(); shareTask.FilePath = filename; shareTask.Show(); } else if (!string.IsNullOrEmpty(text)) { var shareTask = new ShareStatusTask(); shareTask.Status = text; shareTask.Show(); } #else shareText = text; shareTitle = title; shareDesc = desc; if (data != null) { shareImage = true; shareDataFilename = dataFilename + (type == SocialShareDataTypes.Image_PNG ? ".png" : ".jpg"); StreamManager.SaveFile(shareDataFilename, data, FolderLocations.Storage, imageSavedCallback); } else { imageSavedCallback(true); } #endif }
public void Share(byte[] data, string dataFilename, string text, string title, string desc, SocialShareDataTypes type) { #if WINDOWS_PHONE if (data != null) { string filename; using (var m = new MediaLibrary()) using (var image = m.SavePicture(dataFilename + (type == SocialShareDataTypes.Image_PNG ? ".png" : ".jpg"), data)) { filename = MediaLibraryExtensions.GetPath(image); } var shareTask = new ShareMediaTask(); shareTask.FilePath = filename; shareTask.Show(); } else if (!string.IsNullOrEmpty(text)) { var shareTask = new ShareStatusTask(); shareTask.Status = text; shareTask.Show(); } #else shareText = text; shareTitle = title; shareDesc = desc; if (data != null) { shareImage = true; shareDataFilename = dataFilename + (type == SocialShareDataTypes.Image_PNG ? ".png" : ".jpg"); StreamManager.SaveFile(shareDataFilename, data, FolderLocations.Storage, imageSavedCallback); } else { imageSavedCallback(true); } #endif }
void wc_OpenReadCompleted_4Share(object sender, OpenReadCompletedEventArgs e) { try { using (Stream stream = e.Result) { MediaLibrary mediaLibrary = new MediaLibrary(); Picture pic = mediaLibrary.SavePicture(NavigationContext.QueryString["name"] + ".jpg", stream); var task = new ShareMediaTask(); task.FilePath = pic.GetPath(); task.Show(); } } catch (Exception) { MessageBox.Show("Resim paylaşılmak üzere telefonunuza indirilemedi. Lütfen tekrar deneyin."); } }
void btnShareShareTask_Click(object sender, EventArgs e) { ShareMediaTask shareMediaTask = new ShareMediaTask(); if (null != item.UserImages && item.UserImages.Count > 0) shareMediaTask.FilePath = string.Format("{0}", item.UserImages[0]); else shareMediaTask.FilePath = string.Format("{0}", item.GetImageUri()); shareMediaTask.Show(); }
private void ShareButtonClick(object sender, EventArgs e) { var mediaLibrary = new MediaLibrary(); var latestPicture = mediaLibrary.Pictures.Where(x => x.Name.Contains("PixImg_")).OrderByDescending(x => x.Date).FirstOrDefault(); if (latestPicture == null) return; var shareMediaTask = new ShareMediaTask { FilePath = latestPicture.GetPath(), }; shareMediaTask.Show(); }
private void btnShare_Click(object sender, System.EventArgs e) { var shareMediaTask = new ShareMediaTask { FilePath = App.ViewModel.SelectedLocation.ImageUri }; shareMediaTask.Show(); }
private void AppBarShareButton_Click(object sender, EventArgs e) { // To share an image through the ShareMediaTask it need to be saved locally // Here we need the path of the saved image to deliver it to the MediaShareTask ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = SaveImage(); shareMediaTask.Show(); }
private void AskToShare(object sender, EventArgs e) { ShareMediaTask task = new ShareMediaTask(); task.FilePath = ScreenShot.Take(LayoutRoot).GetPath(); task.Show(); }
public PhotoPage() { InitializeComponent(); _cameraCaptureTask.Completed += _cameraCaptureTask_Completed; this.OrientationChanged += PhotoPage_OrientationChanged; library = new MediaLibrary(); Loaded += PhotoPage_Loaded; LoadAppBar(); App.colorText = Colors.White; App.txtArtistSize = 55; App.txtSongSize = 55; App.txtNowPlayingSize = 32; App.txtTimeSize = 32; App.txtAddressSize = 32; App.txtLyricsSize = 23; cameBack = false; savedPicture = false; try { App.txtNowPlaying = "#NowPlaying"; App.txtArtist = MediaPlayer.Queue.ActiveSong.Artist.Name; App.txtSong = MediaPlayer.Queue.ActiveSong.Name; App.txtLyrics = String.Empty; } catch (Exception) {} mediaTask = new ShareMediaTask(); pictureTask = new PhotoChooserTask(); pictureTask.Completed += pictureTask_Completed; watcher = new GeoCoordinateWatcher(); watcher.MovementThreshold = 500; watcher.PositionChanged += watcher_PositionChanged; watcher.StatusChanged += watcher_StatusChanged; }
void btnShareShareTask_Click(object sender, EventArgs e) { ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = string.Format("", item.GetImageUri()); shareMediaTask.Show(); }
public void Share(string path) { var file = this.GetService<IMvxSimpleFileStoreService>(); using (var ms = new MemoryStream()) { file.TryReadBinaryFile(path, stream => { stream.CopyTo(ms); return true; }); ms.Seek(0, SeekOrigin.Begin); var lib = new MediaLibrary(); var picture = lib.SavePicture(string.Format("test.jpg"), ms); var task = new ShareMediaTask(); task.FilePath = picture.GetPath(); task.Show(); } }
public void Share() { #if WP8 var message = CurrentItem as TLMessage; if (message == null) { return; } var mediaPhoto = message.Media as TLMessageMediaPhoto; if (mediaPhoto != null) { var photo = mediaPhoto.Photo as TLPhoto; if (photo == null) { return; } TLPhotoSize size = null; var sizes = photo.Sizes.OfType <TLPhotoSize>(); const double width = 800.0; foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } if (size == null) { return; } var location = size.Location as TLFileLocation; if (location == null) { return; } var fileName = //mediaPhoto.IsoFileName ?? String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); var dataTransferManager = DataTransferManager.GetForCurrentView(); dataTransferManager.DataRequested += (o, args) => { var request = args.Request; request.Data.Properties.Title = "media"; request.Data.Properties.ApplicationName = "Telegram Messenger"; var deferral = request.GetDeferral(); try { var fileToShare = FileUtils.GetLocalFile(fileName);//this.GetImageFileAsync("Sample.jpg"); if (fileToShare == null) { return; } //var storageFileToShare = await this.GetStorageFileForImageAsync("Sample.jpg"); //request.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromStream(fileToShare); //request.Data.SetBitmap(RandomAccessStreamReference.CreateFromStream(fileToShare)); // On Windows Phone, share StorageFile instead of Bitmaps request.Data.SetStorageItems(new List <StorageFile> { fileToShare }); } finally { deferral.Complete(); } }; DataTransferManager.ShowShareUI(); return; SavePhotoAsync(mediaPhoto, path => { var task = new ShareMediaTask { FilePath = path }; task.Show(); }); } #endif }
void ShowShareMediaTask(string path) { ShareMediaTask shareMediaTask = new ShareMediaTask(); MessageBox.Show(path); currentmImg.ImageSource = new BitmapImage(new Uri(path, UriKind.Relative)); //shareMediaTask.FilePath = path; //shareMediaTask.Show(); }
private void Share(string media) { ShareMediaTask mediaTask = new ShareMediaTask(); mediaTask.FilePath = media; mediaTask.Show(); }
public void sharePicture(string jsonArgs) { try { var options = JsonHelper.Deserialize<string[]>(jsonArgs); string path = options[0]; Microsoft.Phone.Tasks.ShareMediaTask smt = new ShareMediaTask(); smt.FilePath = path; smt.Show(); DispatchCommandResult(new PluginResult(PluginResult.Status.OK, path)); } catch (Exception ex) { DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, ex.Message)); } }
private void AskToShare(object sender, EventArgs e) { if (chooseAppsPreview != null) { ShareMediaTask task = new ShareMediaTask(); task.FilePath = ScreenShot.Take(chooseAppsPreview.DisplayPart).GetPath(); task.Show(); } }
private void Button1_Click(object sender, RoutedEventArgs e) { MediaLibrary _mediaLibrary = new MediaLibrary(); using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) { try { //TextBlock newTextBox = new TextBlock(); //newTextBox.FontSize = 30; //newTextBox.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White); //newTextBox.Text = "ScoreSoccer8"; //newTextBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; //newTextBox.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; //newTextBox.FontWeight = FontWeights.Bold; //newTextBox.Opacity = 0.5; //newTextBox.Margin = new Thickness(10); //AwayPlayerGrid.Children.Add(newTextBox); Grid AwayPlayerGrid = new Grid(); var bitmap = new WriteableBitmap(Convert.ToInt32(2000), Convert.ToInt32(400)); // w / h var transform = new TransformGroup(); var st = new ScaleTransform() { ScaleX = 0.5, ScaleY = 0.5, CenterX = (AwayPlayerGrid.ActualWidth / 2.0), CenterY = (AwayPlayerGrid.ActualHeight / 2.0) }; transform.Children.Add(st); bitmap.Render(AwayPlayerGrid, null); bitmap.Invalidate(); String tempJPEG = "logo.jpg"; IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(tempJPEG); // Encode WriteableBitmap object to a JPEG stream. Extensions.SaveJpeg(bitmap, fileStream, bitmap.PixelWidth, bitmap.PixelHeight, 0, 100); fileStream.Close(); fileStream.Dispose(); IsolatedStorageFileStream stream = myIsolatedStorage.OpenFile(tempJPEG, FileMode.Open, FileAccess.Read); Picture picture = _mediaLibrary.SavePictureToCameraRoll("somefile.jpg", stream); ShareMediaTask task = new ShareMediaTask(); task.FilePath = picture.GetPath(); task.Show(); //BorderToSave.Children.Remove(newTextBox); stream.Close(); stream.Dispose(); } catch (Exception ex) { //Debug.WriteLine(ex.ToString()); } } }
//Evento para compartir en redes sociales la nota disponible private void Compartir_Click(object sender, EventArgs e) { ShareMediaTask shareMedia = new ShareMediaTask(); //shareMedia.FilePath = this.PostActual(); shareMedia.Show(); }
// share button clicked private void Share_Click(object sender, RoutedEventArgs e) { if (imageFilePath != null) { //create media share obkject ShareMediaTask a = new ShareMediaTask(); a.FilePath = imageFilePath; Clipboard.SetText(((ListBoxItem)que.SelectedItem).Content.ToString()); MessageBox.Show(SharingStatment); a.Show(); } else MessageBox.Show(NoImage); }
private void AskToShare(object sender, EventArgs e) { WriteableBitmap backBitmap = CreateExport(); if (backBitmap != null) { var width = (int)backBitmap.PixelWidth; var height = (int)backBitmap.PixelHeight; using (var ms = new MemoryStream(width * height * 4)) { backBitmap.SaveJpeg(ms, width, height, 0, 100); ms.Seek(0, SeekOrigin.Begin); var lib = new MediaLibrary(); var name = String.Format("{0:yyyy-MM-dd_hh-mm-ss}.jpg", DateTime.Now); var task = new ShareMediaTask(); try { var picture = lib.SavePicture(String.Format(name), ms); task.FilePath = picture.GetPath(); } catch (NullReferenceException ex) { Debugger.Log(4, "", ex.Message); } task.Show(); } } else { MessageBox.Show(Msg.CANTSHARE); } }
void ShowShareMediaTask(string path) { ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = path; shareMediaTask.Show(); }
private void Button_Tap_1(object sender, System.Windows.Input.GestureEventArgs e) { ShareMediaTask task = new ShareMediaTask(); task.FilePath = ScreenShot.Take(LayoutRoot).GetPath(); task.Show(); }
private void AskToShare(object sender, EventArgs e) { int currentTab = ContentLayout.SelectedIndex; if (listOfPreviews[currentTab] != null && listOfPreviews[currentTab].IsLoaded == true) { try { ShareMediaTask task = new ShareMediaTask(); task.FilePath = ScreenShot.Take(listOfPreviews[currentTab].DisplayPart).GetPath(); task.Show(); } catch (Exception ex) { Debugger.Log(0, "", ex.Message); } } }