Beispiel #1
0
 public void DatabaseStringLoad()
 {
     this.Text              = MultipleLangString.GetString("_loginTitle");
     this.lbUid_fixed.Text  = MultipleLangString.GetString("_account");
     this.lbpass_fixed.Text = MultipleLangString.GetString("_password");
     this.btEnter.Text      = MultipleLangString.GetString("_login");
     this.btExit.Text       = MultipleLangString.GetString("_exit");
     this.button1.Text      = MultipleLangString.GetString("_entrollment");
 }
Beispiel #2
0
 private void Database_Load(object sender, EventArgs e)
 {
     this.Text              = MultipleLangString.GetString("_loginTitle");
     this.lbUid_fixed.Text  = MultipleLangString.GetString("_account");
     this.lbpass_fixed.Text = MultipleLangString.GetString("_password");
     this.btEnter.Text      = MultipleLangString.GetString("_login");
     this.btExit.Text       = MultipleLangString.GetString("_exit");
     this.button1.Text      = MultipleLangString.GetString("_entrollment");
 }
Beispiel #3
0
        public MainFigure()
        {
            InitializeComponent();

            ExeDirectory = "";

            //-- 得到執行檔的目錄層
            String Dir = System.Windows.Forms.Application.StartupPath;

            /*for (int i = 0; i < 4; i++)
             * {
             *  DirectoryInfo DI = new DirectoryInfo(Dir);
             *
             *  //取得父代的 DirectoryInfo 類
             *  DirectoryInfo DI_parent = DI.Parent;
             *
             *  //假若父目錄存在
             *  if (DI_parent != null)
             *  {
             *      // 利用SetCurrentDirectory設定工作目錄上移
             *      Directory.SetCurrentDirectory(DI_parent.FullName);
             *      Dir = Directory.GetCurrentDirectory();
             *  }
             * }
             * String ParentDicectory = Directory.GetCurrentDirectory();
             * //-- 保存父目錄
             * ParameterPass.ParentDirectory = ParentDicectory;
             *
             * //-- 設定目錄位置
             * ExeDirectory = ParentDicectory + @"\V1.0.0.3";*/
            ExeDirectory = Dir;

            //-- 傳遞樣板資料
            Template = ParameterPass.Template;
            //-- 使用者名稱
            lbFileName_Temp.Text = Template.FileName;
            //-- 建議分數
            SuggestScore       = ParameterPass.Score[0];
            lbAdviceScore.Text = SuggestScore.ToString("0.00");// + " ~ " + ParameterPass.Score[1].ToString("0.00");
            //-- 花費時間
            lbCostTime.Text = Template.CostTime.ToString("0.00") + MultipleLangString.GetString("_sec");

            TemplateReady = true;
        }
Beispiel #4
0
 private void tmLoop_Tick(object sender, EventArgs e)
 {
     //-- 偵測到帳號登入時,切換主功能頁面,其餘功能關閉
     if (ParameterPass.MainFugure_flag == true)
     {
         tsmiDatabase.Enabled    = true;
         tsmiEntrollment.Enabled = false;
         // tsmiApplication.Enabled = true;
         tsmiDatabase.Text = MultipleLangString.GetString("_logout");
         //radioButton1.Visible = false;
         //radioButton2.Visible = false;
     }
     else
     {
         tsmiDatabase.Enabled    = true;
         tsmiEntrollment.Enabled = true;
         // tsmiApplication.Enabled = false;
     }
 }
Beispiel #5
0
        private void MainFigure_Load(object sender, EventArgs e)
        {
            this.Text = MultipleLangString.GetString("_svs");
            this.lbFilleNameTemp_fixed.Text = MultipleLangString.GetString("_userName");
            this.lbAdviceScore_fixed.Text   = MultipleLangString.GetString("_adviceScore");
            this.lbCostTime_fixed.Text      = MultipleLangString.GetString("_costTime");
            this.btNewSignature.Text        = MultipleLangString.GetString("_newSignature");
            this.lbFileNameTest_fixed.Text  = MultipleLangString.GetString("_filename");
            this.btVerification.Text        = MultipleLangString.GetString("_verification");
            this.lbScore_fixed.Text         = MultipleLangString.GetString("_currentScore");
            this.lbcurTime_fixed.Text       = MultipleLangString.GetString("_costTime");
            this.lbShape_fixed.Text         = MultipleLangString.GetString("_shape") + ":";
            this.lbPressure_fixed.Text      = MultipleLangString.GetString("_pressure") + ":";
            this.lbVelocity_fixed.Text      = MultipleLangString.GetString("_velocity") + ":";
            this.lbAcc_fixed.Text           = MultipleLangString.GetString("_acceleration") + ":";
            this.lbSignauture_fixed.Text    = MultipleLangString.GetString("_userSignature");
            this.lbAnalysis_fixed.Text      = MultipleLangString.GetString("_analysis");

            this.lbVerifyCost_fixed.Text = MultipleLangString.GetString("_verifycost") + ":";
            this.lbVerifyCost_fixed.Text = MultipleLangString.GetString("_logout");
        }
Beispiel #6
0
        private void tsmiDatabase_Click(object sender, EventArgs e)
        {
            //-- 若已開啟註冊頁面,關閉
            if (Application.OpenForms["Entrollment"] as Database != null)
            {
                Application.OpenForms["Entrollment"].Close();
            }

            if (Application.OpenForms["MainFigure"] as Database != null)
            {
                Application.OpenForms["MainFigure"].Close();
            }

            //-- 開啟登入頁面
            if (Application.OpenForms["Database"] as Database != null)
            {
                this.Size = DBformSize;
                Application.OpenForms["Database"].WindowState = FormWindowState.Maximized;
                ParameterPass.MainFugure_flag = false;
            }
            else
            {
                //-- open
                Database DBform = new Database();
                DBform.MdiParent = this;

                //-- 設定呈現大小
                DBformSize         = DBform.Size;
                this.Size          = DBform.Size;
                DBform.WindowState = FormWindowState.Maximized;

                DBform.Show();
                ParameterPass.MainFugure_flag = false;
                if (tsmiDatabase.Text == MultipleLangString.GetString("_logout"))
                {
                    tsmiDatabase.Text = MultipleLangString.GetString("_login");
                }
            }
        }
Beispiel #7
0
 void toolBarString_Update()
 {
     this.tsmiDatabase.Text    = MultipleLangString.GetString("_login");
     this.tsmiEntrollment.Text = MultipleLangString.GetString("_entrollment");
     DBform.DatabaseStringLoad();
 }
Beispiel #8
0
 private void FigureContainer_Load(object sender, EventArgs e)
 {
     this.tsmiDatabase.Text    = MultipleLangString.GetString("_login");
     this.tsmiEntrollment.Text = MultipleLangString.GetString("_entrollment");
     // this.tsmiApplication.Text = MultipleLangString.GetString("_mainFunction");
 }
Beispiel #9
0
        public FigureContainer()
        {
            InitializeComponent();
#if MYTEST
            //MultipleLangString.m_Language = "zh-TW";
            MultipleLangString.m_Language = m_Language;

            //if (m_Language == "zh-TW")
            //{
            //    radioButton1.Checked = true;
            //}
            //else if(m_Language == "en-US")
            //{
            //    radioButton2.Checked = true;
            //}
#endif



            bool userInfo = CheckUserInfo();
#if MYTEST
            userInfo = true;
#endif
            if (!userInfo)
            {
                MessageBox.Show(MultipleLangString.GetString("_usererror") + ":" + username, MultipleLangString.GetString("_warning"));
                Process p = Process.GetCurrentProcess();
                p.Kill();
            }
            try
            {
                string[] product = ReadProductID();

                // Binding Product ID (9012, 8808, 8415, 9003, 9014, 8534).
                String[] devicePathName = new String[128];
                Guid     HID_GUID       = new Guid("{0x4D1E55B2, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30}}");

                bool devicefound = false;

                for (int i = 0; i < product.Length; i++)
                {
                    if (product[i] == "")
                    {
                        continue;
                    }

                    if (FindDeviceFromGuid(HID_GUID, ref devicePathName, product[i]))
                    {
                        devicefound = true;
                        break;
                    }
                }

                // Binding computer name has "viewsonic", "Model" is { VS16270 }
                if (!devicefound)
                {
                    string INFO_REGISTRY_SECTION = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\OEMInformation";

                    object value;

                    Microsoft.Win32.RegistryKey start       = Microsoft.Win32.Registry.LocalMachine;
                    Microsoft.Win32.RegistryKey programName = start.OpenSubKey(INFO_REGISTRY_SECTION);

                    if (programName != null)
                    {
                        if ((value = programName.GetValue("Manufacturer")) != null)
                        {
                            if (value.ToString().ToLower().IndexOf("viewsonic") >= 0)
                            {
                                if ((value = programName.GetValue("Model")) != null)
                                {
                                    for (int i = 0; i < product.Length; i++)
                                    {
                                        if (value.ToString() == product[i])
                                        {
                                            devicefound = true;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        programName.Close();
                    }
                }

#if MYTEST
                devicefound = true;
#endif
                if (!devicefound)
                {
                    MessageBox.Show(MultipleLangString.GetString("_connect"), MultipleLangString.GetString("_warning"));
                    Process p = Process.GetCurrentProcess();
                    p.Kill();
                }
#if MYTEST
                Global.TrialFlag = false;
#endif
                if (Global.TrialFlag)       // trial build, it needs to check trial date
                {
                    string[] trialdate   = ReadTrialDate();
                    DateTime dt          = DateTime.Now;
                    int      trial_year  = Convert.ToInt32(trialdate[0]);
                    int      trial_month = Convert.ToInt32(trialdate[1]);
                    int      trial_day   = Convert.ToInt32(trialdate[2]);

                    if ((dt.Year > trial_year) ||
                        ((dt.Year == trial_year) && (dt.Month > trial_month)) ||
                        ((dt.Year == trial_year) && (dt.Month == trial_month) && (dt.Day > trial_day)))
                    {
                        MessageBox.Show(MultipleLangString.GetString("_trialexpired"), MultipleLangString.GetString("_info"));
                        Process p = Process.GetCurrentProcess();
                        p.Kill();
                    }
                }
            }
            catch
            {
                MessageBox.Show(MultipleLangString.GetString("_trialexpired"), MultipleLangString.GetString("_info"));
                Process p = Process.GetCurrentProcess();
                p.Kill();
            }

            //-- 初始設定,主功能關閉
            tmLoop.Enabled = true;
            //tsmiApplication.Enabled = false;

            //-- 初始畫面為登入頁面

            DBform.MdiParent = this;

            //-- open
            DBformSize         = DBform.Size;
            this.Size          = DBform.Size;
            DBform.WindowState = FormWindowState.Maximized;
            DBform.Show();

            DBform.getSize(DBformSize, EntrollformSize);

            DBform.getFrom(this);
            MainProcess.getFrom(this);
            Entrollform.getFrom(this);
        }
Beispiel #10
0
        /// <summary>
        /// 登入按鈕
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btEnter_Click(object sender, EventArgs e)
        {
            string Query;

            string connStr = "server=" + dbHost + ";port=" + dbPort + ";uid=" + dbUser + ";pwd=" + dbPass + ";database=" + dbName;
            //("server=127.0.0.1;user=root;database=test;port=3306;password=1111;")

            MySqlConnection conn = new MySqlConnection(connStr);

            //-- 連線到資料庫
            try
            {
                conn.Open();
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                Connect_flag = false;
                lbInfo.Text  = "Error";

                switch (ex.Number)
                {
                case 0:
                    lbInfo.Text = (MultipleLangString.GetString("_connectfail"));
                    break;

                case 1045:
                    lbInfo.Text = (MultipleLangString.GetString("_relogin"));
                    break;

                default:
                    lbInfo.Text = ex.Message;
                    break;
                }
            }

            //-- 伺服器連線成功
            if (Connect_flag)
            {
                Login_flag = false;

                //-- 命令與伺服器連線,通過命令來對資料庫進行存取
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection = conn;

                //-- 進行使用者帳號密碼認證
                try
                {
                    Query           = "select * from SVS.account where Uid='" + tbUid.Text + "'and Password='******';";
                    cmd.CommandText = Query;
                    MySqlDataReader Account = cmd.ExecuteReader();

                    //-- 如果沒有資料,顯示沒有資料的訊息
                    if (!Account.HasRows)
                    {
                        lbInfo.Text = (MultipleLangString.GetString("_relogin"));
                        Account.Close();
                    }
                    else
                    {
                        //-- 使用者登入成功
                        Login_flag = true;
                        Account.Close();
                        lbInfo.Text = MultipleLangString.GetString("_loginSuccess");

                        //-- 讀取使用者名稱並且顯示出來
                        Query           = "select UserName from SVS.account where Uid='" + tbUid.Text + "'and Password='******';";
                        cmd.CommandText = Query;
                        MySqlDataReader UserName = cmd.ExecuteReader();
                        while (UserName.Read())
                        {
                            lbInfo.Text = lbInfo.Text + '\n' + UserName.GetString(0);
                            Console.WriteLine("DBDBDBDBDB USER NAME: " + UserName.GetString(0));
                            //-- 記錄使用者名稱
                            TemplateData.FileName = UserName.GetString(0);
                        }
                        UserName.Close();

                        //-- 讀取最低建議分數並且顯示出來
                        Query           = "select ScoreLow from SVS.account where Uid='" + tbUid.Text + "'and Password='******';";
                        cmd.CommandText = Query;
                        MySqlDataReader Score_L = cmd.ExecuteReader();
                        while (Score_L.Read())
                        {
                            //-- 讀取最低建議分數
                            Score[0] = Score_L.GetDouble(0);
                        }
                        Score_L.Close();

                        //-- 讀取建議分數並且顯示出來
                        Query           = "select ScoreHigh from SVS.account where Uid='" + tbUid.Text + "'and Password='******';";
                        cmd.CommandText = Query;
                        MySqlDataReader Score_H = cmd.ExecuteReader();
                        while (Score_H.Read())
                        {
                            //-- 讀取最低建議分數
                            Score[1] = Score_H.GetDouble(0);
                        }
                        Score_H.Close();

                        //-- 讀取簽名花費時間並且顯示出來
                        Query           = "select CostTime from SVS.account where Uid='" + tbUid.Text + "'and Password='******';";
                        cmd.CommandText = Query;
                        MySqlDataReader CostTime = cmd.ExecuteReader();
                        while (CostTime.Read())
                        {
                            TemplateData.CostTime = CostTime.GetDouble(0);
                            Console.WriteLine("DBDBDBDBDB CostTime: " + Convert.ToString(CostTime.GetDouble(0)));
                        }
                        CostTime.Close();

                        //-- 讀取SID
                        Query           = "select SID from SVS.account where Uid='" + tbUid.Text + "'and Password='******';";
                        cmd.CommandText = Query;
                        MySqlDataReader SID_t = cmd.ExecuteReader();
                        while (SID_t.Read())
                        {
                            SID = SID_t.GetInt32(0);
                            //MessageBox.Show(SID.ToString());
                        }
                        SID_t.Close();
                    }
                }
                catch (MySql.Data.MySqlClient.MySqlException ex)
                {
                    MessageBox.Show("Error " + ex.Number + " : " + ex.Message);
                }


                if (Login_flag)
                {
                    int             Len = 0;
                    MySqlDataReader DataReader;

                    //-- X, 讀資料長度
                    Query           = "select Len from SVS.feature_x where SID='" + SID.ToString() + "';";
                    cmd.CommandText = Query;
                    DataReader      = cmd.ExecuteReader();
                    while (DataReader.Read())
                    {
                        Len = DataReader.GetInt32(0);
                        //MessageBox.Show(Len.ToString());
                    }
                    DataReader.Close();

                    for (int i = 1; i <= Len; i++)
                    {
                        Query           = "select X" + i.ToString() + " from SVS.feature_x where SID='" + SID.ToString() + "';";
                        cmd.CommandText = Query;
                        DataReader      = cmd.ExecuteReader();
                        while (DataReader.Read())
                        {
                            TemplateData.Feature_X.Add(DataReader.GetDouble(0));
                            //MessageBox.Show(SID.ToString());
                        }
                        DataReader.Close();
                    }
                    //-------------------------------------------------------------------------------------------------------------//
                    //-------------------------------------------------------------------------------------------------------------//
                    //-- Y, 讀資料長度
                    Query           = "select Len from SVS.feature_y where SID='" + SID.ToString() + "';";
                    cmd.CommandText = Query;
                    DataReader      = cmd.ExecuteReader();
                    while (DataReader.Read())
                    {
                        Len = DataReader.GetInt32(0);
                        //MessageBox.Show(Len.ToString());
                    }
                    DataReader.Close();

                    for (int i = 1; i <= Len; i++)
                    {
                        Query           = "select Y" + i.ToString() + " from SVS.feature_y where SID='" + SID.ToString() + "';";
                        cmd.CommandText = Query;
                        DataReader      = cmd.ExecuteReader();
                        while (DataReader.Read())
                        {
                            TemplateData.Feature_Y.Add(DataReader.GetDouble(0));
                            //MessageBox.Show(SID.ToString());
                        }
                        DataReader.Close();
                    }
                    //-------------------------------------------------------------------------------------------------------------//
                    //-------------------------------------------------------------------------------------------------------------//
                    //-- P, 讀資料長度
                    Query           = "select Len from SVS.feature_P where SID='" + SID.ToString() + "';";
                    cmd.CommandText = Query;
                    DataReader      = cmd.ExecuteReader();
                    while (DataReader.Read())
                    {
                        Len = DataReader.GetInt32(0);
                        //MessageBox.Show(Len.ToString());
                    }
                    DataReader.Close();

                    for (int i = 1; i <= Len; i++)
                    {
                        Query           = "select P" + i.ToString() + " from SVS.feature_p where SID='" + SID.ToString() + "';";
                        cmd.CommandText = Query;
                        DataReader      = cmd.ExecuteReader();
                        while (DataReader.Read())
                        {
                            TemplateData.Feature_P.Add(DataReader.GetDouble(0));
                            //MessageBox.Show(SID.ToString());
                        }
                        DataReader.Close();
                    }
                    //-------------------------------------------------------------------------------------------------------------//
                    //-------------------------------------------------------------------------------------------------------------//
                    //-- Vx, 讀資料長度
                    Query           = "select Len from SVS.feature_vx where SID='" + SID.ToString() + "';";
                    cmd.CommandText = Query;
                    DataReader      = cmd.ExecuteReader();
                    while (DataReader.Read())
                    {
                        Len = DataReader.GetInt32(0);
                        //MessageBox.Show(Len.ToString());
                    }
                    DataReader.Close();

                    for (int i = 1; i <= Len; i++)
                    {
                        Query           = "select Vx" + i.ToString() + " from SVS.feature_vx where SID='" + SID.ToString() + "';";
                        cmd.CommandText = Query;
                        DataReader      = cmd.ExecuteReader();
                        while (DataReader.Read())
                        {
                            TemplateData.Feature_Vx.Add(DataReader.GetDouble(0));
                            //MessageBox.Show(SID.ToString());
                        }
                        DataReader.Close();
                    }
                    //-------------------------------------------------------------------------------------------------------------//
                    //-------------------------------------------------------------------------------------------------------------//
                    //-- Vy, 讀資料長度
                    Query           = "select Len from SVS.feature_vy where SID='" + SID.ToString() + "';";
                    cmd.CommandText = Query;
                    DataReader      = cmd.ExecuteReader();
                    while (DataReader.Read())
                    {
                        Len = DataReader.GetInt32(0);
                        //MessageBox.Show(Len.ToString());
                    }
                    DataReader.Close();

                    for (int i = 1; i <= Len; i++)
                    {
                        Query           = "select Vy" + i.ToString() + " from SVS.feature_vy where SID='" + SID.ToString() + "';";
                        cmd.CommandText = Query;
                        DataReader      = cmd.ExecuteReader();
                        while (DataReader.Read())
                        {
                            TemplateData.Feature_Vy.Add(DataReader.GetDouble(0));
                            //MessageBox.Show(SID.ToString());
                        }
                        DataReader.Close();
                    }
                    //-------------------------------------------------------------------------------------------------------------//
                    //-------------------------------------------------------------------------------------------------------------//
                    //-- Ax, 讀資料長度
                    Query           = "select Len from SVS.feature_ax where SID='" + SID.ToString() + "';";
                    cmd.CommandText = Query;
                    DataReader      = cmd.ExecuteReader();
                    while (DataReader.Read())
                    {
                        Len = DataReader.GetInt32(0);
                        //MessageBox.Show(Len.ToString());
                    }
                    DataReader.Close();

                    for (int i = 1; i <= Len; i++)
                    {
                        Query           = "select Ax" + i.ToString() + " from SVS.feature_ax where SID='" + SID.ToString() + "';";
                        cmd.CommandText = Query;
                        DataReader      = cmd.ExecuteReader();
                        while (DataReader.Read())
                        {
                            TemplateData.Feature_Ax.Add(DataReader.GetDouble(0));
                            //MessageBox.Show(SID.ToString());
                        }
                        DataReader.Close();
                    }
                    //-------------------------------------------------------------------------------------------------------------//
                    //-------------------------------------------------------------------------------------------------------------//
                    //-- Ay, 讀資料長度
                    Query           = "select Len from SVS.feature_ay where SID='" + SID.ToString() + "';";
                    cmd.CommandText = Query;
                    DataReader      = cmd.ExecuteReader();
                    while (DataReader.Read())
                    {
                        Len = DataReader.GetInt32(0);
                        //MessageBox.Show(Len.ToString());
                    }
                    DataReader.Close();

                    for (int i = 1; i <= Len; i++)
                    {
                        Query           = "select Ay" + i.ToString() + " from SVS.feature_ay where SID='" + SID.ToString() + "';";
                        cmd.CommandText = Query;
                        DataReader      = cmd.ExecuteReader();
                        while (DataReader.Read())
                        {
                            TemplateData.Feature_Ay.Add(DataReader.GetDouble(0));
                            //MessageBox.Show(SID.ToString());
                        }
                        DataReader.Close();
                    }
                    //-------------------------------------------------------------------------------------------------------------//
                    //-------------------------------------------------------------------------------------------------------------//
                    //-- A, 讀資料長度
                    Query           = "select Len from SVS.feature_a where SID='" + SID.ToString() + "';";
                    cmd.CommandText = Query;
                    DataReader      = cmd.ExecuteReader();
                    while (DataReader.Read())
                    {
                        Len = DataReader.GetInt32(0);
                        //MessageBox.Show(Len.ToString());
                    }
                    DataReader.Close();

                    for (int i = 1; i <= Len; i++)
                    {
                        Query           = "select A" + i.ToString() + " from SVS.feature_a where SID='" + SID.ToString() + "';";
                        cmd.CommandText = Query;
                        DataReader      = cmd.ExecuteReader();
                        while (DataReader.Read())
                        {
                            TemplateData.Feature_A.Add(DataReader.GetDouble(0));
                            //MessageBox.Show(SID.ToString());
                        }
                        DataReader.Close();
                    }

                    //-------------------------------------------------------------------------------------------------------------//
                    //-------------------------------------------------------------------------------------------------------------//

                    //-- 取得該帳號之訊號後,傳入比對程式中
                    ParameterPass.Score    = Score;
                    ParameterPass.Template = TemplateData;

                    //-- 關閉其餘表單
                    Form[] aryf = this.Parent.FindForm().MdiChildren;
                    foreach (Form f in aryf)
                    {
                        if (f.Name != this.Name)
                        {
                            f.Close();
                        }
                    }

                    //-- 成功登入後,進入訊號比對畫面
                    MainFigure MainProcess = new MainFigure();
                    MainProcess.MdiParent   = this.MdiParent;
                    MainProcess.WindowState = FormWindowState.Maximized;
                    this.MdiParent.Size     = MainProcess.Size;
                    MainProcess.Show();

                    //-- 關閉其餘功能選項
                    ParameterPass.MainFugure_flag = true;

                    conn.Close();
                    this.Close();
                }
            }

            conn.Close();
        }
Beispiel #11
0
        private void btVerification_Click(object sender, EventArgs e)
        {
            //-- 安全分數設定 - 隨機仿冒者分數落在60-70分居多
            int SerurityScore_Norm = 80;
            int SerurityScore_Min  = 75;

            double Score = 0;

            stopWatch.Reset();
            stopWatch.Start();

            if (TemplateReady == true && TesterReady == true)
            {
                Score          = SVSystem.Recognizer(Template, Test);
                lbcurTime.Text = Test.CostTime.ToString("0.00") + MultipleLangString.GetString("_sec");

                //-- 書寫時間設定 _ 正負2秒內認可
                if (Math.Abs(Template.CostTime - Test.CostTime) > 2)
                {
                    TesterReady         = false;
                    lbScore.Text        = Score.ToString("0.00");
                    lbScore.BackColor   = Color.Red;
                    lbResultStatus.Text = MultipleLangString.GetString("_fail");
                }
                else
                {
                    if (Score < SerurityScore_Min)
                    {
                        Score               = 0;
                        lbScore.BackColor   = Color.Red;
                        lbResultStatus.Text = MultipleLangString.GetString("_fail");
                    }
                    else
                    {
                        if (Score >= SuggestScore)
                        {
                            lbScore.BackColor   = Color.LightGreen;
                            lbResultStatus.Text = MultipleLangString.GetString("_pass");
                        }
                        else if (Score >= SerurityScore_Norm && Score < SuggestScore)
                        {
                            lbScore.BackColor   = Color.LightBlue;
                            lbResultStatus.Text = MultipleLangString.GetString("_pass");
                        }
                        else if (Score < SerurityScore_Norm)
                        {
                            lbScore.BackColor   = Color.Red;
                            lbResultStatus.Text = MultipleLangString.GetString("_fail");
                        }
                    }
                    lbScore.Text = Score.ToString("0.00");
                }

                //-- The data for the chart
                double shape        = (SVSystem.Similarity[0] + SVSystem.Similarity[1] + SVSystem.Similarity[7]) * 100 / 3;
                double Pressure     = SVSystem.Similarity[2] * 100;
                double Velocity     = (SVSystem.Similarity[3] + SVSystem.Similarity[4]) * 100 / 2;
                double Acceleration = (SVSystem.Similarity[5] + SVSystem.Similarity[6]) * 100 / 2;

                double[] Similarity = { shape, Pressure, Velocity, Acceleration };

                //-- The labels for the chart
                string[] labels = { MultipleLangString.GetString("_shape"), MultipleLangString.GetString("_pressure"), MultipleLangString.GetString("_velocity"), MultipleLangString.GetString("_acceleration") };

                chtRadar.Series["Similarity"].Points.DataBindXY(labels, Similarity);
                lbShape.Text    = shape.ToString("#0.0") + '%';
                lbPressure.Text = Pressure.ToString("#0.0") + '%';
                lbVelocity.Text = Velocity.ToString("#0.0") + '%';
                lbAcc.Text      = Acceleration.ToString("#0.0") + '%';


                stopWatch.Stop();
                Console.WriteLine("Verify algorithm function cost time..." + stopWatch.ElapsedMilliseconds + " ms");
                if ((pre_costTime + stopWatch.ElapsedMilliseconds) < 2000)
                {
                    logInfoData.vcostTime = Convert.ToString((pre_costTime + stopWatch.ElapsedMilliseconds)) + "ms";
                }
                else
                {
                    logInfoData.vcostTime = "error";
                }

                lbVerifyCost.Text = logInfoData.vcostTime;

                // collect log data
                logInfoData.Score = lbScore.Text;
                if (Score < SerurityScore_Norm)
                {
                    logInfoData.Result = "FAIL";
                }
                else
                {
                    logInfoData.Result = "PASS";
                }

                logInfoData.Serurity = SerurityScore_Norm.ToString("0.00");
                // logInfoData.vcostTime = lbcurTime.Text;
                logInfoData.date = lbFileName_Test.Text;

                DialogResult myResult = MessageBox.Show("此為\"本人\"簽名嗎?", "FAR / FRR記錄", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (myResult == DialogResult.Yes)
                {
                    logInfoData.Woner = "YES";
                    ExportLogToExcel(true);
                }
                else if (myResult == DialogResult.No)
                {
                    logInfoData.Woner = "NO";
                    ExportLogToExcel(false);
                }
                DialogResult diag = MessageBox.Show("DONE", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #12
0
        private void openTest()
        {
            List <string> FileName  = new List <string>();
            List <int>    FileOrder = new List <int>();

            //-- 清除雷達圖
            chtRadar.Series["Similarity"].Points.Clear();

            //-- 清除顏色
            lbScore.BackColor = Color.White;

            //-- 取得當前目錄夾下資料
            string        path = ExeDirectory + @"\" + Template.FileName;
            DirectoryInfo di   = new DirectoryInfo(path);

            foreach (var fi in di.GetFiles("*.txt"))
            {
                FileName.Add(fi.Name);
            }


            for (int i = 0; i < FileName.Count; i++)
            {
                char[] t    = FileName[i].ToCharArray();
                int    year = Convert.ToInt32(FileName[i].Substring(0, 4));
                int    mon  = Convert.ToInt32(FileName[i].Substring(5, 2));
                int    day  = Convert.ToInt32(FileName[i].Substring(8, 2));
                int    hh   = Convert.ToInt32(FileName[i].Substring(11, 2));
                int    mm   = Convert.ToInt32(FileName[i].Substring(14, 2));
                int    ss   = Convert.ToInt32(FileName[i].Substring(17, 2));
                int    ms   = Convert.ToInt32(FileName[i].Substring(20, 2));

                FileOrder.Add(mon * 100000000 + day * 1000000 + hh * 10000 + mm * 100 + ss);
            }

            //-- 找出最大值且位置
            int Max = 0;
            int k   = 0;

            for (int i = 0; i < FileOrder.Count; i++)
            {
                if (FileOrder[i] > Max)
                {
                    Max = FileOrder[i];
                    k   = i;
                }
            }

            //-- 選擇的完整路徑
            Filename_test = path + @"\" + FileName[k].ToString();
            StreamReader TesterData = new System.IO.StreamReader(Filename_test, System.Text.Encoding.Default);

            //-- 顯示檔案名稱 for testing
            lbFileName_Test.Text = Path.GetFileName(Filename_test);

            //-- Clear all dataset
            Test.SVS_Reset();

            //-- 資料解碼
            int DataLength = 0;

            DataLength = Test.DataDecoder(TesterData);

            //-- SVS
            if (DataLength > 2)
            {
                Test.SignatureDataProcessing(DataLength);
            }

            //-- Check all feature OK
            bool FeatureError = false;

            FeatureError = Test.CheckFeature();
            if (FeatureError == true)
            {
                MessageBox.Show(MultipleLangString.GetString("_signError"));
            }
            else
            {
                TesterReady = true;
            }

            //-- 繪出原始訊號圖
            chtSignature_Test.Series["Tester"].ChartType = SeriesChartType.FastPoint;
            chtSignature_Test.Series["Tester"].Points.Clear();

            for (int i = 0; i < DataLength; i++)
            {
                chtSignature_Test.Series["Tester"].Points.AddXY(Test.X_Array[i], Test.Y_Array[i]);
            }
        }