Exemplo n.º 1
0
 public void AddIrp(irp @irp)
 {
     if (@irp.fi.Exists)
     {
         (this.irps as List <irp>).Add(@irp);
     }
 }
Exemplo n.º 2
0
 private void btn_add_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Multiselect = true;
         ofd.Filter      = "images | *.bmp | GIF images | *.gif | JPEG images | *.jpg; *.jpeg; *.jpe; *.jif; *.jfif; *.jfi | PNG images | *.png | TIFF images | *.tiff; *.tif | All files | *.*";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             //int i = 0;
             foreach (string path in ofd.FileNames)
             {
                 try
                 {
                     irp thisRef = new irp();
                     thisRef.SetPath(path);
                     lv_images.SmallImageList.Images.Add(thisRef.GetImage());
                     lv_images.Items.Add(thisRef.fi.Name, i);
                     irps.Add(thisRef);
                     i++;
                 }
                 catch { }
             }
         }
     }
     //Update Create button
     if (lv_images.Items.Count > 0)
     {
         btn_create.Enabled = true;
     }
     else
     {
         btn_create.Enabled = false;
     }
 }
Exemplo n.º 3
0
        private void btn_export_Click(object sender, EventArgs e)
        {
            List <irp> include = new List <irp>();

            foreach (var item in clb_include.CheckedItems)
            {
                irp _irp = new irp();
                _irp.SetPath(item.ToString());
                include.Add(_irp);
            }
            backgroundWorker1.RunWorkerAsync(new object[] { nud_wdith.Value, nud_height.Value, include, textBox1.Text, proj.irps });
        }
Exemplo n.º 4
0
        public void ValidateIrps()
        {
            /*
             *          var irplist = irps as List<irp>;
             * var oldIrps = irplist;
             *          foreach (var tIrp in oldIrps) {
             *                  if (tIrp.fi.Exists == false) {
             *                          var epd = new EditPathDialog("Please replace path for " + irplist[irplist.IndexOf(tIrp)].ToString());
             *                          if (epd.ShowDialog() == DialogResult.OK) {
             *                                  var toAdd = new irp();
             *                                  toAdd.SetPath(epd.SelectedPath);
             *                                  irplist[irplist.IndexOf(tIrp)] = toAdd;
             *                          } else irplist.RemoveAt(irplist.IndexOf(tIrp));
             *                  }
             *          }
             *          irps = irplist;*/

            List <irp> ValidIrps = new List <irp>();

            foreach (var tIrp in irps)
            {
                if (!tIrp.fi.Exists)
                {
                    if (MessageBox.Show("Error. The path " + tIrp.fi.FullName + " could not be found. Would you like to browse for the file to update the path? If not, the file path will be removed from the project.", "IRP ERROR", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        using (OpenFileDialog ofd = new OpenFileDialog())
                        {
                            ofd.Filter = "images|*.bmp|GIF images|*.gif|JPEG images|*.jpg; *.jpeg; *.jpe; *.jif; *.jfif; *.jfi|PNG images|*.png|TIFF images|*.tiff; *.tif|All files|*.*";
                            if (ofd.ShowDialog() == DialogResult.OK)
                            {
                                if (!File.Exists(ofd.FileName))
                                {
                                    ValidateIrps();
                                }
                                else
                                {
                                    irp newIrp = new irp();
                                    newIrp.SetPath(ofd.FileName);
                                    ValidIrps.Add(newIrp);
                                }
                            }
                        }
                    }
                }
                else
                {
                    ValidIrps.Add(tIrp);
                }
            }
            irps = ValidIrps;
        }
Exemplo n.º 5
0
        public void RunSlave(out string ImageIndexString,
                             out string ImageNameString,
                             out string ImageFormatString,
                             out string ImageSizeString,
                             out string ImagePathString)
        {
            ImageIndexString  = ProjectRefrence.DataValues.SelectedImage + "/" + ProjectRefrence.DataValues.TotalImages;
            ImageNameString   = (ProjectRefrence.irps as List <irp>)[ProjectRefrence.DataValues.SelectedImage - 1].fi.Name;
            ImageFormatString = (ProjectRefrence.irps as List <irp>)[ProjectRefrence.DataValues.SelectedImage - 1].fi.Extension;
            ImageSizeString   = (ProjectRefrence.irps as List <irp>)[ProjectRefrence.DataValues.SelectedImage - 1].fi.Length.ToString();
            ImagePathString   = (ProjectRefrence.irps as List <irp>)[ProjectRefrence.DataValues.SelectedImage - 1].fi.FullName;
            irp sIRP = new irp();

            sIRP.SetPath(ImagePathString);
            ImageUpdate(sIRP);
        }
Exemplo n.º 6
0
 private void btn_add_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Filter = "images|*.bmp|GIF images|*.gif|JPEG images|*.jpg; *.jpeg; *.jpe; *.jif; *.jfif; *.jfi|PNG images|*.png|TIFF images|*.tiff; *.tif|All files|*.*";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             int        insertIndex  = ActiveProject.DataValues.SelectedImage;
             int        currentIndex = 0;
             bool       ADDEDPHOTO   = false;
             List <irp> new_irps     = new List <irp>();
             ActiveProject.irps.Reverse();
             Stack <irp> old_irps = new Stack <irp>((ActiveProject.irps));
             while (true)
             {
                 currentIndex++;
                 if (currentIndex == insertIndex)
                 {
                     irp _irp = new irp();
                     _irp.SetPath(ofd.FileName);
                     new_irps.Add(_irp);
                     ADDEDPHOTO = true;
                     currentIndex++;
                 }
                 else
                 {
                     irp _irp = new irp();
                     _irp.SetPath(old_irps.Pop().PathAsString);
                     new_irps.Add(_irp);
                 }
                 if (old_irps.Count == 0 && ADDEDPHOTO)
                 {
                     break;
                 }
             }
             ActiveProject.irps = new_irps;
             UpdateImage();
         }
     }
 }
Exemplo n.º 7
0
 void ImageUpdate(irp selectedValue)
 {
     Display.Image = selectedValue.GetImage();
 }