public void AddImage(ImageAttachModel imgM)
        {
            ImageAttachModelView view = new ImageAttachModelView();

            view.ImageAttach           = imgM;
            view.OnImageAttachChoosed += View_OnImageAttachChoosed;
            view.IsEnable              = IsEnable;
            pn_image.Controls.Add(view);
            OnAddorRemoveImage();
        }
 public void AddImage(List <ImageAttachModel> lstimgM)
 {
     foreach (var item in lstimgM)
     {
         ImageAttachModelView view = new ImageAttachModelView();
         view.ImageAttach           = item;
         view.OnImageAttachChoosed += View_OnImageAttachChoosed;
         view.IsEnable              = IsEnable;
         pn_image.Controls.Add(view);
     }
     OnAddorRemoveImage();
 }
 private void View_OnImageAttachChoosed(ImageAttachModelView view, Guid id)
 {
     foreach (var item in pn_image.Controls)
     {
         if (item is ImageAttachModelView)
         {
             if ((item as ImageAttachModelView).ImageAttach.id != id)
             {
                 (item as ImageAttachModelView).IsChoose = false;
             }
         }
     }
 }
 private void btn_browser_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Multiselect = true;
         ofd.Filter      = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             foreach (var item in ofd.FileNames)
             {
                 ImageAttachModelView view = new ImageAttachModelView();
                 view.ImageAttach = new Model.Local.ImageAttachModel()
                 {
                     IsLocal = true,
                     Link    = item,
                 };
                 view.OnImageAttachChoosed += View_OnImageAttachChoosed;
                 view.IsEnable              = IsEnable;
                 pn_image.Controls.Add(view);
             }
             OnAddorRemoveImage();
         }
     }
 }