Remove scoped blocks in ReplayBrowserLogic.
This commit is contained in:
@@ -371,10 +371,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void SetupManagement()
|
void SetupManagement()
|
||||||
{
|
{
|
||||||
{
|
var renameButton = panel.Get<ButtonWidget>("MNG_RENSEL_BUTTON");
|
||||||
var button = panel.Get<ButtonWidget>("MNG_RENSEL_BUTTON");
|
renameButton.IsDisabled = () => selectedReplay == null;
|
||||||
button.IsDisabled = () => selectedReplay == null;
|
renameButton.OnClick = () =>
|
||||||
button.OnClick = () =>
|
|
||||||
{
|
{
|
||||||
var r = selectedReplay;
|
var r = selectedReplay;
|
||||||
var initialName = Path.GetFileNameWithoutExtension(r.FilePath);
|
var initialName = Path.GetFileNameWithoutExtension(r.FilePath);
|
||||||
@@ -406,7 +405,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
Action<ReplayMetadata, Action> onDeleteReplay = (r, after) =>
|
Action<ReplayMetadata, Action> onDeleteReplay = (r, after) =>
|
||||||
{
|
{
|
||||||
@@ -423,10 +421,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
var deleteButton = panel.Get<ButtonWidget>("MNG_DELSEL_BUTTON");
|
||||||
var button = panel.Get<ButtonWidget>("MNG_DELSEL_BUTTON");
|
deleteButton.IsDisabled = () => selectedReplay == null;
|
||||||
button.IsDisabled = () => selectedReplay == null;
|
deleteButton.OnClick = () =>
|
||||||
button.OnClick = () =>
|
|
||||||
{
|
{
|
||||||
onDeleteReplay(selectedReplay, () =>
|
onDeleteReplay(selectedReplay, () =>
|
||||||
{
|
{
|
||||||
@@ -434,12 +431,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
SelectFirstVisibleReplay();
|
SelectFirstVisibleReplay();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
{
|
var deleteAllButton = panel.Get<ButtonWidget>("MNG_DELALL_BUTTON");
|
||||||
var button = panel.Get<ButtonWidget>("MNG_DELALL_BUTTON");
|
deleteAllButton.IsDisabled = () => replayState.Count(kvp => kvp.Value.Visible) == 0;
|
||||||
button.IsDisabled = () => replayState.Count(kvp => kvp.Value.Visible) == 0;
|
deleteAllButton.OnClick = () =>
|
||||||
button.OnClick = () =>
|
|
||||||
{
|
{
|
||||||
var list = replayState.Where(kvp => kvp.Value.Visible).Select(kvp => kvp.Key).ToList();
|
var list = replayState.Where(kvp => kvp.Value.Visible).Select(kvp => kvp.Key).ToList();
|
||||||
if (list.Count == 0)
|
if (list.Count == 0)
|
||||||
@@ -464,7 +459,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void RenameReplay(ReplayMetadata replay, string newFilenameWithoutExtension)
|
void RenameReplay(ReplayMetadata replay, string newFilenameWithoutExtension)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user