Example #1
0
        /// <summary>
        /// 視窗讀入事件
        /// </summary>
        private void Main_Load(object sender, EventArgs e)
        {
            DeviceInfos          = GetDeviceInfos();
            DeviceStreamProfiles = GetDeviceStreamProfiles();

            InitMenuBar();

            //預設DB
            if (File.Exists("Database.zip"))
            {
                FilePath = "Database.zip";

                UserTable.Clear();
                RecognitionFaceData[]    faceData  = null;
                Dictionary <int, string> userTable = null;
                FaceDatabaseFile.Load(
                    FilePath,
                    ref faceData,
                    ref userTable);
                FaceData  = faceData;
                UserTable = userTable;
                SaveFileToolStripMenuItem.Enabled = true;
                if (realSenseProgram.recognitionConfig != null)
                {
                    realSenseProgram.recognitionConfig.SetDatabase(FaceData);
                    realSenseProgram.moduleConfiguration.ApplyChanges();
                }
                tabControl1_SelectedIndexChanged(null, null);
                AutoSaveOnStop = true;
            }
        }
Example #2
0
        private void OpenFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var open = new OpenFileDialog()
            {
                FileName    = "",
                Multiselect = false,
                Filter      = "Zip Files(*.zip)|*.zip"
            };

            if (open.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (UserTable.Count != 0)
            {
                if (MessageBox.Show(
                        "您確定要開啟檔案嗎?目前尚未儲存的結果將會遺失。",
                        "開啟舊檔",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question
                        ) != DialogResult.OK)
                {
                    return;
                }
            }
            FilePath = open.FileName;

            UserTable.Clear();
            RecognitionFaceData[]    faceData  = null;
            Dictionary <int, string> userTable = null;

            FaceDatabaseFile.Load(
                open.FileName,
                ref faceData,
                ref userTable);
            FaceData  = faceData;
            UserTable = userTable;
            SaveFileToolStripMenuItem.Enabled = true;
            if (realSenseProgram.recognitionConfig != null)
            {
                realSenseProgram.recognitionConfig.SetDatabase(FaceData);
                realSenseProgram.moduleConfiguration.ApplyChanges();
            }
            tabControl1_SelectedIndexChanged(null, null);
        }