private void PreLoadEF() { using (var dbcontext = new PdfManageModelContainer()) { Trace.WriteLine(dbcontext.UserSet.Any()); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { App.Current.Resources["Other1Name"] = Settings.Default.Other1Name; App.Current.Resources["Other2Name"] = Settings.Default.Other2Name; if (Settings.Default.SaveLog) { if (!Directory.Exists("log")) { Directory.CreateDirectory("log"); } var path = System.IO.Path.Combine("log", $"{DateTime.Now.ToFileTime()}.log"); Trace.Listeners.Add(new TextWriterTraceListener(File.OpenWrite(path))); Trace.AutoFlush = true; AppDomain.CurrentDomain.UnhandledException += (s, ex) => { Trace.WriteLine(ex); }; } if (!Directory.Exists(PdfFile.StorePath)) { Directory.CreateDirectory(PdfFile.StorePath); } LoginWindow login = new LoginWindow(); if (!(login.ShowDialog() ?? false)) { Close(); } winfromHost.Child = pdfViewer; container = new PdfManageModelContainer(); }
public static void Preload(TestContext context) { using (PdfManageModelContainer con = new PdfManageModelContainer()) { con.PdfFileSet.Any(); } }
public void Init() { container = new PdfManageModelContainer(); if (!Directory.Exists(storePath)) { Directory.CreateDirectory(storePath); } }
private async void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { Pdf = grdMain.DataContext as PdfFile; SavePath = IO.Path.Combine(storePath, Pdf.FileName); if (IO.File.Exists(SavePath)) { if (MessageBox.Show("已存在同名文件是否继续?", "存在同名文件", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return; } } using (PdfManageModelContainer container = new PdfManageModelContainer()) { txbNotice.Text = "正在复制文件..."; if (await container.AddPdfAsync(Pdf, path, SavePath)) { DialogResult = true; Close(); } } }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { try { using (PdfManageModelContainer container = new PdfManageModelContainer()) { var name = txtUsername.Text; var pwd = txtPassword.Password; if (string.IsNullOrWhiteSpace(name)) { Trace.WriteLine(txbError.Text = "用户名不能为空"); return; } if (string.IsNullOrWhiteSpace(pwd)) { Trace.WriteLine(name, txbError.Text = "密码不能为空"); return; } if (!container.Login(name, pwd)) { Trace.WriteLine(new { Name = name, Password = pwd }, txbError.Text = "密码错误"); return; } DialogResult = true; Close(); } } catch (Exception ex) { MessageBox.Show("请确认安装了x86或x64的Microsoft SQL 2014 Express LocalDb。", "数据库启动失败", MessageBoxButton.OK, MessageBoxImage.Error); Trace.Fail(ex.ToString()); } }
public void Init() { container = new PdfManageModelContainer(); }