Example #1
0
        /// <summary>
        /// 程序启动后即读取配置文件config.ini
        /// 获取数据库的文件路径和语言设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void App_Startup(object sender, StartupEventArgs e)
        {
            AUtils t = new AUtils();
            t.ReadDbpath();
            t.ReadLang();
            t.ChooseLang(AStatic.Lang);

            
        }
Example #2
0
        private void start_button_Click(object sender, RoutedEventArgs e)
        {
            // save dbpath to config.ini
            if (db_textBox.Text != "" && key_textBox.Text != "")
            {
                AUtils tool = new AUtils();
                AEncrypter encrypter = new AEncrypter();
                // 1 weite to config.ini
                tool.WriteConfig(db_textBox.Text);
                tool.ReadDbpath();
                // 2 gen key file
                AStatic.StringKey = key_textBox.Text;
                encrypter.WriteKeyFile(key_textBox.Text);
                encrypter.ReadKeyFile();

                // 3 create db
                Createdbtable();
                DisableInit();

                // 4 envrypt db
                encrypter.EncryptFile(AStatic.DbPath);

                Window m = Application.Current.Properties["mainwindow"] as Window;
                Frame main_frame = m.FindName("main_frame") as Frame;
                main_frame.Navigate(new ASignin());

            }
            else if (db_textBox.Text == "")
            {
                db_textBox.Foreground = Brushes.Red;
                db_textBox.Text = "DB path can NOT be null";
            }
            else if (key_textBox.Text == "")
            {
                key_textBox.Foreground = Brushes.Red;
                key_textBox.Text = "Key can NOT be null";
            }
        }