mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-17 06:50:29 +00:00
First nice version
This commit is contained in:
@@ -7,58 +7,25 @@ using System.Windows.Forms;
|
||||
namespace ConfigGenerator {
|
||||
internal class ConfigPage : TabPage {
|
||||
|
||||
internal readonly ASFConfig ASFConfig;
|
||||
|
||||
private EnhancedPropertyGrid EnhancedPropertyGrid;
|
||||
private Button LoadButton, SaveButton;
|
||||
|
||||
internal ConfigPage(ASFConfig config) : base() {
|
||||
if (config == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Text = Path.GetFileNameWithoutExtension(config.FilePath);
|
||||
ASFConfig = config;
|
||||
|
||||
RefreshText();
|
||||
|
||||
EnhancedPropertyGrid = new EnhancedPropertyGrid(config);
|
||||
Controls.Add(EnhancedPropertyGrid);
|
||||
|
||||
Panel panel = new Panel() {
|
||||
Height = 20,
|
||||
Dock = DockStyle.Bottom,
|
||||
};
|
||||
|
||||
LoadButton = new Button() {
|
||||
Dock = DockStyle.Left,
|
||||
Text = "Load"
|
||||
};
|
||||
|
||||
panel.Controls.Add(LoadButton);
|
||||
|
||||
SaveButton = new Button() {
|
||||
Dock = DockStyle.Right,
|
||||
Text = "Save"
|
||||
};
|
||||
|
||||
SaveButton.Click += SaveButton_Click;
|
||||
|
||||
panel.Controls.Add(SaveButton);
|
||||
|
||||
Controls.Add(panel);
|
||||
}
|
||||
|
||||
private async void SaveButton_Click(object sender, EventArgs e) {
|
||||
if (sender == null || e == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
SaveButton.Enabled = false;
|
||||
|
||||
List<Task> tasks = new List<Task>(ASFConfig.ASFConfigs.Count);
|
||||
foreach (ASFConfig config in ASFConfig.ASFConfigs) {
|
||||
tasks.Add(Task.Run(() => config.Save()));
|
||||
config.Save();
|
||||
}
|
||||
await Task.WhenAll(tasks);
|
||||
|
||||
SaveButton.Enabled = true;
|
||||
internal void RefreshText() {
|
||||
Text = Path.GetFileNameWithoutExtension(ASFConfig.FilePath);
|
||||
}
|
||||
|
||||
private void InitializeComponent() {
|
||||
|
||||
Reference in New Issue
Block a user