PKHeX/PKHeX.WinForms/Controls/PKM Editor/CatchRate.cs
Kurt fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00

32 lines
890 B
C#

using System;
using System.Windows.Forms;
using PKHeX.Core;
namespace PKHeX.WinForms.Controls;
public partial class CatchRate : UserControl
{
private PK1? Entity;
public CatchRate() => InitializeComponent();
public void LoadPK1(PK1 pk) => NUD_CatchRate.Value = (Entity = pk).Catch_Rate;
private void ChangeValue(object sender, EventArgs e)
{
if (Entity is null)
return;
Entity.Catch_Rate = (int)NUD_CatchRate.Value;
}
private void Clear(object sender, EventArgs e) => NUD_CatchRate.Value = 0;
private void Reset(object sender, EventArgs e)
{
if (Entity is null)
return;
var sav = WinFormsUtil.FindFirstControlOfType<IMainEditor>(this)?.RequestSaveFile;
if (sav == null)
return;
NUD_CatchRate.Value = CatchRateApplicator.GetSuggestedCatchRate(Entity, sav);
}
}