コード例 #1
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tbClassificationFile.Text)
         || string.IsNullOrEmpty(tbMVFeaturesFile.Text))
     {
         MessageBox.Show(this, "Debe seleccionar ambos archivos para poder importar los datos.", "Ha ocurrido un error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         return;
     }
     var classificationFileImport = new EBoxClassificationFileImport();
     classificationFileImport.Import(tbClassificationFile.Text);
     var mvfeaturesFileImport = new EBoxMVFeaturesFileImport();
     mvfeaturesFileImport.Import(tbMVFeaturesFile.Text);
     _parent.AddEBoxClassificationFileContent(classificationFileImport.FileInfo, classificationFileImport.FileContent);
     _parent.AddEBoxMVFeaturesFileContent(mvfeaturesFileImport.FileInfo, mvfeaturesFileImport.FileContent);
     if (!string.IsNullOrEmpty(tbVideoFile.Text))
     {
         var videoFileImport = new EBoxVideoFileFileImport();
         videoFileImport.Import(tbVideoFile.Text);
         _parent.AddEBoxVideoFile(videoFileImport.FileInfo);
     }
     this.Close();
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ngcbassman/ebox
        private void ofdOpenProject_FileOk(object sender, CancelEventArgs e)
        {
            var fileName = ofdOpenProject.FileName;
            var doc = XDocument.Load(fileName);
            var projectName = doc.Root.Element("Name").Value;
            var files = doc.Descendants("File");
            var classificationFilePath = files.First().Element("Path").Value;
            var classificationFileImport = new EBoxClassificationFileImport();
            classificationFileImport.Import(classificationFilePath);

            var tbMVFeaturesFilePath = files.ElementAt(1).Element("Path").Value;
            var mvfeaturesFileImport = new EBoxMVFeaturesFileImport();
            mvfeaturesFileImport.Import(tbMVFeaturesFilePath);

            AddEBoxClassificationFileContent(classificationFileImport.FileInfo, classificationFileImport.FileContent);
            AddEBoxMVFeaturesFileContent(mvfeaturesFileImport.FileInfo, mvfeaturesFileImport.FileContent);

            var tbVideoFilePath = files.Last().Element("Path").Value;
            if (!string.IsNullOrEmpty(tbVideoFilePath))
            {
                var videoFileImport = new EBoxVideoFileFileImport();
                videoFileImport.Import(tbVideoFilePath);
                AddEBoxVideoFile(videoFileImport.FileInfo);
            }
            ProjectName = projectName;
            this.Text = string.Format("EBox - {0}", ProjectName);
            saveProjectToolStripMenuItem.Enabled = true;
        }