示例#1
0
        //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);
            }
        }
示例#2
0
        private void opProj1_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog FBD        = new FolderBrowserDialog();
            OpenFileDialog      OFD        = new OpenFileDialog();
            ListView            item       = new ListView();
            DirectoryInfo       dir        = new DirectoryInfo(ProjectPath);
            ReviewForm1         newProject = new ReviewForm1();

            try
            {
                OFD.Multiselect      = true;
                OFD.Filter           = "XML | *.xml";
                OFD.Title            = "Please open a valid reference file:";
                OFD.RestoreDirectory = true;
                OFD.ShowDialog();

                if (OFD.ShowDialog() == DialogResult.OK)
                {
                    foreach (string fileDir in Directory.EnumerateFiles(ProjectPath))
                    {
                        projectView1.Items.Clear();
                        //info.Paths = imgList1.Items.ToString();
                        projectView1.Items.Add(OFD.FileName);
                    }

                    foreach (string file in Directory.EnumerateDirectories(ProjectPath))
                    {
                        DirectoryInfo dirInfo = new DirectoryInfo(file);
                        this.projectView1.Items.Add(dirInfo.Name);
                    }
                }
                else
                {
                    MessageBox.Show("Please select valid reference file(s).");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ProjectForm1", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            string          constring   = "Data Source= C:/Xamarin_Projects/Old/042514/ScreenshotReviewer2/ScreenshotReviewerDB1.sdf";
            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);
            SqlCeDataReader myReader;

            try
            {
                conDataBase.Open();
                myReader = cmdDataBase.ExecuteReader();
                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"];
                XmlSerializer xs          = new XmlSerializer(typeof(Information1));
                FileStream    readXML     = new FileStream(OFD.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                Information1  info        = (Information1)xs.Deserialize(readXML);

                while (myReader.Read())
                {
                    ReviewForm1.Comments1.Text    = Comment;
                    ReviewForm1.ImageData1        = ImageData1;
                    ReviewForm1.ImageData2        = ImageData2;
                    ReviewForm1.ImageStatus1.Text = ImageStatus;
                    ReviewForm1.ImageStatus2.Text = ImageStatus;
                    ReviewForm1.ImageStatus3.Text = ImageStatus;
                    ReviewForm1.ImageStatus4.Text = ImageStatus;
                    ReviewForm1.Tags1.Text        = Tags;
                    usrName1.Text          = UserName;
                    ReviewForm1.Lang1.Text = Lang;
                    ReviewForm1.Lang2.Text = Lang;
                    ReviewForm1.Lang3.Text = Lang;
                    ReviewForm1.Lang4.Text = Lang;
                    ReviewForm1.Lang5.Text = Lang;
                    ReviewForm1.Lang6.Text = Lang;
                    //ReviewForm1.ImagePath.Text =
                    newProject.ShowDialog();
                    readXML.Close();
                    conDataBase.Close();
                }
                this.Hide();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ProjectForm1", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }