private void PhotoItemCopy_MyCheckedChange(object sender, EventArgs e)
        {
            MyItemTemplate item = sender as MyItemTemplate;

            if (item.Checked)
            {
                MyCopyItem copyItem = new MyCopyItem(item);
                copyItem.ParentIndex = item.Index;
                copyItem.Checked     = true;
                this.flowLayoutPanel4.Controls.Add(copyItem);
                copyItem.Index            = this.flowLayoutPanel4.Controls.GetChildIndex(copyItem);
                copyItem.MyCheckedChange += CopyItem_MyCheckedChange;
            }
            else
            {
                if (item is MyItemTemplate)
                {
                    foreach (MyCopyItem copyItem in flowLayoutPanel4.Controls)
                    {
                        if (copyItem.ParentIndex == item.Index)
                        {
                            this.flowLayoutPanel4.Controls.Remove(copyItem);
                        }
                    }

                    return;
                }
            }
        }
Exemple #2
0
        private void btnGetPhoto_Click(object sender, EventArgs e)//匯入圖片
        {
            flowLayoutPanel1.DataBindings.Clear();
            flowLayoutPanel2.DataBindings.Clear();
            //var ProductList= this.dbContext.ProductPhoto.ToList();
            List <ProductPhoto> ProductList = this.dbContext.ProductPhoto.ToList();

            for (int i = 0; i <= ProductList.Count - 1; i++)
            {
                MyItemTemplate x = new MyItemTemplate();//自製方法宣告

                //
                x.Desc       = ProductList[i].ModifiedDate.ToShortDateString();
                x.ImageBytes = ProductList[i].LargePhoto;
                //x.ImageURL=
                this.flowLayoutPanel2.Controls.Add(x);
                //=========================================
                // 屬性 Wrap Contents 換行栽剪 橫式顯示
                MyItemTemplate y = new MyItemTemplate();
                y.Desc       = ProductList[i].ModifiedDate.ToShortDateString();
                y.ImageBytes = ProductList[i].LargePhoto;
                //x.ImageURL=
                this.flowLayoutPanel1.Controls.Add(y);


                Application.DoEvents();//將訊息處理完後在傳出
            }
        }
Exemple #3
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();
            }
        }
Exemple #4
0
        private void myButton1_Click(object sender, EventArgs e)
        {
            AdventureWorksEntities dbContext = new AdventureWorksEntities();
            var q = from p in dbContext.ProductPhotoes
                    select p;

            List <ProductPhoto> productList = q.ToList();

            this.dataGridView1.DataSource = productList;
            for (int i = 0; i <= productList.Count - 1; i++)
            {
                MyItemTemplate x = new MyItemTemplate();
                x.Desc       = productList[i].ModifiedDate.ToString();
                x.ImageBytes = productList[i].LargePhoto;

                this.flowLayoutPanel2.Controls.Add(x);
                Application.DoEvents();
            }

            for (int i = 0; i <= productList.Count - 1; i++)
            {
                MyItemTemplate x = new MyItemTemplate();
                x.Desc       = productList[i].ModifiedDate.Value.ToShortDateString();
                x.ImageBytes = productList[i].LargePhoto;

                this.flowLayoutPanel1.Controls.Add(x);
                Application.DoEvents();
            }
        }
        private void PhotoItem_MyCheckedChange(object sender, EventArgs e)
        {
            MyItemTemplate item = sender as MyItemTemplate;

            if (item.Checked)
            {
                this.flowLayoutPanel2.Controls.Add(item);
            }
            else
            {
                this.flowLayoutPanel2.Controls.Remove(item);
                this.flowLayoutPanel1.Controls.Add(item);
                this.flowLayoutPanel1.Controls.SetChildIndex(item, item.Index);
            }
        }
Exemple #6
0
        private void btnAddMyItem_Click(object sender, EventArgs e)//加到最愛
        {
            List <ProductPhoto> ProductList = this.dbContext.ProductPhoto.ToList();

            for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
            {
                MyItemTemplate x = (MyItemTemplate)flowLayoutPanel1.Controls[i];
                if (x.DscCheck == true)
                {
                    x.Desc       = ProductList[i].ModifiedDate.ToShortDateString();
                    x.ImageBytes = ProductList[i].LargePhoto;
                    this.flowLayoutPanel3.Controls.Add(x);
                }
            }
        }
Exemple #7
0
 private void CheckBox1_CheckedChanged(object sender, EventArgs e)
 {
     this.flowLayoutPanel3.Controls.Clear();
     foreach (MyItemTemplate x in flowLayoutPanel1.Controls)
     {
         if (x.checkBox1.Checked)
         {
             MyItemTemplate y = new MyItemTemplate();
             y.Desc     = x.Desc;
             y.ImageURL = x.ImageURL;
             this.flowLayoutPanel3.Controls.Add(y);
             Application.DoEvents();
         }
     }
 }
Exemple #8
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();
            }
        }
        private void myButton2_Click(object sender, EventArgs e)
        {
            var q = dbContext.ProductPhotoes;
            List <ProductPhoto> productList = q.ToList();

            this.flowLayoutPanel3.Controls.Clear();
            this.flowLayoutPanel4.Controls.Clear();
            for (int i = 0; i < productList.Count; i++)
            {
                MyItemTemplate photoItem = new MyItemTemplate()
                {
                    Desc      = productList[i].ModifiedDate.ToString(),
                    ImageByte = productList[i].LargePhoto
                };
                this.flowLayoutPanel3.Controls.Add(photoItem);
                photoItem.Index            = this.flowLayoutPanel3.Controls.GetChildIndex(photoItem);
                photoItem.MyCheckedChange += PhotoItemCopy_MyCheckedChange;
            }
        }
Exemple #10
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;
            }
        }
Exemple #11
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();
            }
        }
 public MyCopyItem(MyItemTemplate parentItem) : base()
 {
     this.ImageByte = parentItem.ImageByte;
     this.Desc      = parentItem.Desc;
 }