public void ShowPictureLayout(PictureLayouts pl, List <string> img_files)
        {
            bdrPicLay.Child = null;
            //if (pl == PictureLayouts.JustOne)
            //{
            //    //bdrPicTool.Visibility = Visibility.Collapsed;
            //    dpPicInfo.Visibility = Visibility.Visible;
            //    spJustOneTool.Visibility = Visibility.Visible;
            //}
            //else
            //{
            //    //bdrPicTool.Visibility = Visibility.Visible;
            //    dpPicInfo.Visibility = Visibility.Collapsed;
            //    spJustOneTool.Visibility = Visibility.Collapsed;
            //}

            pic_layout = PictureLayoutFactory.GetCreator(pl);
            if (pic_layout == null)
            {
                return;
            }

            List <ImageSource> imgSrc_list = new List <ImageSource>();

            foreach (string fp in img_files)
            {
                var img_src = this.GetImageSource(fp);

                imgSrc_list.Add(img_src);
            }

            try
            {
                this.m_ImageGrid = pic_layout.CreateLayout(imgSrc_list);
            }
            catch (ArgumentException ex)
            {
                this.PopupMessage.ShowErrorMessage(ex.Message, "图片编辑");
                return;
            }
            catch (Exception ex)
            {
                this.PopupMessage.ShowErrorMessage(ex.Message, "异常编辑");
                return;
            }

            bdrPicLay.Child = this.m_ImageGrid;

            this.ShowLayoutMergeTool();
            btnSaveImage.IsEnabled = false;
        }
Exemple #2
0
        public static int GetMinImageCount(PictureLayouts pl)
        {
            int count = 1;

            switch (pl)
            {
            case PictureLayouts.JustOne:
                count = 1;
                break;

            case PictureLayouts.UpDown:
            case PictureLayouts.LeftRight:
            case PictureLayouts.LeftUp:
            case PictureLayouts.RightUp:
            case PictureLayouts.LeftDown:
            case PictureLayouts.RightDown:
                count = 2;
                break;

            case PictureLayouts.UpOneDownTwo:
            case PictureLayouts.LeftOneRightTwo:
            case PictureLayouts.ThreeHorizontal:
            case PictureLayouts.ThreeVertical:
            case PictureLayouts.RightUpTwo:
                count = 3;
                break;

            case PictureLayouts.FourSquare:
            case PictureLayouts.UpOneDownThree:
                count = 4;
                break;

            case PictureLayouts.FiveVertical:
                count = 4;
                break;
            }

            return(count);
        }
Exemple #3
0
        public static IPictureLayout GetCreator(PictureLayouts picLayout)
        {
            IPictureLayout pic_layout = null;

            switch (picLayout)
            {
            case PictureLayouts.JustOne:
                pic_layout = new PictureLayoutJustOne();
                break;

            case PictureLayouts.UpDown:
                pic_layout = new PictureLayoutUpDown();
                break;

            case PictureLayouts.LeftRight:
                pic_layout = new PictureLayoutLeftRight();
                break;

            case PictureLayouts.UpOneDownTwo:
                pic_layout = new PictureLayoutUpOneDownTwo();
                break;

            case PictureLayouts.LeftUp:
                pic_layout = new PictureLayoutLeftUp();
                break;

            case PictureLayouts.RightUp:
                pic_layout = new PictureLayoutRightUp();
                break;

            case PictureLayouts.LeftDown:
                pic_layout = new PictureLayoutLeftDown();
                break;

            case PictureLayouts.RightDown:
                pic_layout = new PictureLayoutRightDown();
                break;

            case PictureLayouts.LeftOneRightTwo:
                pic_layout = new PictureLayoutLeftOneRightTwo();
                break;

            case PictureLayouts.FourSquare:
                pic_layout = new PictureLayoutFourSquare();
                break;

            case PictureLayouts.ThreeVertical:
                pic_layout = new PictureLayoutThreeVertical();
                break;

            case PictureLayouts.ThreeHorizontal:
                pic_layout = new PictureLayoutThreeHorizontal();
                break;

            case PictureLayouts.UpOneDownThree:
                pic_layout = new PictureLayoutUpOneDownThree();
                break;

            case PictureLayouts.RightUpTwo:
                pic_layout = new PictureLayoutRightUpTwo();
                break;

            case PictureLayouts.FiveVertical:
                pic_layout = new PictureLayoutFiveVertical();
                break;

            default:
                pic_layout = null;
                break;
            }

            return(pic_layout);
        }