Example #1
0
 private void addphotos_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         if (openFileDialog1.CheckFileExists == false)
         {
             MessageBox.Show("Файл не выбран");
             return;
         }
         foreach (string flname in openFileDialog1.FileNames)
         {
             Img photo = new Img();
             photo.IsNew        = true;
             photo.Name         = Path.GetFileName(flname);
             photo.Picture      = Image.FromFile(flname);
             photo.Description  = "Новое изображение";
             photo.Url          = DateTime.UtcNow.GetHashCode().ToString();
             photo.Url          = "image_" + photo.Url + photo.Name;
             photo.OriginalPath = flname;
             dbvals.photolist.Add(photo);
             listBox2.Items.Add(photo);
         }
     }
 }
Example #2
0
 private void addphotos_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         if (openFileDialog1.CheckFileExists == false)
         {
             MessageBox.Show("Файл не выбран");
             return;
         }
         foreach (string flname in openFileDialog1.FileNames)
         {
             Img photo = new Img();
             photo.IsNew = true;
             photo.Name = Path.GetFileName(flname);
             photo.Picture = Image.FromFile(flname);
             photo.Description = "Новое изображение";
             photo.Url = DateTime.UtcNow.GetHashCode().ToString();
             photo.Url= "image_"+ photo.Url + photo.Name;
             photo.OriginalPath = flname;
             dbvals.photolist.Add(photo);
             listBox2.Items.Add(photo);
         }
     }
 }
Example #3
0
        public Photos(string src)
        {
            Img photo;
            photolist = new ArrayList();
            if (src != "")
            {
                string[] urls = src.Split(';');
                //photolist = new Img[urls.Length];

                for (int i = 0; i < urls.Length; i++)
                {
                    //photolist[i] = new Img();
                    //photolist[i].Url = urls[i];
                    //photolist[i].Name = urls[i].Substring(urls[i].LastIndexOf('/') + 1);
                    // photolist[i].Description = "Полный размер на сайте";
                    photo = new Img();
                    photo.Url = urls[i];
                    photo.OriginalPath = urls[i];
                    photo.Name = urls[i].Substring(urls[i].LastIndexOf('/') + 1);
                    photo.Description = "Полный размер на сайте";
                    photo.IsNew = false;
                    photolist.Add(photo);
                }
            }
        }