Exemplo n.º 1
0
        public void LoadImages(bool loadCustomIcons)
        {
            ImgList.Clear();
            keyFileDict.Clear();

            ImgList.Add("default", defImage);

            foreach (KeyValuePair <string, Pixbuf> image in defaultImages)
            {
                ImgList.Add(image.Key, image.Value);
            }

            if (Directory.Exists("icons") && loadCustomIcons)
            {
                foreach (string f in Directory.GetFiles("icons"))
                {
                    using (Pixbuf img = new Pixbuf(f))
                    {
                        string imgKey = Path.GetFileNameWithoutExtension(f);
                        if (ImgList.ContainsKey(imgKey))
                        {
                            ImgList.Remove(imgKey);
                        }
                        keyFileDict[imgKey] = f;
                        ImgList.Add(imgKey, img);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void BinarizationImageHandler(string src)
        {
            var test = (SampleImage)SelectedImageA.Clone();

            test.Description = src;
            OpenCV.Binarisation(test.ImageMat);
            test.Update();
            ImgList.Add(test);
        }
Exemplo n.º 3
0
        private void ClaheImageHandler(string src)
        {
            var test = (SampleImage)SelectedImageA.Clone();

            test.Description = src;
            OpenCV.HistoEqui(test.ImageMat);
            test.Update();
            ImgList.Add(test);
        }
Exemplo n.º 4
0
        /// <summary>
        /// The ImageBooster Factory
        /// </summary>
        /// <param name="filenames">List of filenames</param>
        public Factory(IList <string> filenames)
        {
            // import filenames to the list
            foreach (var filename in filenames)
            {
                ImgList.Add(new Img(filename));
            }

            // start background service worker
            IsRunWorker = true;
            var _bw = new BackgroundWorker();

            _bw.RunWorkerAsync(StartImageBoosterAsync());
        }
Exemplo n.º 5
0
        public PartialViewResult Upload()
        {
            try
            {
                string serverFolder = Server.MapPath("~/Media");
                if (!Directory.Exists(serverFolder))
                {
                    Directory.CreateDirectory(serverFolder);
                }

                if (Request.Files.Count > 0)
                {
                    for (int i = 0; i < Request.Files.Count; i++)
                    {
                        HttpPostedFileBase file = Request.Files[i];
                        file.SaveAs(serverFolder + "\\" + file.FileName);
                        ImgList.Add(new Models.Image()
                        {
                            ImageUrl = "/Media/" + file.FileName, Name = file.FileName
                        });
                    }
                    ViewBag.Message = "Files uploaded successfully.";
                }
                else
                {
                    ViewBag.Message = "No files.";
                }


                return(PartialView("_FileUpload", ImgList));
            }
            catch (Exception ex)
            {
                WebsiteExceptions websiteExceptions = new WebsiteExceptions();
                _context.WebsiteExceptions.Add(new WebsiteExceptions {
                    Source = ex.Source, Message = ex.Message, InnerException = ex.InnerException.Message, TargetSite = ex.TargetSite.Name
                });
                _context.SaveChanges();
                ViewBag.Message = "File upload not successful, Exception: " + ex.Message + "\n Inner Exception" + ex.InnerException.Message + "\nSource: " + ex.Source;
                return(PartialView("Error"));
            }
        }
Exemplo n.º 6
0
 public void AddThumbnailUrl(string baseUrl, string thumbnailUrl)
 {
     ImgList.Add(new KeyValuePair <string, string>(baseUrl, thumbnailUrl));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Add a filename to the list
 /// </summary>
 /// <param name="filename">Image filename</param>
 public void Add(string filename)
 {
     ImgList.Add(new Img(filename));
 }
Exemplo n.º 8
0
 private void OpenImageHandler(string src)
 {
     ImgList.Add(new SampleImage());
 }