Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogInput dialogInput = new DialogInput(this, "输入数据库名称");

            if (dialogInput.ShowDialog() == true)
            {
                string name = dialogInput.Text.ToLower();


                if (vieModel_DBManagement.DataBases.Contains(name))
                {
                    new Msgbox(this, "已存在").ShowDialog();
                    return;
                }



                DB db = new DB("DataBase\\" + name);
                db.CreateTable(StaticVariable.SQLITETABLE_MOVIE);
                db.CreateTable(StaticVariable.SQLITETABLE_ACTRESS);
                db.CreateTable(StaticVariable.SQLITETABLE_LIBRARY);
                db.CreateTable(StaticVariable.SQLITETABLE_JAVDB);


                vieModel_DBManagement.DataBases.Add(name);
                //刷新主界面
                RefreshMain();
            }
        }
Пример #2
0
        private void RenameSqlite(object sender, RoutedEventArgs e)
        {
            Core.pojo.data.SqliteInfo sqliteInfo = vieModel_StartUp.CurrentDatabases[listBox.SelectedIndex];
            string      originName = sqliteInfo.Name;
            string      originPath = sqliteInfo.Path;
            DialogInput input      = new DialogInput(this, Jvedio.Language.Resources.Rename, originName);

            if (input.ShowDialog() == false)
            {
                return;
            }
            string targetName = input.Text;

            if (targetName == originName)
            {
                return;
            }
            if (string.IsNullOrEmpty(targetName) || targetName.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) != -1)
            {
                MessageCard.Show("名称非法!");
                return;
            }
            string targetPath = Path.Combine(GlobalVariable.DataPath, GlobalVariable.CurrentInfoType.ToString(), targetName + ".sqlite");

            if (File.Exists(targetPath))
            {
                MessageCard.Show(Jvedio.Language.Resources.Message_AlreadyExist);
                return;
            }
            sqliteInfo.Name = targetName;
            sqliteInfo.Path = targetPath;
            FileHelper.TryMoveFile(originPath, targetPath);
            ConfigConnection.Instance.UpdateSqliteInfoPath(sqliteInfo);
            vieModel_StartUp.ScanDatabase(); // todo 仅更新重命名的
        }
Пример #3
0
        private void NewDatabase(object sender, RoutedEventArgs e)
        {
            vieModel_StartUp.CurrentSearch = "";
            vieModel_StartUp.Sort          = true;
            vieModel_StartUp.SortType      = "创建时间";
            DialogInput input = new DialogInput(this, Jvedio.Language.Resources.NewLibrary);

            if (input.ShowDialog() == false)
            {
                return;
            }
            string targetName = input.Text;

            if (string.IsNullOrEmpty(targetName) || targetName.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) != -1)
            {
                MessageCard.Show("名称非法!");
                return;
            }
            if (vieModel_StartUp.Databases.Where(x => x.Name == targetName).Any())
            {
                MessageCard.Show(Jvedio.Language.Resources.Message_AlreadyExist);
                return;
            }

            Jvedio.Core.Command.Sqlite.CreateVideoDataBase.Execute(targetName);
            vieModel_StartUp.ScanDatabase();
        }
Пример #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogInput dialogInput = new DialogInput(this, Jvedio.Language.Resources.PleaseEnter);

            if (dialogInput.ShowDialog() == true)
            {
                string name = dialogInput.Text.ToLower();


                if (vieModel_DBManagement.DataBases.Contains(name))
                {
                    new Msgbox(this, Jvedio.Language.Resources.Message_AlreadyExist).ShowDialog();
                    return;
                }



                MySqlite db = new MySqlite("DataBase\\" + name);
                db.CreateTable(DataBase.SQLITETABLE_MOVIE);
                db.CreateTable(DataBase.SQLITETABLE_ACTRESS);
                db.CreateTable(DataBase.SQLITETABLE_LIBRARY);
                db.CreateTable(DataBase.SQLITETABLE_JAVDB);


                vieModel_DBManagement.DataBases.Add(name);
                //刷新主界面
                RefreshMain();
            }
        }