private async void MaterialToSprite() { if (App.CurrentInstance.SelectedMaterial != null) { BitmapImage bi = await ImageHelper.ReadImage(App.CurrentInstance.SelectedMaterial.image); if (App.CurrentInstance.MaterialSelectedBy == WidgetPageType.Shipin) { SpriteControl sprite = new SpriteControl(SpriteType.Material); sprite.SetImage(bi); sprite.AddToContainer(); } else if (App.CurrentInstance.MaterialSelectedBy == WidgetPageType.BianKuang) { imgBiankuang.Source = bi; } else if (App.CurrentInstance.MaterialSelectedBy == WidgetPageType.Beijing) { //imgBeijing.Source = bi; imgBeijingBrush.ImageSource = bi; } App.CurrentInstance.SelectedMaterial = null; App.CurrentInstance.OpertationPageChanged = true; if (sfxEnabled) { PlaySFX(); } } }
private async void AddPhotoToStage(StorageFile file) { string tempFileName = Guid.NewGuid().ToString(); var resizedFile = await ImageHelper.MakeResizedImage(file, tempFileName, Constants.PHOTO_IMPORT_SIZE_MAX); IRandomAccessStream stream = await resizedFile.OpenAsync(FileAccessMode.Read); BitmapImage bi = new BitmapImage(); bi.SetSource(stream); //sprite SpriteControl sprite = new SpriteControl(SpriteType.Photo); sprite.SetImage(bi); sprite.AddToContainer(); //delete tempfile if (resizedFile != file) { await resizedFile.DeleteAsync(); } photoToProcess--; if (photoToProcess == 0) { Busy = false; } }
private void AddTextSprite() { SpriteControl sprite = new SpriteControl(SpriteType.Text); sprite.EditingStarted += sprite_EditingStarted; sprite.EditingEnded += sprite_EditingEnded; sprite.AddToContainer(); App.CurrentInstance.OpertationPageChanged = true; if (sfxEnabled) { PlaySFX(); } }