/// enumを指定してレイアウト要素の内容を訂正後に変更する private void Correct(SWScale target) { // Parse float value; if (!float.TryParse(this.GetTextBox(target).Text, out value)) { this.OverwriteText(target); return; } // Correct float changed; var result = SWScaleInputCorrector.TryChange(target, value, out changed); // 訂正の必要がない=TextChangedで設定済み if (result) { return; } // Update Profile App.Profile.Open(); this.SetSWScaleValue(target, changed); App.Profile.Close(); //--------------------------------------------------------------- // Notify self this.OverwriteText(target); // Notify other controls Commands.CurrentLayoutElementVisualChanged.Execute(null, this); //--------------------------------------------------------------- }
//------------------------------------------------------------------- /// enumを指定してレイアウト要素の内容を変更する private void Change(SWScale target) { // Parse float value; if (!float.TryParse(this.GetTextBox(target).Text, out value)) { this.SetError(target, "must be float"); return; } // Correct float changed; var result = SWScaleInputCorrector.TryChange(target, value, out changed); // Error表示 if (result) { // 成功 this.ResetError(target); } else { // 失敗 this.SetWarning(target, "Return/Enter: Correct Value"); return; } // 成功: そのまま書き換え(Textは変更しない) App.Profile.Open(); this.SetSWScaleValue(target, value); App.Profile.Close(); //--------------------------------------------------------------- // Notify self // Notify other controls Commands.CurrentLayoutElementVisualChanged.Execute(null, this); //--------------------------------------------------------------- }