예제 #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);
                    }
                }
            }
        }
예제 #2
0
        private void BinarizationImageHandler(string src)
        {
            var test = (SampleImage)SelectedImageA.Clone();

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

            test.Description = src;
            OpenCV.HistoEqui(test.ImageMat);
            test.Update();
            ImgList.Add(test);
        }
예제 #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());
        }
예제 #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"));
            }
        }
예제 #6
0
 public void AddThumbnailUrl(string baseUrl, string thumbnailUrl)
 {
     ImgList.Add(new KeyValuePair <string, string>(baseUrl, thumbnailUrl));
 }
예제 #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));
 }
예제 #8
0
 private void OpenImageHandler(string src)
 {
     ImgList.Add(new SampleImage());
 }