//This method creates the reference document, (still testing...) public void createButton1_Click(object sender, EventArgs e) { Information1 info = new Information1(); try { ScreenshotReviewer2.ReviewForm1 frm = new ReviewForm1(); info.Comments = richTextBoxData1.Text; info.Images1 = ImageD; info.Images2 = pictureBoxData1.Image; info.ImageStatus = ImageStatus; info.Tags = textBoxData2.Text; info.Username = ProjectForm1.usrName1.Text; info.Paths = imgList1.SelectedItem.ToString(); info.Languages = Languages; info.Roles = UserRole; info.ProjectName = ProjectForm1.projName1.Text; SaveXML.SaveData(info, ProjName + ".xml"); MessageBox.Show("Temp data has been created! \n Please confirm the data is now in the grid. \nYou must also 'Save' the project to update the database."); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//This method creates the project data and root document private void creProj1_Click(object sender, EventArgs e) { ReviewForm1 fm2 = new ReviewForm1(); try { Information1 info = new Information1(); info.ProjectName = projectData1.Text; info.Roles = UserRole; info.Username = usrData1.Text; SaveXML.SaveData(info, info.ProjectName); XmlRootAttribute xRoot = new XmlRootAttribute(info.ProjectName); xRoot.Namespace = info.ProjectName; xRoot.ElementName = info.ProjectName; foreach (ListViewItem itemRow in this.projectView1.Items) { for (int counter = 0; counter < itemRow.SubItems.Count; counter++) { int ItemCount = itemRow.SubItems.Count; List <string> fileList = itemRow.SubItems.Cast <ListViewItem>().Select(item => item.Text).ToList(); } } fm2.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//This method controls the "Set Reference" image toggle private void setRefImage_CheckedChanged(object sender, EventArgs e) { Information1 info = new Information1(); if (setRefImage.Checked) { info.Images2 = this.openFileDialog1.FileName; SaveXML.SaveData(info, ProjName + ".xml"); pictureBoxData1.Load(openFileDialog1.FileName); } else { MessageBox.Show("Please select an image as reference"); } }
//This method saves the reference document review1 and updates the DB (still testing...) private void submitButton1_Click(object sender, EventArgs e) { //string constring = "Data Source = C:\Xamarin_Projects\Old\042514\ScreenshotReviewer2"; //string Query = "Select tblData1.*, tblInfo1.*, tblProject.*, tblUsers1.* from tblData1 CROSS JOIN tblInfo1 CROSS JOIN tblProject CROSS JOIN tblUsers1;"; //SqlCeConnection conDataBase = new SqlCeConnection(constring); //SqlCeCommand cmdDataBase = new SqlCeCommand(Query, conDataBase); DataForm1 fm3 = new DataForm1(); XmlSerializer xs = new XmlSerializer(typeof(Information1)); FileStream writeXML = new FileStream(ProjName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); //Information1 info = (Information1)xs.Serialize(writeXML, DGV1) Information1 info = new Information1(); //SqlCeDataReader myReader; try { SQLFunctions.Refresh(DGV1); //string Tags = (string)myReader["Tags"]; //string UserName = (string)myReader["UserName"]; //string Role = (string)myReader["Role"]; //Image ImageData1 = (Image)myReader["ImageData1"]; //Image ImageData2 = (Image)myReader["ImageData2"]; //string Lang = (string)myReader["Lang"]; //string Name = (string)myReader["Name"]; //string ImageStatus = (string)myReader["ImageStatus"]; //string Path = (string)myReader["Path"]; //string Progress = (string)myReader["Progress"]; //string ProjectName = (string)myReader["ProjectName"]; //string Comment = (string)myReader["Comment"]; info.Comments = richTextBoxData1.Text; //ImageData1 = pictureBoxData4.Image; //ImageData2 = pictureBoxData1.Image; info.ImageStatus = ImageStatus; info.Tags = textBoxData2.Text; info.Username = UserName; info.Languages = Languages; info.Progress = progressBar1.ToString(); info.Roles = UserRole; info.Paths = imgList2.Text; info.ProjectName = ProjName; while (DGV1.Focused != true) { info.Comments = DGV1.CurrentRow.Cells[7].Value.ToString(); info.Paths = DGV1.CurrentRow.Cells[1].Value.ToString(); info.Paths = DGV1.CurrentRow.Cells[3].Value.ToString(); ImageStatus = DGV1.CurrentRow.Cells[4].Value.ToString(); info.Tags = DGV1.CurrentRow.Cells[10].Value.ToString(); ProjectForm1.usrName1.Text = DGV1.CurrentRow.Cells[19].Value.ToString(); info.Paths = DGV1.CurrentRow.Cells[5].Value.ToString(); Languages = DGV1.CurrentRow.Cells[2].Value.ToString(); //info.Progress = DGV1.CurrentRow.Cells[16].Value.ToString(); UserRole = DGV1.CurrentRow.Cells[20].Value.ToString(); info.ProjectName = DGV1.CurrentRow.Cells[12].Value.ToString(); foreach (ListViewItem itemRow in this.imgList1.Items) { for (int counter = 0; counter < itemRow.SubItems.Count; counter++) { int ItemCount = itemRow.SubItems.Count; List <string> fileList = itemRow.SubItems.Cast <ListViewItem>().Select(item => item.Text).ToList(); } } } SaveXML.SaveData(info, ProjName + ".xml"); SQLFunctions.Insert(info.Username, info.Comments, info.Tags, info.Roles, info.Images2, info.Languages, info.Paths, info.ImageStatus, info.ProjectName); SQLFunctions.Refresh(DGV1); this.Validate(); this.tableAdapterManager1.UpdateAll(this.screenshotReviewerDB1DataSet1); MessageBox.Show("Data has been saved to the DB!"); fm3.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "ReviewForm1", MessageBoxButtons.OK, MessageBoxIcon.Error); } }