Added the generator mode setting
This commit is contained in:
7 files changed
+146
-1
No files matched your search
@@ -388,9 +388,55 @@ public sealed partial class Setting : UserControl
|
||||
cultureIndices.Remove(innerLoopIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<Setting> ShowGeneratorModeSettingAsync()
|
||||
{
|
||||
var currentSetting = await AppSettings.GetGeneratorMode();
|
||||
|
||||
var settingData = new SettingUIData(
|
||||
Icon: Icons.icons8_code_512,
|
||||
SettingName: () => "Generator Mode",
|
||||
ChangeNeedsRestart: false,
|
||||
SettingExplanation: () => "The generator mode determines how the translation files are generated.",
|
||||
SettingExplanationLink: () => (string.Empty, string.Empty),
|
||||
SetupDataControl: (changeTrigger) =>
|
||||
{
|
||||
// We set up a combo box with the available actions:
|
||||
var dropdown = new ComboBox();
|
||||
dropdown.Items.Add("Automatic generation");
|
||||
dropdown.Items.Add("Manual generation");
|
||||
dropdown.SelectedIndex = currentSetting switch
|
||||
{
|
||||
SettingGeneratorMode.AUTOMATIC => 0,
|
||||
SettingGeneratorMode.MANUAL => 1,
|
||||
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
// Setup the change event handler:
|
||||
dropdown.SelectedValueChanged += (sender, args) => changeTrigger();
|
||||
dropdown.SelectedValueChanged += async (sender, args) => await AppSettings.SetGeneratorMode(dropdown.SelectedIndex switch
|
||||
{
|
||||
0 => SettingGeneratorMode.AUTOMATIC,
|
||||
1 => SettingGeneratorMode.MANUAL,
|
||||
|
||||
_ => SettingGeneratorMode.AUTOMATIC,
|
||||
});
|
||||
|
||||
// Apply the desired layout:
|
||||
dropdown.Dock = DockStyle.Fill;
|
||||
dropdown.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
|
||||
return dropdown;
|
||||
}
|
||||
);
|
||||
|
||||
return new Setting(settingData);
|
||||
}
|
||||
|
||||
public static IEnumerable<Task<Setting>> GetAllSettings()
|
||||
{
|
||||
yield return ShowGeneratorModeSettingAsync();
|
||||
yield return ShowDeepLSourceCultureSettingAsync();
|
||||
foreach (var setting in ShowCultureSettingsAsync())
|
||||
{
|
||||
|
||||
@@ -140,6 +140,16 @@ namespace UI_WinForms.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_code_512 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8_code_512", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@@ -142,6 +142,9 @@
|
||||
<data name="icons8_chat_bubble_512" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>icons8-chat-bubble-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_code_512" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>icons8-code-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_collectibles_512" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>icons8-collectibles-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Reference in new issue
Block a user