public void SetApiKeyRoles(IEnumerable <ApiKeyRole> roles) { _privateKeyLabels.Clear(); _publicKeyLabels.Clear(); _panels.Clear(); apiKeysGroupBox.Controls.Clear(); var top = 30; foreach (var role in roles) { var topControls = 28; var groupBox = new GroupBox { Text = ApiKeyRoleCaption.Caption(role), Parent = apiKeysGroupBox, Location = new Point(14, top), Size = new Size(267, topControls + 60), Tag = role, }; var privateKeyLabel = new Label { Text = PrivateKeyText, Location = new Point(3, topControls + 3), Parent = groupBox, AutoSize = true, }; _privateKeyLabels.Add(privateKeyLabel); var privateTextBox = new TextBox { Location = new Point(70, topControls), Size = new Size(191, 20), Parent = groupBox, Tag = role, Name = PrivateControlName, }; privateTextBox.TextChanged += PrivateTextBox_TextChanged; var publicKeyLabel = new Label { Text = PublicKeyText, Location = new Point(3, topControls + 29), Parent = groupBox, AutoSize = true, }; _publicKeyLabels.Add(publicKeyLabel); var publicTextBox = new TextBox { Location = new Point(70, topControls + 26), Size = new Size(191, 20), Parent = groupBox, Tag = role, Name = PublicControlName, }; publicTextBox.TextChanged += PublicTextBox_TextChanged; top = top + 100; _panels.Add(groupBox); } }
private string ApiKeySettingsName(ApiKeyRole role, bool isPrivateKey) { var name = isPrivateKey ? "PrivateKey" : "PublicKey"; return(ApiKeyRoleCaption.Caption(role) + name); }
public void ApplyLocale() { _privateKeyLabels.ForEach(l => l.Text = PrivateKeyText); _publicKeyLabels.ForEach(l => l.Text = PublicKeyText); _panels.ForEach(p => p.Text = ApiKeyRoleCaption.Caption((ApiKeyRole)p.Tag)); }