public WindowStartUp() { InitializeComponent(); vieModel_StartUp = new VieModel_StartUp(); vieModel_StartUp.ListDatabase(); this.DataContext = vieModel_StartUp; cts = new CancellationTokenSource(); cts.Token.Register(() => Console.WriteLine("取消任务")); ct = cts.Token; }
public WindowStartUp() { InitializeComponent(); vieModel_StartUp = new VieModel_StartUp(); vieModel_StartUp.ListDatabase(); this.DataContext = vieModel_StartUp; cts = new CancellationTokenSource(); cts.Token.Register(() => Console.WriteLine("取消任务")); ct = cts.Token; FileHelper.TryDeleteFile("upgrade.bat"); FileHelper.TryDeleteDir("Temp"); }
private async void Window_Loaded(object sender, RoutedEventArgs e) { EnsureSettings(); //修复设置错误 EnsureFileExists(); //判断文件是否存在 EnsureDirExists(); //创建文件夹 MoveOldFiles(); //迁移旧文件 Jvedio.Core.ThemeLoader.loadAllThemes(); //加载主题 if (GlobalFont != null) { this.FontFamily = GlobalFont; } SetSkin(Properties.Settings.Default.Themes); //设置皮肤 InitAppData(); // 初始化应用数据 InitClean(); //清理文件 vieModel_StartUp = new VieModel_StartUp(); this.DataContext = vieModel_StartUp; //默认打开某个数据库 if (Properties.Settings.Default.OpenDataBaseDefault && File.Exists(Properties.Settings.Default.DataBasePath)) { OpenDefaultDatabase(); //启动主窗口 Main main = new Main(); try { await main.InitMovie(); } catch (Exception ex) { Logger.LogE(ex); } main.Show(); this.Close(); } else { vieModel_StartUp.InitCompleted = true; } }
public WindowStartUp() { InitializeComponent(); vieModel_StartUp = new VieModel_StartUp(); vieModel_StartUp.ListDatabase(); this.DataContext = vieModel_StartUp; cts = new CancellationTokenSource(); cts.Token.Register(() => Console.WriteLine("取消任务")); ct = cts.Token; if (File.Exists("upgrade.bat")) { try { File.Delete("upgrade.bat"); } catch { } } if (Directory.Exists("Temp")) { try { Directory.Delete("Temp", true); } catch { } } }