Files
GameLauncher/AddKeyDialog.xaml.cs
armonica ae86b53147 スタイル: コーディング規約に準拠したコードフォーマットの適用(this.の明示、空白スタイルの統一)
- 自インスタンスメンバーアクセスへの this. 付与(28ファイル)
- .editorconfig に準拠したインデント・波括弧・空白スタイルの適用
- UTF-8 (BOMあり)、CRLF改行コード、行末空白除去の整合性検証
2026-10-20 10:14:26 +09:00

53 lines
1.6 KiB
C#

using System.Windows;
using System.Windows.Controls;
using GameLauncher.Models;
using GameLauncher.Engines.Unity;
namespace GameLauncher
{
/// <summary>
/// PlayerPrefsキー追加ダイアログ
/// </summary>
public partial class AddKeyDialog : Window
{
public string KeyName { get; private set; } = string.Empty;
public PlayerPrefsType KeyType { get; private set; } = PlayerPrefsType.Int;
public string KeyValue { get; private set; } = string.Empty;
public AddKeyDialog()
{
this.InitializeComponent();
this.txtKeyName.Focus();
}
private void btnOk_Click(object sender, RoutedEventArgs e)
{
var keyName = this.txtKeyName.Text.Trim();
if (string.IsNullOrWhiteSpace(keyName))
{
MessageBox.Show("キー名を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
this.KeyName = keyName;
var selectedTag = (this.cmbKeyType.SelectedItem as ComboBoxItem)?.Tag?.ToString();
this.KeyType = selectedTag switch
{
"Float" => PlayerPrefsType.Float,
"String" => PlayerPrefsType.String,
_ => PlayerPrefsType.Int
};
this.KeyValue = this.txtKeyValue.Text;
this.DialogResult = true;
this.Close();
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
}
}