Ejemplo n.º 1
0
        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();
                }
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        private void CopySprite()
        {
            SpriteControl sprite = null;

            if (SpriteControl.SelectedSprite.SpriteType == SpriteType.Photo)
            {
                if (ExistingPhotoCount >= PhotoCountMax)
                {
                    lightTip.ShowTip("最多 9 张照片哦!");
                    return;
                }

                sprite = new SpriteControl(SpriteType.Photo);
                sprite.SetImage(SpriteControl.SelectedSprite.ImageSource);
            }
            else if (SpriteControl.SelectedSprite.SpriteType == SpriteType.Material)
            {
                sprite = new SpriteControl(SpriteType.Material);
                sprite.SetImage(SpriteControl.SelectedSprite.ImageSource);
            }
            else if (SpriteControl.SelectedSprite.SpriteType == SpriteType.Text)
            {
                sprite = new SpriteControl(SpriteType.Text);
                sprite.EditingStarted      += sprite_EditingStarted;
                sprite.EditingEnded        += sprite_EditingEnded;
                sprite.spriteText.Text      = selectedSpriteText.Text;
                sprite.spriteText.TextColor = selectedSpriteText.TextColor;
                sprite.spriteText.Font      = selectedSpriteText.Font;
            }

            sprite.AddToContainer();

            App.CurrentInstance.OpertationPageChanged = true;

            if (sfxEnabled)
            {
                PlaySFX();
            }
        }