protected override void OnStartup(StartupEventArgs e) { //cracker.Cracker(120); base.OnStartup(e); //Common.SysHook.CloseScreenSave(); Log4NetHelper.InitLog(); //AppConfig.GlobalConfig.Ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //AppConfig.Save(AppConfig.GlobalConfig); //AppConfig.ReLoadTea(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); Current.DispatcherUnhandledException += App_OnDispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; GlobalUser.VER = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //if (!IsAdministrator()) //{ // MessageBox.Show("请使用管理员权限打开本程序", "启动提示", MessageBoxButton.OK, MessageBoxImage.Error); // Shutdown(); //} if (!IaCreateNew()) { MessageBox.Show("程序已经启动", "启动提示", MessageBoxButton.OK, MessageBoxImage.Error); Shutdown(); } CheckAppDefaultPath(); Task.Factory.StartNew(() => { GlobalUser.MACHINEINFO.GetDevice(); }); var viewWin = new MainLogin(); GlobalUser.LoginWin = viewWin; viewWin.DataContext = new MainLoginVM(); if (!GlobalUser.AutoLoggedIn) { viewWin.Show(); } else { viewWin.Hide(); } DisableStandby(); //var win = new TestWin(); //win.Show(); //MessageBox.Show(GlobalUser.MACHINEINFO.GetCPUName()); }
private void LogOffEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == false) { return; } string userFolder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GlobalUser.DATAFOLDER); string userDataFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GlobalUser.DATAFOLDER, $"user.dat"); UserDataModel userDataModel = new UserDataModel { UserName = GlobalUser.USER.UserName, Phone = GlobalUser.USER.Moblie, AccessToken = "", Data = new UserInfo() }; GlobalUser.USER = null; string userEncoded = Base64Provider.AESEncrypt(userDataModel.ToJsonItem(), Base64Provider.KEY, Base64Provider.IV); try { if (!Directory.Exists(userFolder)) { Directory.CreateDirectory(userFolder); } if (!File.Exists(userDataFile)) { var file = File.Create(userDataFile); file.Close(); } using (StreamWriter sw = new StreamWriter(userDataFile, false)) { sw.Write(userEncoded); } } catch (Exception e) { Log4NetHelper.Error("写入用户信息异常:", e); } //Application.Current.Dispatcher.Invoke(() => //{ // var cardResult = WebProxy(ApiType.UserLogout, GlobalUser.USER.AccessToken); //}); var winLogin = new MainLogin(); winLogin.Show(); winLogin.Focus(); Hide(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); //Common.SysHook.CloseScreenSave(); Log4NetHelper.InitLog(); //AppConfig.GlobalConfig.Ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //AppConfig.Save(AppConfig.GlobalConfig); //AppConfig.ReLoadTea(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); Current.DispatcherUnhandledException += App_OnDispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; //if (!IsAdministrator()) //{ // MessageBox.Show("请使用管理员权限打开本程序", "启动提示", MessageBoxButton.OK, MessageBoxImage.Error); // Shutdown(); //} if (!IaCreateNew()) { MessageBox.Show("程序已经启动", "启动提示", MessageBoxButton.OK, MessageBoxImage.Error); Shutdown(); } var viewWin = new MainLogin(); if (!GlobalUser.AutoLoggedIn) { viewWin.Show(); } else { viewWin.Hide(); } DisableStandby(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ml = ((Personal_App.MainLogin)(target)); #line 13 "..\..\MainLogin.xaml" this.ml.Closing += new System.ComponentModel.CancelEventHandler(this.MainLogin_Closing); #line default #line hidden #line 14 "..\..\MainLogin.xaml" this.ml.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.MainLogin_OnMouseDown); #line default #line hidden #line 14 "..\..\MainLogin.xaml" this.ml.Loaded += new System.Windows.RoutedEventHandler(this.MainLogin_OnLoaded); #line default #line hidden return; case 2: this.top = ((System.Windows.Controls.Border)(target)); return; case 3: this.LoginImage = ((System.Windows.Controls.Image)(target)); return; case 4: #line 51 "..\..\MainLogin.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnClose_OnClick); #line default #line hidden return; case 5: this.txtUsername = ((System.Windows.Controls.TextBox)(target)); #line 78 "..\..\MainLogin.xaml" this.txtUsername.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_PreviewKeyDown); #line default #line hidden #line 78 "..\..\MainLogin.xaml" this.txtUsername.KeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_KeyDown); #line default #line hidden return; case 6: this.txtPwd = ((System.Windows.Controls.PasswordBox)(target)); #line 112 "..\..\MainLogin.xaml" this.txtPwd.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_PreviewKeyDown); #line default #line hidden return; case 7: this.rtbErrBox = ((System.Windows.Controls.Label)(target)); return; case 8: this.errMsg = ((System.Windows.Controls.Label)(target)); return; case 9: this.BtnLoginIn = ((System.Windows.Controls.Button)(target)); return; case 10: this.txtNewUsername = ((System.Windows.Controls.TextBox)(target)); #line 197 "..\..\MainLogin.xaml" this.txtNewUsername.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_PreviewKeyDown); #line default #line hidden #line 197 "..\..\MainLogin.xaml" this.txtNewUsername.KeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_KeyDown); #line default #line hidden return; case 11: this.txtNewPhoneCode = ((System.Windows.Controls.TextBox)(target)); #line 235 "..\..\MainLogin.xaml" this.txtNewPhoneCode.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_PreviewKeyDown); #line default #line hidden #line 235 "..\..\MainLogin.xaml" this.txtNewPhoneCode.KeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_KeyDown); #line default #line hidden return; case 12: this.txtNewPwd = ((System.Windows.Controls.PasswordBox)(target)); #line 273 "..\..\MainLogin.xaml" this.txtNewPwd.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_PreviewKeyDown); #line default #line hidden return; case 13: this.txtTrueName = ((System.Windows.Controls.TextBox)(target)); return; case 14: this.rtbErrBox1 = ((System.Windows.Controls.Label)(target)); return; case 15: this.errMsg1 = ((System.Windows.Controls.Label)(target)); return; case 16: this.BtnRegIn = ((System.Windows.Controls.Button)(target)); return; case 17: this.txtReUsername = ((System.Windows.Controls.TextBox)(target)); #line 392 "..\..\MainLogin.xaml" this.txtReUsername.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_PreviewKeyDown); #line default #line hidden #line 392 "..\..\MainLogin.xaml" this.txtReUsername.KeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_KeyDown); #line default #line hidden return; case 18: this.txtRePhoneCode = ((System.Windows.Controls.TextBox)(target)); #line 429 "..\..\MainLogin.xaml" this.txtRePhoneCode.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_PreviewKeyDown); #line default #line hidden #line 429 "..\..\MainLogin.xaml" this.txtRePhoneCode.KeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_KeyDown); #line default #line hidden return; case 19: this.txtRePwd = ((System.Windows.Controls.PasswordBox)(target)); #line 467 "..\..\MainLogin.xaml" this.txtRePwd.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtUsername_PreviewKeyDown); #line default #line hidden return; case 20: this.rtbErrBox2 = ((System.Windows.Controls.Label)(target)); return; case 21: this.errMsg2 = ((System.Windows.Controls.Label)(target)); return; case 22: this.BtnRePwdIn = ((System.Windows.Controls.Button)(target)); return; } this._contentLoaded = true; }