-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChromeProfileDialog.cs
More file actions
21 lines (19 loc) · 1.75 KB
/
Copy pathChromeProfileDialog.cs
File metadata and controls
21 lines (19 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
namespace VoiceCommander;
public sealed class ChromeProfileDialog : Form
{
private readonly ComboBox _profiles = new();
public BrowserProfile? SelectedProfile => _profiles.SelectedItem as BrowserProfile;
public ChromeProfileDialog(string browserName, IReadOnlyList<BrowserProfile> profiles)
{
Text = $"{browserName} のユーザーを選択";
Width = 520; Height = 230; StartPosition = FormStartPosition.CenterParent; FormBorderStyle = FormBorderStyle.FixedDialog;
MaximizeBox = false; MinimizeBox = false; BackColor = Color.FromArgb(246, 248, 252); Font = new Font("Yu Gothic UI", 10);
var title = new Label { Text = "ログインユーザー(プロファイル)", AutoSize = true, Left = 28, Top = 24, Font = new Font(Font, FontStyle.Bold) };
var help = new Label { Text = "指定したユーザーでブラウザを開きます。指定しない場合は現在の既定ユーザーです。", AutoSize = true, Left = 28, Top = 52, ForeColor = Color.DimGray };
_profiles.SetBounds(28, 84, 448, 32); _profiles.DropDownStyle = ComboBoxStyle.DropDownList;
_profiles.Items.Add("指定しない"); foreach (var p in profiles) _profiles.Items.Add(p); _profiles.SelectedIndex = 0;
var ok = new Button { Text = "このユーザーを使う", DialogResult = DialogResult.OK, Left = 290, Top = 136, Width = 186, Height = 36, BackColor = Color.FromArgb(48, 103, 235), ForeColor = Color.White, FlatStyle = FlatStyle.Flat };
var cancel = new Button { Text = "キャンセル", DialogResult = DialogResult.Cancel, Left = 168, Top = 136, Width = 112, Height = 36, FlatStyle = FlatStyle.Flat };
Controls.AddRange([title, help, _profiles, ok, cancel]); AcceptButton = ok; CancelButton = cancel;
}
}