private void saveRecordedSession_Click(object sender, EventArgs e)
        {
            Project currentProject = main.currentProject;

            if (currentProject == null)
            {
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                DialogResult folderResult = fbd.ShowDialog(main);
                if (folderResult == DialogResult.OK)
                {
                    string pathToFolder = fbd.SelectedPath;

                    foreach (String fileName in new[] { tempRgbFileName, tempDepthFileName, tempConfigFileName })
                    {
                        string dstFileName = pathToFolder + Path.DirectorySeparatorChar + mapFileName[fileName];
                        if (!File.Exists(dstFileName))
                            File.Copy(fileName, dstFileName);
                    }
                }
                return;
            }

            var result = MessageBox.Show(main, "Do you want to add captured session into project " + currentProject.name +
                "?. Yes if you do, no if you want to save it into a separate folder", "Save session", MessageBoxButtons.YesNoCancel);

            switch (result)
            {
                case DialogResult.Yes:
                    SessionInfo sessionInfo = new SessionInfo(main, currentProject.name);
                    sessionInfo.StartPosition = FormStartPosition.CenterParent;
                    if (videoReader != null)
                    {
                        videoReader.Dispose();
                        videoReader = null;
                    }

                    if (depthReader != null)
                    {
                        depthReader.Dispose();
                        depthReader = null;
                    }

                    sessionInfo.okButton.Click += new System.EventHandler(this.addSessionOkClick);
                    sessionInfo.ShowDialog();
                    break;
                case DialogResult.No:
                    FolderBrowserDialog fbd = new FolderBrowserDialog();
                    DialogResult folderResult = fbd.ShowDialog(main);
                    if (folderResult == DialogResult.OK)
                    {
                        string pathToFolder = fbd.SelectedPath;

                        foreach (String fileName in new[] { tempRgbFileName, tempDepthFileName, tempConfigFileName })
                        {
                            string dstFileName = pathToFolder + Path.DirectorySeparatorChar + mapFileName[fileName];
                            Console.WriteLine("Copy to file; dstFileName " + dstFileName);
                            if (!File.Exists(dstFileName))
                                File.Copy(fileName, dstFileName);
                        }
                    }
                    break;
                case DialogResult.Cancel:
                    break;
                default:
                    break;
            }

            // Back to annotating
            main.tabs.SelectedIndex = 0;
        }
Exemple #2
0
 //Add new Session - open poup window:
 private void addNewSession()
 {
     //1)Set new session state
     newSession = true;
     //2)Show popup for session name
     SessionInfo sessionInfo = new SessionInfo(this, treeView.SelectedNode.Text);
     sessionInfo.StartPosition = FormStartPosition.CenterParent;
     sessionInfo.ShowDialog();
 }