Exemple #1
0
        protected void UploadButton_Click(object sender, EventArgs e)
        {
            if (FileUploader.HasFile)
            {
                try
                {
                    var fullPath = Server.MapPath(AdminUploadPath) + FileUploader.FileName;

                    FileUploader.SaveAs(fullPath);
                    lbResult.Text = "File name: " +
                                    FileUploader.PostedFile.FileName + "<br>" +
                                    FileUploader.PostedFile.ContentLength + " kb<br>" +
                                    "Content type: " +
                                    FileUploader.PostedFile.ContentType + "<br><b>Uploaded Successfully";

                    ParseCsv(fullPath);
                }
                catch (Exception ex)
                {
                    lbResult.Text = "ERROR: " + ex.Message.ToString();
                }
            }
            else
            {
                lbResult.Text = "You have not specified a file.";
            }
        }
        private void SaveUploaderImage()
        {
            if (FileUploader.HasFile)
            {
                var extension = Path.GetExtension(FileUploader.FileName) ?? string.Empty;

                var allowedExtensions = Utilities.GetImageExtensions();

                if (allowedExtensions.Contains(extension.ToLower()) && int.TryParse(Request.QueryString["ID"], out _movieId))
                {
                    var fullName       = FileUploader.FileName.ToAZ09Dash(true, true);
                    var resultFilePath = Server.MapPath(ConfigAssistant.ImageFolderRelativePath) + fullName;

                    FileUploader.SaveAs(resultFilePath);

                    _movieFile.TSP_MovieFiles_Image(0, null, _movieId, fullName);

                    Session[Master.SessionShowSuccess] = true;
                }
                else
                {
                    Session[Master.SessionShowError] = new KeyValuePair <bool, string>(true, "Allowed extensions are: .jpg, .jpeg, .gif, .png");
                }

                Response.Redirect(Request.Url.AbsoluteUri);
            }
        }
Exemple #3
0
    protected void UploadButton_Click(object sender, EventArgs e)
    {
        if (FileUploader.HasFile)
        {
            try
            {
                FileUploader.SaveAs(Server.MapPath("../news_image//") +
                                    FileUploader.FileName);
                Label8.Text = "File name: " +

                              FileUploader.PostedFile.FileName + "<br>" +
                              //FileUploader.PostedFile.ContentLength + " kb<br>" +

                              "Content type: " +
                              FileUploader.PostedFile.ContentType + "<br><b>Uploaded Successfully";

                Label2.Text = "~/news_image/" + FileUploader.PostedFile.FileName;
            }
            catch (Exception ex)
            {
                Label8.Text = "ERROR: " + ex.Message.ToString();
            }
        }
        else
        {
            Label8.Text = "You have not specified a file.";
        }
    }
        protected void btSignup_Click(object sender, EventArgs e)
        {
            //Inserting new values

            if (tbUname.Text.Contains("_"))
            {
                if (VerifyUsernameValidity() == true)
                {
                    if (tbPass.Text == tbCPass.Text)
                    {
                        // try
                        {
                            String CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString;
                            using (SqlConnection con = new SqlConnection(CS))
                            {
                                SqlCommand cmd = new SqlCommand("insert into UserAccounts(UserName,Password,UserType,LoginStatus) values('" + tbUname.Text + "','" + tbPass.Text + "','Doctor','Offline')", con);
                                con.Open();
                                cmd.ExecuteNonQuery();
                                CreateUserMailTables();
                                StoreUserIdToSession();
                                Session["UserName"] = tbUname.Text;
                                string imgPath = @"~/Images/Doctors/" + tbUname.Text + ".jpg";
                                if (FileUploader.HasFile)
                                {
                                    FileUploader.SaveAs(Server.MapPath(imgPath));
                                }
                                else
                                {
                                    File.Copy(Server.MapPath("~/Images/noimage.jpg"), Server.MapPath(imgPath));
                                }

                                Response.Redirect("~/DoctorProfileBuilderPage.aspx");
                            }
                        }
                        //catch (Exception ex)
                        //{

                        //    Session["Exception"] = ex;
                        //    Response.Redirect("~/404.aspx");
                        //}
                    }
                    else
                    {
                        lblMsg.ForeColor = Color.Red;
                        lblMsg.Text      = "Passwords do not match";
                    }
                }
                else
                {
                    lblMsg.ForeColor = Color.Red;
                    lblMsg.Text      = "Username already exist";
                }
            }
            else
            {
                lblMsg.ForeColor = Color.Red;
                lblMsg.Text      = "Use _ (Underscore), digits (0-9)and alphabets to generate your Username";
            }
        }
Exemple #5
0
        protected void btnSubirArchivo_Click(object sender, EventArgs e)
        {
            string FileName = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Hour.ToString() + "-" + DateTime.Now.Minute.ToString() + "-" + DateTime.Now.Second.ToString() + ".user" + UserId.ToString();

            try{
                FileUploader.SaveAs(PortalSettings.HomeDirectoryMapPath + "\\" + "UsersUpdate\\" + UserId.ToString() + "\\" + FileName);
                Response.Redirect("~/MyManager/Articulos?Message=Success2");
            } catch
            {
                Response.Redirect("~/MyManager/Articulos?Message=Error2");
            }
        }
        protected void UploadButton_Click(object sender, EventArgs e)
        {
            try
            {
                string csvPath = Server.MapPath("~/Files/") + Path.GetFileName(FileUploader.PostedFile.FileName);
                FileUploader.SaveAs(csvPath);
                //string CSVFile = "cities.csv";
                List <string> rowData = new List <string>();

                string csvData = File.ReadAllText(csvPath);

                foreach (string row in csvData.Split('\n'))
                {
                    if (!string.IsNullOrEmpty(row))
                    {
                        foreach (string cell in row.Split(','))
                        {
                            rowData.Add(cell);
                        }

                        cities tempCity = new cities();

                        tempCity.LatD      = rowData[0];
                        tempCity.LatM      = rowData[1];
                        tempCity.LatS      = rowData[2];
                        tempCity.NS        = rowData[3];
                        tempCity.LonD      = rowData[4];
                        tempCity.LonM      = rowData[5];
                        tempCity.LonS      = rowData[6];
                        tempCity.EW        = rowData[7];
                        tempCity.CityName  = rowData[8];
                        tempCity.cityState = rowData[9];

                        db.Cities.Add(tempCity);

                        db.SaveChanges();

                        tempCity = null;
                        rowData.Clear();
                    }


                    else
                    {
                        break;
                    }
                }
            }
            catch (System.IO.IOException)
            {
                Server.Transfer("Default.aspx", true);
            }
        }
Exemple #7
0
        protected void btnSubirArchivo_Click(object sender, EventArgs e)
        {
            string FileName = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Hour.ToString() + "-" + DateTime.Now.Minute.ToString() + "-" + DateTime.Now.Second.ToString() + ".user" + Conversion.ObtenerLocal(UserId).ToString();

            try{
                FileUploader.SaveAs(PortalSettings.HomeDirectoryMapPath + "\\" + "UsersUpdate\\" + Conversion.ObtenerLocal(UserId).ToString() + "\\" + FileName);
                Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
            } catch
            {
                Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
            }
        }
Exemple #8
0
        public DataTable ReadCsvFile()
        {
            DataTable dtCsv = new DataTable();
            string    Fulltext;


            if (FileUploader.HasFile)
            {
                string FileSaveWithPath = Server.MapPath("\\Upload\\Import" + System.DateTime.Now.ToString("ddMMyyyy_hhmmss") + ".csv");
                FileUploader.SaveAs(FileSaveWithPath);
                using (StreamReader sr = new StreamReader(FileSaveWithPath))
                {
                    while (!sr.EndOfStream)
                    {
                        Fulltext = sr.ReadToEnd().ToString(); //read full file text
                        string[] rows = Fulltext.Split('\n'); //split full file text into rows
                        for (int i = 0; i < rows.Count() - 1; i++)
                        {
                            string[] rowValues = rows[i].Split(','); //split each row with comma to get individual values
                            {
                                if (i == 0)
                                {
                                    for (int j = 0; j < rowValues.Count(); j++)
                                    {
                                        dtCsv.Columns.Add(rowValues[j].Replace(" ", "").Replace("\r", "")); //add headers
                                    }
                                }
                                else
                                {
                                    DataRow dr = dtCsv.NewRow();
                                    for (int k = 0; k < rowValues.Count(); k++)
                                    {
                                        dr[k] = rowValues[k].ToString();
                                    }
                                    dtCsv.Rows.Add(dr); //add other rows
                                }
                            }
                        }
                    }
                }
            }
            return(dtCsv);
        }
Exemple #9
0
        private void AdministrarPostFileUploader()
        {
            try
            {
                HttpPostedFileAJAX pf = FileUploader.PostedFile;

                FileUploader.File_RenameIfAlreadyExists = false;
                FileUploader.SaveAs(@"~/Archivos/temp", pf.FileName);

                pf.responseMessage_Uploaded = pf.FileName;

                SessionHelper.GuardarEnSession("DocumentoAdjunto", pf.FileName);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
                throw;
            }
        }
Exemple #10
0
    protected void ButtonUpd_Click(object sender, EventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("MASUK DUT");
        if (FileUploader.HasFile)
        {
            String fileSave = "P_" + HiddenIDPengajuan.Value + "_" + FileUploader.FileName;
            FileUploader.SaveAs(Server.MapPath("~/Files") + "//" + fileSave);
            LblSurat.Text      = FileUploader.FileName;
            LblSurat.ForeColor = System.Drawing.Color.Black;
            System.Diagnostics.Debug.WriteLine("MASUK DUT " + fileSave);

            SaveUploadData(fileSave);
        }
        else
        {
            LblSurat.Text      = "Mohon Pilih File yang akan diupload";
            LblSurat.ForeColor = System.Drawing.Color.Red;
        }//  lblMessage.Text = "File Successfully Uploaded";
    }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (pass1.Text == pass2.Text)
     {
         SqlConnection myCon = new SqlConnection("Data Source=DESKTOP-A77ORJE\\SQLEXPRESS;Initial Catalog=GAMES_SALES_PLATFORM;Integrated Security=True");
         SqlCommand    myCom = new SqlCommand("UPDATE KULLANICI SET ADI=@ADI,EMAIL=@EMAIL,SIFRE=@SIFRE,FOTOGRAF=@FOTOGRAF where KULLANICI_ID=@KULLANICI_ID", myCon);
         myCom.Parameters.AddWithValue("KULLANICI_ID", Session["KULLANICI_ID"]);
         myCom.Parameters.AddWithValue("ADI", name.Text.ToString().Trim());
         myCom.Parameters.AddWithValue("EMAIL", mail.Text.ToString().Trim());
         myCom.Parameters.AddWithValue("SIFRE", pass1.Text.ToString().Trim());
         if (FileUploader.HasFile)
         {
             try
             {
                 FileUploader.SaveAs(Server.MapPath(DefaultFileName) +
                                     FileUploader.FileName);
                 lblUpload.Text = "File name: " +
                                  FileUploader.PostedFile.FileName + "<br>" +
                                  FileUploader.PostedFile.ContentLength + " kb<br>" +
                                  "Content type: " +
                                  FileUploader.PostedFile.ContentType + "<br><b>Uploaded Successfully";
             }
             catch (Exception ex)
             {
                 lblUpload.Text = "ERROR: " + ex.Message.ToString();
             }
         }
         else
         {
             lblUpload.Text = "You have not specified a file.";
         }
         myCom.Parameters.AddWithValue("FOTOGRAF", DefaultFileName.ToString().Trim() + FileUploader.FileName.ToString().Trim());
         myCon.Open();
         myCom.ExecuteNonQuery();
         myCon.Close();
         Response.Redirect("Profile.aspx");
     }
     else
     {
         errMsg.Visible = true;
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (tbtopic.Text != "" && tbcategory.Text != "" && tacontent.Value != "")
            {
                try
                {
                    String CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString;
                    using (SqlConnection con = new SqlConnection(CS))
                    {
                        SqlCommand cmd = new SqlCommand("insert into Blogs(WriterId,Topic,Category,Message,Date,Time) values('" + Session["DoctorId"] + "','" + tbtopic.Text + "','" + tbcategory.Text + "','" + tacontent.Value + "','" + DateTime.Today.ToString("dd-MM-yyyy") + "','" + DateTime.Now.ToString("HH:mm:ss tt") + "')", con);
                        con.Open();
                        cmd.ExecuteNonQuery();
                        cmd = new SqlCommand("select BlogId from Blogs where WriterId='" + Session["DoctorId"] + "' and Topic='" + tbtopic.Text + "' and Category='" + tbcategory.Text + "' and Message='" + tacontent.Value + "'", con);
                        SqlDataAdapter sda = new SqlDataAdapter(cmd);
                        DataTable      dt  = new DataTable();
                        sda.Fill(dt);
                        string blogid  = dt.Rows[0][0].ToString();
                        string imgPath = @"~/Images/Blogs/" + blogid + ".jpg";
                        if (FileUploader.HasFile)
                        {
                            FileUploader.SaveAs(Server.MapPath(imgPath));
                        }
                        else
                        {
                            File.Copy(Server.MapPath("~/Images/noimage.jpg"), Server.MapPath(imgPath));
                        }
                        //FileUploader.SaveAs(Server.MapPath(tempimgPath));

                        //Response.Redirect("~/DoctorProfileBuilderPage.aspx");
                    }
                }
                catch (Exception ex)
                {
                    Session["Exception"] = ex; Response.Redirect("~/404.aspx");
                }
            }
            else
            {
                lblMsg.ForeColor = Color.Red;
                lblMsg.Text      = "All Fields Are Mandatory!";
            }
        }
 protected void img_btn_Click(object sender, EventArgs e)
 {
     if (FileUploader.HasFile)
     {
         try
         {
             FileUploader.SaveAs(Server.MapPath(DefaultFileName) +
                                 FileUploader.FileName);
             img_path.Text = FileUploader.PostedFile.FileName;
         }
         catch (Exception ex)
         {
             img_path.Text = "ERROR: " + ex.Message.ToString();
         }
     }
     else
     {
         img_path.Text = "You have not specified a file.";
     }
 }
Exemple #14
0
    private string ProcessUploadedFile()
    {
        if (!FileUploader.HasFile)
        {
            return("You must select a valid file to upload.");
        }

        if (FileUploader.FileContent.Length == 0)
        {
            return("You must select a non empty file to upload.");
        }

        //As the input is external, always do case-insensitive comparison unless you actually care about the case.
        // if (FileUploader.PostedFile.ContentType == "application/pdf")
        if (!FileUploader.FileName.EndsWith("pdf"))
        {
            return("Only files of type PDF is supported. Uploaded File Type: " + FileUploader.PostedFile.ContentType);
        }

        //rest of the code to actually process file.
        if (FileUploader.PostedFile.ContentLength > 0 && FileUploader.FileName.EndsWith("pdf"))
        //if (FileUploader.PostedFile.ContentType == ".PDF" || FileUploader.PostedFile.ContentType == ".pdf")
        {
            try
            {
                FileUploader.SaveAs(Server.MapPath("../Documents//") +
                                    FileUploader.FileName);

                Label_UplodeName.Text = "~/Documents/" + FileUploader.PostedFile.FileName;

                return("File name: " + FileUploader.PostedFile.FileName + "<br>" +
                       "File size: " + FileUploader.PostedFile.ContentLength + " kb<br><br><b>Uploaded Successfully</b>");
                //Label2.Text = "~/Documents/" + FileUploader.PostedFile.FileName;
            }
            catch (Exception ex)
            {
                return("ERROR: " + ex.Message.ToString());
            }
        }
        return("Erorr...");
    }
Exemple #15
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            try
            {
                bool bImportUser = CheckUserName();
                //bool bImportUser = true;
                bool bImportTextBox = CheckTextBox();

                if (bImportUser == true && bImportTextBox == true)
                {
                    #region
                    string filePath = string.Empty;
                    if (FileUploader.HasFile && FileUploader.FileName.ToUpper().Contains(".XML"))
                    {
                        filePath = @"\\mdrockyview.ab.ca\gis\Operations\TrafficCount\XML\" + FileUploader.FileName;
                        FileUploader.SaveAs(filePath);

                        lblResult.Text = ImportTrafficXML(filePath);

                        if (lblResult.Text.Contains("Successfully Imported XML file to Database"))
                        {
                            SearchByCriterion(false);
                            lblResult.Text = "Successfully Imported XML file to Database";
                        }
                    }
                    else
                    {
                        lblResult.Text = "No xml file is selected. Please check the file";
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
    protected void btnPropUp_Click(object sender, EventArgs e)
    {
        string filepath = Server.MapPath("office_orders\\" + FileUploader.FileName);

        if (FileUploader.HasFile)
        {
            try
            {
                FileUploader.SaveAs(filepath);
            }
            catch (Exception ex)
            {
                lblUpFile.Text = "ERROR: " + ex.Message.ToString();
            }
        }
        else
        {
            lblUpFile.Text = "You have not specified a file.";
        }


        DataSet ds = new DataSet();

        ds.ReadXml(filepath);
        System.IO.File.Delete(filepath);
        if (!isValidDS(ds))
        {
            Utils.ShowMessageBox(this, "Invalid XML");
            return;
        }
        if (DBInsert(ds))
        {
            Utils.ShowMessageBox(this, "Successfully Imported XML");
            FillGrid();
            return;
        }
    }
        protected void btnFileUpload_Click(object sender, EventArgs e)
        {
            if (FileUploader.HasFile)
            {
                try
                {
                    string filename = Path.GetFileName(FileUploader.FileName);
                    FileUploader.SaveAs(Server.MapPath("~/Upload/") + filename);

                    string FileFullPath = Server.MapPath("~/Upload/") + filename;
                    Session["FileFullPath"] = FileFullPath;
                    FileInfo existingFile = new FileInfo(FileFullPath);
                    if (ImportExcelSheetNames(existingFile, FileFullPath) == true)
                    {
                        btnImportSheet.Enabled = true;
                        lblStatus.Text         = "Upload status: Excel File loaded...Select Tab Sheet to load";
                        lblStatus.ForeColor    = System.Drawing.Color.Blue;
                        lblStatus.BackColor    = System.Drawing.Color.Transparent;
                    }
                    else
                    {
                        btnImportSheet.Enabled = false;
                        lblStatus.Text         = "Upload status: Error - Excel File Not loaded";
                        lblStatus.ForeColor    = System.Drawing.Color.White;
                        lblStatus.BackColor    = System.Drawing.Color.Red;
                    }
                }
                catch (Exception ex)
                {
                    lblStatus.Text         = "Upload status: The Excel tab sheets could not be uploaded. The following error occured: " + ex.Message;
                    btnImportSheet.Enabled = false;
                    lblStatus.ForeColor    = System.Drawing.Color.White;
                    lblStatus.BackColor    = System.Drawing.Color.Red;
                }
            }
        }
Exemple #18
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FileUploader.HasFile)
            {
                try
                {
                    FileUploader.SaveAs(Server.MapPath(DefaultFileName) + FileUploader.FileName);

                    Image <Bgr, Byte> originalImage = new Image <Bgr, byte>(Server.MapPath(DefaultFileName) + FileUploader.FileName);
                    int width, height, channels = 0;
                    width    = originalImage.Width;
                    height   = originalImage.Height;
                    channels = originalImage.NumberOfChannels;

                    Image <Bgr, byte>  colorImage = new Image <Bgr, byte>(originalImage.ToBitmap());
                    Image <Gray, byte> grayImage  = colorImage.Convert <Gray, Byte>();

                    float[]        GrayHist;
                    DenseHistogram Histo = new DenseHistogram(255, new RangeF(0, 255));
                    Histo.Calculate(new Image <Gray, Byte>[] { grayImage }, true, null);
                    GrayHist = new float[256];
                    Histo.MatND.ManagedArray.CopyTo(GrayHist, 0);
                    float largestHist   = GrayHist[0];
                    int   thresholdHist = 0;
                    for (int i = 0; i < 255; i++)
                    {
                        if (GrayHist[i] > largestHist)
                        {
                            largestHist   = GrayHist[i];
                            thresholdHist = i;
                        }
                    }

                    grayImage  = grayImage.ThresholdAdaptive(new Gray(255), ADAPTIVE_THRESHOLD_TYPE.CV_ADAPTIVE_THRESH_MEAN_C, THRESH.CV_THRESH_BINARY, 85, new Gray(4));
                    colorImage = colorImage.Copy();
                    int countRedCells = 0;
                    using (MemStorage storage = new MemStorage())
                    {
                        for (Contour <Point> contours = grayImage.FindContours(Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_LIST, storage); contours != null; contours = contours.HNext)
                        {
                            Contour <Point> currentContour = contours.ApproxPoly(contours.Perimeter * 0.015, storage);
                            if (currentContour.BoundingRectangle.Width > 20)
                            {
                                CvInvoke.cvDrawContours(colorImage, contours, new MCvScalar(0, 0, 255), new MCvScalar(0, 0, 255), -1, 2, Emgu.CV.CvEnum.LINE_TYPE.EIGHT_CONNECTED, new Point(0, 0));
                                colorImage.Draw(currentContour.BoundingRectangle, new Bgr(0, 255, 0), 1);
                                countRedCells++;
                            }
                        }
                    }

                    Image <Gray, byte> grayImageCopy2 = originalImage.Convert <Gray, Byte>();
                    grayImageCopy2 = grayImageCopy2.ThresholdBinary(new Gray(100), new Gray(255));
                    colorImage     = colorImage.Copy();
                    int countMalaria = 0;
                    using (MemStorage storage = new MemStorage())
                    {
                        for (Contour <Point> contours = grayImageCopy2.FindContours(Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_TREE, storage); contours != null; contours = contours.HNext)
                        {
                            Contour <Point> currentContour = contours.ApproxPoly(contours.Perimeter * 0.015, storage);
                            if (currentContour.BoundingRectangle.Width > 20)
                            {
                                CvInvoke.cvDrawContours(colorImage, contours, new MCvScalar(255, 0, 0), new MCvScalar(255, 0, 0), -1, 2, Emgu.CV.CvEnum.LINE_TYPE.EIGHT_CONNECTED, new Point(0, 0));
                                colorImage.Draw(currentContour.BoundingRectangle, new Bgr(0, 255, 0), 1);
                                countMalaria++;
                            }
                        }
                    }

                    colorImage.Save(Server.MapPath(DefaultFileName2) + FileUploader.FileName);

                    inputDiv.Attributes["style"]  = "display: block; margin-left: auto; margin-right: auto";
                    outputDiv.Attributes["style"] = "display: block; margin-left: auto; margin-right: auto";
                    Image1.ImageUrl = this.ResolveUrl(DefaultFileName + FileUploader.FileName);
                    Image2.ImageUrl = this.ResolveUrl(DefaultFileName2 + FileUploader.FileName);
                    Chart1.DataBindTable(GrayHist);
                    Label1.Text = "Uploaded Successfully";
                    Label2.Text = "File name: " +
                                  FileUploader.PostedFile.FileName + "<br>" + "File Size: " +
                                  FileUploader.PostedFile.ContentLength + " kb<br>" + "Content type: " + FileUploader.PostedFile.ContentType + "<br>"
                                  + "Resolution: " + width.ToString() + "x" + height.ToString() + "<br>"
                                  + "Number of channels: " + channels.ToString() + "<br>"
                                  + "Histogram (maximum value): " + largestHist + " @ " + thresholdHist;

                    LabelRed.Text     = countRedCells.ToString();
                    LabelMalaria.Text = countMalaria.ToString();
                }
                catch (Exception ex)
                {
                    Label1.Text = "ERROR: " + ex.Message.ToString();
                    Label2.Text = "";
                }
            }
            else
            {
                Label1.Text = "You have not specified a file.";
                Label2.Text = "";
            }
        }