Exemplo n.º 1
0
        //=====================================================================================================

        /// <summary>
        /// 呼叫外部方案進來,使用外部功能
        /// global::PhotoDataModel_V2.PhotoDataSource.Search();
        /// global NameSpace的父類別
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        async private void btnRemotePhoto_Click(object sender, EventArgs e)//網頁照片匯入
        {
            flowLayoutPanel1.Controls.Clear();
            //List<PhotoDataItem> PhotoList =  global::PhotoDataModel_V2.PhotoDataSource.Search("car", 5);
            List <PhotoDataItem> PhotoList = await PhotoDataSource.SearchAsync("car", 5);

            for (int i = 0; i < PhotoList.Count - 1; i++)
            {
                MyItemTemplate x = new MyItemTemplate();
                x.Desc     = PhotoList[i].Title;
                x.ImageUrl = PhotoList[i].ImagePath;

                if (PhotoList[i].UniqueId != null)
                {
                    x.Id = PhotoList[i].UniqueId;
                }
                else
                {
                    x.Id = Guid.NewGuid().ToString();

                    x.NotifyMyFavor += X_NotifyMyFavor;
                    this.flowLayoutPanel1.Controls.Add(x);
                }
                Application.DoEvents();
            }
        }
Exemplo n.º 2
0
        async private void myButton3_Click(object sender, EventArgs e)
        {
            List <PhotoDataItem> photoList = await PhotoDataSource.SearchAsync(SearchTerm : "WorldCup", results : 10);

            this.dataGridView1.DataSource = photoList;

            for (int i = 0; i <= photoList.Count - 1; i++)
            {
                MyItemTemplate x = new MyItemTemplate();
                x.Desc     = photoList[i].Title;
                x.ImageURL = photoList[i].ImagePath;



                this.flowLayoutPanel1.Controls.Add(x);
                Application.DoEvents();

                x.checkBox1.CheckedChanged += CheckBox1_CheckedChanged;
                x.pictureBox1.Click        += PictureBox1_Click;
            }
        }
Exemplo n.º 3
0
        async private void btnGetPhoto_Click(object sender, EventArgs e)
        {
            flowLayoutPanel1.Controls.Clear();
            flowLayoutPanel2.Controls.Clear();
            List <PhotoDataItem> PhotoList = await PhotoDataSource.SearchAsync("car", 10);

            for (int i = 0; i < PhotoList.Count - 1; i++)
            {
                MyItemTemplate x = new MyItemTemplate();
                x.Desc     = PhotoList[i].Title;
                x.ImageUrl = PhotoList[i].ImagePath;
                this.flowLayoutPanel1.Controls.Add(x);

                //==============================================

                MyItemTemplate y = new MyItemTemplate();
                y.Desc     = PhotoList[i].Title;
                y.ImageUrl = PhotoList[i].ImagePath;
                this.flowLayoutPanel2.Controls.Add(y);


                if (PhotoList[i].UniqueId != null)
                {
                    x.Id = PhotoList[i].UniqueId;
                    y.Id = PhotoList[i].UniqueId;
                }
                else
                {
                    x.Id             = Guid.NewGuid().GetHashCode().ToString();
                    x.NotifyMyFavor += X_NotifyMyFavor;
                    this.flowLayoutPanel1.Controls.Add(x);

                    y.Id             = Guid.NewGuid().GetHashCode().ToString();
                    y.NotifyMyFavor += X_NotifyMyFavor;
                    this.flowLayoutPanel2.Controls.Add(y);
                }

                Application.DoEvents();
            }
        }