Beispiel #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();
            }
        }
Beispiel #2
0
        private void myButton2_Click(object sender, EventArgs e)
        {
            List <PhotoDataItem> photoList = PhotoDataSource.Search(SearchTerm: "Microsoft", results: 200);

            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.flowLayoutPanel2.Controls.Add(x);
                Application.DoEvents();
            }
        }
Beispiel #3
0
        private void Flicker_Btn_Click(object sender, RoutedEventArgs e)
        {
            List <PhotoDataItem> items = PhotoDataSource.Search("Microsoft", 15);

            this.book1.Items.Clear();
            foreach (var item in items)
            {
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = new Uri(item.ImagePath, UriKind.Absolute);   //轉型以取得Image.Source
                bitmap.EndInit();
                Image img = new Image();
                img.Margin  = new Thickness(5);
                img.Stretch = Stretch.Fill;
                img.Source  = bitmap;
                this.book1.Items.Add(img);
            }
        }
Beispiel #4
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;
            }
        }
Beispiel #5
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();
            }
        }