private void button7_Click(object sender, EventArgs e)
        {
            //load Button
            using (this.loadOpenFileDialog = new OpenFileDialog())
            {
                this.loadOpenFileDialog.Filter      = "XML files (*.xml)|*.xml";
                this.loadOpenFileDialog.FilterIndex = 2;

                if (loadOpenFileDialog.ShowDialog() == DialogResult.OK)
                {
                    XmlSerializer reader = new XmlSerializer(typeof(SaveStateData));
                    StreamReader  file   = new StreamReader(this.loadOpenFileDialog.FileName);

                    try
                    {
                        SaveStateData saveStateData = (SaveStateData)reader.Deserialize(file);
                        this.selectFolderFlag = saveStateData.hasFolder;
                        textBox1.Text         = saveStateData.folderDir.ToString();
                        this.dirString        = saveStateData.folderDir.ToString();
                        this.fileList         = Directory.GetFiles(dirString, "*.jpg", SearchOption.AllDirectories);
                        label2.Text           = @"Total Image in the Dir. is " + this.fileList.Length;
                        this.selectFolderFlag = false;

                        this.imageID             = saveStateData.progressCount;
                        label3.Text              = "Image Count: " + this.imageID;
                        progressBar1.Value       = imageID;
                        this.image               = new Bitmap(this.fileList[imageID]);
                        pictureBox1.Image        = (Image)image;
                        pictureBox1.SizeMode     = PictureBoxSizeMode.StretchImage;
                        processButton.Visible    = true;
                        this.processButtonFlag   = true;
                        this.gridDataset         = saveStateData.dataset;
                        this.gridDataTable       = this.gridDataset.Tables[0];
                        dataGridView1.AutoSize   = true;
                        dataGridView1.DataSource = this.gridDataset.Tables[0];
                    }
                    catch {
                        MessageBox.Show("File is corrupted..");
                    }
                    file.Close();
                }
            }
        }
        private void saveButton_Click(object sender, EventArgs e)
        {
            //save button

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter           = "xml files (*.xml)|*.xml";
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK && saveFileDialog1.FileName != string.Empty)
            {
                using (StreamWriter wr = new StreamWriter(saveFileDialog1.FileName))
                {
                    SaveStateData saveStateData = new SaveStateData(this.selectFolderFlag, this.dirString, this.gridDataset, progressBar1.Value);

                    wr.Write(saveStateData.SerializeObject());
                    wr.Close();
                }
            }
        }