コード例 #1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (Properties.Settings.Default.Opacity_Main >= 0.5)
     {
         App.Current.Windows[0].Opacity = Properties.Settings.Default.Opacity_Main;
     }
     else
     {
         App.Current.Windows[0].Opacity = 1;
     }
     StaticVariable.InitVariable();
     new PopupWindow(this, "保存成功").Show();
 }
コード例 #2
0
ファイル: WindowStartUp.xaml.cs プロジェクト: jdk6979/Jvedio
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //更新配置文件
            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }


            //判断文件是否存在
            CheckFile();


            //修复设置错误
            CheckSettings();


            //Properties.Settings.Default.Reset();
            if (!Directory.Exists(Properties.Settings.Default.BasePicPath))
            {
                Properties.Settings.Default.BasePicPath = AppDomain.CurrentDomain.BaseDirectory + "Pic\\";
            }


            //创建 Log文件夹
            if (!Directory.Exists("log"))
            {
                Directory.CreateDirectory("log");
            }
            //创建 ScanLog 文件夹
            if (!Directory.Exists("log\\scanlog"))
            {
                Directory.CreateDirectory("log\\scanlog");
            }
            //创建 DataBase 文件夹
            if (!Directory.Exists("DataBase"))
            {
                Directory.CreateDirectory("DataBase");
            }

            //创建备份文件夹
            if (!Directory.Exists("BackUp"))
            {
                Directory.CreateDirectory("BackUp");
            }



            SetSkin();
            //初始化数据库
            InitDataBase();
            statusText.Text = "启动中……";



            //初始化参数
            Identify.InitFanhaoList();
            Scan.InitSearchPattern();
            StaticVariable.InitVariable();

            //创建图片文件夹
            if (!Directory.Exists(StaticVariable.BasePicPath + "ScreenShot\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "ScreenShot\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "SmallPic\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "SmallPic\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "BigPic\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "BigPic\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "ExtraPic\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "ExtraPic\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "Actresses\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "Actresses\\");
            }



            //输入密码
            //DialogInput dialogInput = new DialogInput(this,"请输入密码", "123");
            //if (dialogInput .ShowDialog()== false) { this.Close(); } else
            //{
            //    string password = dialogInput.Text;
            //    if (password != "123")
            //    {
            //        this.Close();
            //    }
            //}



            if (Properties.Settings.Default.OpenDataBaseDefault)
            {
                if (Properties.Settings.Default.ScanGivenPath)
                {
                    await Task.Run(() =>
                    {
                        this.Dispatcher.BeginInvoke(new Action(() => { statusText.Text = $"扫描指定文件夹"; }), System.Windows.Threading.DispatcherPriority.Render);
                        List <string> filepaths = Scan.ScanPaths(ReadScanPathFromConfig(Properties.Settings.Default.DataBasePath.Split('\\').Last().Split('.').First()), ct);
                        DataBase cdb            = new DataBase();
                        Scan.DistinctMovieAndInsert(filepaths, ct);
                    }, cts.Token);
                }



                //启动主窗口
                Main main = new Main();
                statusText.Text = "初始化影片";
                main.InitMovie();


                main.Show();
                this.Close();
            }
            else
            {
                SelectDbBorder.Visibility = Visibility.Visible;
            }
        }
コード例 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //更新配置文件
            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }


            //判断文件是否存在
            CheckFile();


            //修复设置错误
            CheckSettings();


            //Properties.Settings.Default.Reset();
            if (!Directory.Exists(Properties.Settings.Default.BasePicPath))
            {
                Properties.Settings.Default.BasePicPath = AppDomain.CurrentDomain.BaseDirectory + "Pic\\";
            }


            //创建 Log文件夹
            if (!Directory.Exists("log"))
            {
                Directory.CreateDirectory("log");
            }
            //创建 ScanLog 文件夹
            if (!Directory.Exists("log\\scanlog"))
            {
                Directory.CreateDirectory("log\\scanlog");
            }
            //创建 DataBase 文件夹
            if (!Directory.Exists("DataBase"))
            {
                Directory.CreateDirectory("DataBase");
            }

            //创建备份文件夹
            if (!Directory.Exists("BackUp"))
            {
                Directory.CreateDirectory("BackUp");
            }



            SetSkin();

            statusText.Text = "启动中……";
            InitDataBase();          //初始化数据库
            InitJav321IDConverter(); //初始化 jav321,多 30M 内存
            //初始化参数
            Identify.InitFanhaoList();
            Scan.InitSearchPattern();
            StaticVariable.InitVariable();
            Net.Init();

            //创建图片文件夹
            if (!Directory.Exists(StaticVariable.BasePicPath + "ScreenShot\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "ScreenShot\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "SmallPic\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "SmallPic\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "BigPic\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "BigPic\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "ExtraPic\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "ExtraPic\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "Actresses\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "Actresses\\");
            }
            if (!Directory.Exists(StaticVariable.BasePicPath + "Gif\\"))
            {
                Directory.CreateDirectory(StaticVariable.BasePicPath + "Gif\\");
            }



            if (Properties.Settings.Default.OpenDataBaseDefault)
            {
                OpenDefaultDatabase();//默认打开某个数据库
                //启动主窗口
                Main main = new Main();
                statusText.Text = "初始化影片";
                main.InitMovie();


                main.Show();
                this.Close();
            }
            else
            {
                SelectDbBorder.Visibility = Visibility.Visible;
            }
        }