simplify splitter distance loading with an extension method
This commit is contained in:
parent
fa7ac3d4c1
commit
624493e6e2
|
@ -304,5 +304,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
bitmap.Save(file.FullName, i);
|
||||
}
|
||||
|
||||
public static void SetDistanceOrDefault(this SplitContainer splitter, int distance, int defaultDistance)
|
||||
{
|
||||
if (distance > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
splitter.SplitterDistance = distance;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
splitter.SplitterDistance = defaultDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,17 +194,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
LuaListView.AllColumns.Clear();
|
||||
SetColumns();
|
||||
|
||||
if (Settings.SplitDistance > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
splitContainer1.SplitterDistance = Settings.SplitDistance;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
splitContainer1.SplitterDistance = _defaultSplitDistance;
|
||||
}
|
||||
}
|
||||
splitContainer1.SetDistanceOrDefault(Settings.SplitDistance, _defaultSplitDistance);
|
||||
}
|
||||
|
||||
private void BranchesMarkersSplit_SplitterMoved(object sender, SplitterEventArgs e)
|
||||
|
|
|
@ -176,31 +176,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
_autosaveTimer.Start();
|
||||
}
|
||||
|
||||
// Remembering Split container logic
|
||||
if (Settings.MainVerticalSplitDistance > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
MainVertialSplit.SplitterDistance = Settings.MainVerticalSplitDistance;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MainVertialSplit.SplitterDistance = _defaultMainSplitDistance;
|
||||
}
|
||||
|
||||
}
|
||||
MainVertialSplit.SetDistanceOrDefault(
|
||||
Settings.MainVerticalSplitDistance,
|
||||
_defaultMainSplitDistance);
|
||||
|
||||
if (Settings.BranchMarkerSplitDistance > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
BranchesMarkersSplit.SplitterDistance = Settings.BranchMarkerSplitDistance;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
BranchesMarkersSplit.SplitterDistance = _defaultBranchMarkerSplitDistance;
|
||||
}
|
||||
}
|
||||
BranchesMarkersSplit.SetDistanceOrDefault(
|
||||
Settings.BranchMarkerSplitDistance,
|
||||
_defaultBranchMarkerSplitDistance);
|
||||
|
||||
TasView.Font = TasViewFont;
|
||||
CurrentTasMovie.BindMarkersToInput = Settings.BindMarkersToInput;
|
||||
|
|
Loading…
Reference in New Issue