Ejemplo n.º 1
0
        /* ------------- --------------- */


        /// <summary>
        /// フローチャートの読み込みを行う
        /// </summary>
        /// <param name="array">フローチャートのパーツを格納した配列</param>
        private void FlowLoad(FlowPartstable[] array)
        {
            /*
             *
             * flow_id
             * identification_id
             * type_id
             * data
             * position_x
             * position_y
             * startFlag
             */

            /* 別のプリセット読み込んだ時初期化用 */
            //FlowPanel.Children.Clear();
            ImageList.Clear();
            MaxIdentificationId = 0;

            var w = 10;

            foreach (var flow in array)
            {
                var x = double.Parse(flow.position_x) + 100;
                var y = double.Parse(flow.position_y);

                /* ドラッグ可能なレイアウト生成 */
                var myLayout = new MyLayout
                {
                    BackgroundColor = Color.Azure,
                    WidthRequest    = IMAGESIZE,
                    HeightRequest   = IMAGESIZE,
                    DrugFlag        = true
                };

                var work = y + (w += 100);

                var rc = new Rectangle(x, work, IMAGESIZE, IMAGESIZE);

                /* フローチャートのパネルに画像を追加 */
                CanvasAppend(myLayout, x, work, IMAGESIZE, IMAGESIZE);

                /*レイアウト内画像*/
                var myImage = new Image
                {
                    BackgroundColor = Color.Brown,
                    WidthRequest    = IMAGESIZE,
                    HeightRequest   = IMAGESIZE,
                    Source          = flow.type_id,
                };

                /* 処理内容を記述するスクロール可能なラベル生成 */
                var myLabel = new MyLabel
                {
                    Text = flow.data,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.Center,
                    LabelId = int.Parse(flow.identification_id),
                };
                var scroll = new ScrollView()
                {
                    Content       = myLabel,
                    TranslationX  = IMAGESIZE / 4,
                    TranslationY  = IMAGESIZE * 3 / 8,
                    WidthRequest  = IMAGESIZE / 2,
                    HeightRequest = IMAGESIZE / 4,
                    Orientation   = ScrollOrientation.Horizontal,
                };

                if (MaxIdentificationId < int.Parse(flow.identification_id))
                {
                    MaxIdentificationId = int.Parse(flow.identification_id);
                }

                /* 管理用リストに追加 */
                ImageList.Add(int.Parse(flow.identification_id), myLabel);

                var tgr = new TapGestureRecognizer();
                tgr.Tapped += (s, e) =>
                {
                    var labelid = (s as MyLabel).LabelId;
                    Dialog.SendStr = ImageList[labelid].Text;
                    Dialog.SendId  = labelid;

                    /* カスタムダイアログ表示 */
                    Debug.WriteLine("Debug:    FlowLoad.MyLabel.Tap");
                    Dialog.SetStr();
                    ImitationDialog.ShowUp(200);
                };
                myLabel.GestureRecognizers.Add(tgr);
                myLayout.PartsId = flow.identification_id;
                MyLayoutList.Add(myLayout);
                myLayout.LayoutDrug += LayoutDrug;
                myLayout.Children.Add(myImage);
                myLayout.Children.Add(scroll);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 図形選択メニューで図形が選択された時のイベント
        /// </summary>
        /// <param name="sender">
        /// 発火したインスタンス。
        /// 基本的にはImageが来る
        /// </param>
        /// <param name="args">
        /// Arguments.
        /// </param>
        private void ItemTapped(object sender, EventArgs args)
        {
            /* 選択された画像を取得 */
            var source = (sender as Image).Source;

            /* 新規キーの更新 */
            MaxIdentificationId++;

            /* ドラッグ可能なレイアウト生成 */
            var myLayout = new MyLayout
            {
                BackgroundColor = Color.Azure,
                //TranslationX = 0,
                //TranslationY = ImagePosition,
                WidthRequest  = IMAGESIZE,
                HeightRequest = IMAGESIZE,
                DrugFlag      = true
            };

            /* フローチャートのパネルに画像を追加 */
            var rc = myLayout.Bounds;

            CanvasAppend(myLayout, 0, ImagePosition, rc.Width, rc.Height);
            myLayout.LayoutTo(new Rectangle(0, ImagePosition, rc.Width, rc.Height), 0);

            /*レイアウト内画像*/
            var myImage = new Image
            {
                BackgroundColor = Color.Brown,
                Source          = source,
                WidthRequest    = IMAGESIZE,
                HeightRequest   = IMAGESIZE,
            };

            /* 処理内容を記述するスクロール可能なラベル生成 */
            var myLabel = new MyLabel
            {
                Text = "",
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                LabelId = MaxIdentificationId,
            };
            var scroll = new ScrollView()
            {
                BackgroundColor = Color.BlueViolet,
                Content         = myLabel,
                TranslationX    = IMAGESIZE / 4,
                TranslationY    = IMAGESIZE * 3 / 8,
                WidthRequest    = IMAGESIZE / 2,
                HeightRequest   = IMAGESIZE / 4,
                Orientation     = ScrollOrientation.Horizontal,
            };


            var tgr = new TapGestureRecognizer();

            tgr.Tapped += (s, e) =>
            {
                var labelid = (s as MyLabel).LabelId;
                Dialog.SendStr = ImageList[labelid].Text;
                Dialog.SendId  = labelid;
                /* カスタムダイアログ表示 */
                Debug.WriteLine("Debug:    ItemTapped");
                ImitationDialog.ShowUp(200);
            };

            myLabel.GestureRecognizers.Add(tgr);
            myLayout.PartsId = MaxIdentificationId.ToString();
            MyLayoutList.Add(myLayout);
            myLayout.LayoutDrug += LayoutDrug;
            myLayout.Children.Add(myImage);
            myLayout.Children.Add(scroll);

            /* 管理用リストに追加 */
            ImageList.Add(MaxIdentificationId, myLabel);
            /* 第二管理Dictionaryに追加 */
            DbInsertListTb2[MaxIdentificationId.ToString()]                   = new FlowPartstable();
            DbInsertListTb2[MaxIdentificationId.ToString()].flow_id           = SelectFloeId;
            DbInsertListTb2[MaxIdentificationId.ToString()].identification_id = MaxIdentificationId.ToString();
            DbInsertListTb2[MaxIdentificationId.ToString()].type_id           = source.ToString();
            DbInsertListTb2[MaxIdentificationId.ToString()].startFlag         = "0";
            /* レイアウトでの最後尾の座標を更新 */
            ImagePosition += IMAGESIZE;
        }