public void AutoLogOff() { this.Dispatcher.Invoke(() => { UILogin form = new UILogin(); form.cacheName = App.curUser.User_Name; form.Template = new DPFP.Template(); form.Template.DeSerialize(App.curUser.Finger_Print); Application.Current.MainWindow = form; Application.Current.MainWindow.Show(); this.StaThread.Abort(); this.StaThread = null; this.Close(); }); }
private void Application_Startup(object sender, StartupEventArgs e) { Define.Fonts = ExCss.ReadFile(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Asset\Fonts\font-awesome.min.css")); if (!File.Exists(FileName)) { MessageBox.Show("Không tìm thấy file cấu hình!"); Application.Current.Shutdown(); return; } Registry = new ModifyRegistry(); key = Registry.Read("MTC_KEY"); if (string.IsNullOrEmpty(key)) { this.MainWindow = new MTC(); this.MainWindow.Show(); return; } setting = Config.Read(FileName,key); if (setting == null || setting.EndDate.Date< DateTime.Now.Date) { MessageBox.Show("Phần mềm đã hết hạn sử dụng."); this.MainWindow = new MTC(); this.MainWindow.Show(); return; } if (setting.temp_folder.IndexOf(@"://") < 0 || setting.temp_folder.IndexOf(@"\\")<0) { setting.temp_folder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, setting.temp_folder); } if (!System.IO.Directory.Exists(setting.temp_folder)) { System.IO.Directory.CreateDirectory(setting.temp_folder); } cache = AltaCache.Read(CacheName); TypeUsers = MysqlHelper.getTypeUserAll(); TypeMedias = new MediaTypeArray(TypeMedia.getList()); TypeDevices = new DeviceTypeArray(TypeDevice.getList()); initVLC(); if (cache.autoLogin && !string.IsNullOrEmpty(cache.hashUserName)) { int tmpResult = UserData.getUserIdByHash(cache.hashUserName); UILogin form = new UILogin(); if (tmpResult != -1) { byte[] tmp = UserData.getFingerPrinter(tmpResult); form.cacheName = UserData.getUserName(tmpResult); if (tmp != null) { form.Template = new DPFP.Template(); form.Template.DeSerialize(tmp); } form.Show(); } else { form.Show(); } return; } this.MainWindow = new UILogin(); this.MainWindow.Show(); Console.WriteLine("Debug"); }
private void Application_Startup(object sender, StartupEventArgs e) { Define.Fonts = ExCss.ReadFile(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Asset\Fonts\font-awesome.min.css")); if (!File.Exists(FileName)) { MessageBox.Show("Không tìm thấy file cấu hình!"); Application.Current.Shutdown(); return; } Registry = new ModifyRegistry(); key = Registry.Read("MTC_KEY"); if (string.IsNullOrEmpty(key)) { this.MainWindow = new MTC(); this.MainWindow.Show(); return; } setting = Config.Read(FileName, key); if (setting == null || setting.EndDate.Date < DateTime.Now.Date) { MessageBox.Show("Phần mềm đã hết hạn sử dụng."); this.MainWindow = new MTC(); this.MainWindow.Show(); return; } if (setting.temp_folder.IndexOf(@"://") < 0 || setting.temp_folder.IndexOf(@"\\") < 0) { setting.temp_folder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, setting.temp_folder); } if (!System.IO.Directory.Exists(setting.temp_folder)) { System.IO.Directory.CreateDirectory(setting.temp_folder); } cache = AltaCache.Read(CacheName); TypeUsers = MysqlHelper.getTypeUserAll(); TypeMedias = new MediaTypeArray(TypeMedia.getList()); TypeDevices = new DeviceTypeArray(TypeDevice.getList()); initVLC(); if (cache.autoLogin && !string.IsNullOrEmpty(cache.hashUserName)) { int tmpResult = UserData.getUserIdByHash(cache.hashUserName); UILogin form = new UILogin(); if (tmpResult != -1) { byte[] tmp = UserData.getFingerPrinter(tmpResult); form.cacheName = UserData.getUserName(tmpResult); if (tmp != null) { form.Template = new DPFP.Template(); form.Template.DeSerialize(tmp); } form.Show(); } else { form.Show(); } return; } this.MainWindow = new UILogin(); this.MainWindow.Show(); Console.WriteLine("Debug"); }