private async void ExecuteSignIn() { var passwordMd5 = Password == ConfigureFile.GetValue <string>(ConfigureKeys.Password).DecryptByDes() ? Password : Password.ToMd5(); await SignInAsync(Email, passwordMd5); }
public MessageTreeEdit() { InitializeComponent(); config = new ConfigureFile(); //initConfigure(); reloadDisplay(); MessageTreeView.ContextMenuStrip = ctxmTreeView; }
//向列表中追加配置 private void appendConfigures(ConfigureFile configs) { foreach (CANMessage config in configs.GetMessage()) { try { mteMain.configure.AppendMessage(config); } catch { } } mteMain.reloadDisplay(); }
public async Task AddTest() { var builder = new ContainerBuilder(); builder.RegisterInstance(new Logger()).As <ILoggerFacade>(); var container = builder.Build(); IConfigureFile configure = new ConfigureFile().Load(@"D:\transfer-configure.json"); configure.SetValue(TransferService.DownloaderContextKey, new TransferContextSettings { MaxParallelTranspoterCount = 4 }); ITransferService service = new TransferService(container).Initialize(configure); service.Run(); }
public void UseTest() { ServicePointManager.DefaultConnectionLimit = 99999; var builder = new ContainerBuilder(); builder.RegisterInstance(new Logger()).As <ILoggerFacade>(); IContainer container = builder.Build(); IConfigureFile configure = new ConfigureFile().Load(@"D:\transfer-configure.json"); configure.SetValue(TransferService.DownloaderContextKey, new TransferContextSettings { MaxParallelTranspoterCount = 4 }); ITransferService service = new TransferService(container).Initialize(configure); service.Run(); var downloader = service.UseDefaultDownloaderBuilder() .From("http://download.accelerider.com:888/Made%20in%20Abyss.mkv") .To(@"D:\test-file2.rar") .Configure(settings => { settings.MaxErrorCount = 3; settings.AutoSwitchUri = true; settings.BlockSize = DataSize.OneMB * 50; settings.ThreadCount = 16; }) .Build(); var managedToken = service.Register(downloader).AsUnmanaged(); managedToken.Start(); while (downloader.Status != TransferStatus.Completed) { Thread.Sleep(1000); Debug.WriteLine($"{downloader.Id}: {downloader.Status} - {downloader.CompletedSize}/{downloader.TotalSize} "); } }
public void loadConfigure(ConfigureFile cfIn) { canView.Dispatcher.BeginInvoke(new Action(() => { foreach (TreeViewItem tvi in canView.Items) { tvi.Items.Clear(); } CANDecoder = new Dictionary <int, Dictionary <CANSignal, TreeViewItem> >(); foreach (CANMessage cMsg in cfIn.GetMessage()) { CANDecoder.Add(cMsg.ID, new Dictionary <CANSignal, TreeViewItem>()); foreach (CANSignal cs in cMsg.GetSignalList()) { CANDecoder[cMsg.ID].Add(cs, new TreeViewItem() { Header = NOT_ADDED }); } } })); }
public void OnLoaded(SignInPanel view) { // 1. Login info from SignUpView if (signUpArgs != null) { IsRememberMe = false; IsAutoSignIn = false; Email = signUpArgs.Username; Password = signUpArgs.Password; SignInCommand.Execute(null); signUpArgs = null; return; } // 2. If there is some residual information on username or password text box, no login information is loaded from elsewhere. if (!string.IsNullOrEmpty(Email) || !string.IsNullOrEmpty(Password)) { return; } // 3. No login info from config file. if (!CanSignIn(ConfigureFile.GetValue <string>(ConfigureKeys.Username), ConfigureFile.GetValue <string>(ConfigureKeys.Password))) { return; } // 4. Login info from config file. IsRememberMe = true; IsAutoSignIn = ConfigureFile.GetValue <bool>(ConfigureKeys.AutoSignIn); Email = ConfigureFile.GetValue <string>(ConfigureKeys.Username); Password = ConfigureFile.GetValue <string>(ConfigureKeys.Password).DecryptByDes(); if (IsAutoSignIn) { SignInCommand.Execute(null); } }
/// <summary> /// 配置文件初始化游戏窗体 /// </summary> public void InitFrmMain() { try { //ConfigureFile类读取josn赋值 Config = Configure.ReadJosn(); //初始化标题颜色 this.PnlTitle.BackColor = Config.TitleColor.ToColor(); //初始化背景颜色 this.BackColor = Config.BackColor.ToColor(); //初始化标题字体 if (this.Config.TitleFontColor) { this.LblWizard.ForeColor = Color.FromArgb(230, 230, 230); } else { this.LblWizard.ForeColor = Color.FromArgb(0, 0, 0); } //初始化标题的按键颜色和字体颜色 if (this.Config.TitleButtonColor) { this.PnlFalse.BackgroundImage = global::Obsidian.Properties.Resources.false_1; this.PnlTure.BackgroundImage = global::Obsidian.Properties.Resources.ture_1; } else { this.PnlFalse.BackgroundImage = global::Obsidian.Properties.Resources.false_2; this.PnlTure.BackgroundImage = global::Obsidian.Properties.Resources.ture_2; } } catch (Exception e) { MessageBox.Show(e.Message); } }
public void LoadConfigure(ConfigureFile configure) { ctvr.loadConfigure(configure); JavaScriptEngine.runCmd(configure.UserDefinedScript); }
public void Clear() { configure = new ConfigureFile(); }
public static void SetTXDecoder(ConfigureFile cf) { TxForm.LoadConfigure(cf); }
private async Task SignInAsync(string username, string passwordMd5) { EventAggregator.GetEvent <MainWindowLoadingEvent>().Publish(true); var httpClient = new HttpClient(); var disco = await httpClient.GetDiscoveryDocumentAsync("http://localhost:5000/"); if (disco.IsError) { Notifier.Error(disco.Error); EventAggregator.GetEvent <MainWindowLoadingEvent>().Publish(false); return; } var tokenResponse = await httpClient.RequestPasswordTokenAsync(new PasswordTokenRequest { Address = disco.TokenEndpoint, ClientId = "wpf client", ClientSecret = "77DAABEF-697A-4CC1-A400-3CC561B9AD83", Scope = "api1 openid profile", UserName = "******", Password = "******" }); if (tokenResponse.IsError) { Notifier.Error(tokenResponse.Error); EventAggregator.GetEvent <MainWindowLoadingEvent>().Publish(false); return; } var apiClient = new HttpClient(); apiClient.SetBearerToken(tokenResponse.AccessToken); var response = await apiClient.GetAsync(disco.UserInfoEndpoint); if (response.IsSuccessStatusCode) { System.Windows.Application.Current.Properties["AccessToken"] = tokenResponse.AccessToken; var content = await response.Content.ReadAsStringAsync(); Notifier.Success(Localizer["Login Success"]); } else { Notifier.Error(Localizer["Login Failed"]); EventAggregator.GetEvent <MainWindowLoadingEvent>().Publish(false); ConfigureFile.SetValue(ConfigureKeys.AutoSignIn, false); return; } // Saves data. ConfigureFile.SetValue(ConfigureKeys.Username, IsRememberMe ? username : string.Empty); ConfigureFile.SetValue(ConfigureKeys.Password, IsRememberMe ? passwordMd5.EncryptByDes() : string.Empty); ConfigureFile.SetValue(ConfigureKeys.AutoSignIn, IsAutoSignIn); // Launches main window and closes itself. ShellManager.Switch <LoginWindow, MainWindow>(); }
private void loadConfigures(ConfigureFile configs) { mteMain.configure = configs; }