ui: fixed adding new row beeing empty
This commit is contained in:
@@ -16,18 +16,17 @@ namespace ModpackUpdater.Apps.Manager.Ui;
|
||||
|
||||
public partial class MainForm : RadForm, IMainApi
|
||||
{
|
||||
private record RecentFilesItemTag(WorkspaceConfig Config, WorkspaceFeature Feature);
|
||||
private record WorkspaceTag(IWorkspace Workspace, WorkspaceFeature Feature);
|
||||
|
||||
private WorkspaceTag? wsInfo;
|
||||
private InstallAction? tempAction;
|
||||
|
||||
Form IMainApi.MainWindow => this;
|
||||
|
||||
IWorkspace? IMainApi.CurWorkspace => wsInfo?.Workspace;
|
||||
|
||||
public IActionSetInfos? CurActionSet => radListControl_Updates.SelectedValue as IActionSetInfos;
|
||||
|
||||
private record RecentFilesItemTag(WorkspaceConfig Config, WorkspaceFeature Feature);
|
||||
|
||||
private record WorkspaceTag(IWorkspace Workspace, WorkspaceFeature Feature);
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -445,9 +444,19 @@ public partial class MainForm : RadForm, IMainApi
|
||||
|
||||
private void RadGridView_Actions_CellValueChanged(object sender, GridViewCellEventArgs e)
|
||||
{
|
||||
if (e.Row?.Tag is not InstallAction action)
|
||||
if (e.Row is null)
|
||||
return;
|
||||
|
||||
if (e.Row.Tag is not InstallAction action)
|
||||
{
|
||||
if (CurActionSet is UpdateInfo)
|
||||
action = tempAction ??= new UpdateAction();
|
||||
else if (CurActionSet is InstallInfos)
|
||||
action = tempAction ??= new InstallAction();
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
var uaction = action as UpdateAction;
|
||||
var newValue = e.Row.Cells[e.Column.Name].Value;
|
||||
var colName = e.Column.Name;
|
||||
@@ -564,21 +573,11 @@ public partial class MainForm : RadForm, IMainApi
|
||||
|
||||
private void RadGridView_Actions_UserAddedRow(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
foreach (var row in e.Rows)
|
||||
{
|
||||
if (CurActionSet is UpdateInfo uinfo)
|
||||
{
|
||||
var action = new UpdateAction();
|
||||
// ...
|
||||
uinfo.Actions.Add(action);
|
||||
}
|
||||
if (CurActionSet is InstallInfos iinfo)
|
||||
{
|
||||
var action = new InstallAction();
|
||||
// ...
|
||||
iinfo.Actions.Add(action);
|
||||
}
|
||||
}
|
||||
if (tempAction is UpdateAction uaction && CurActionSet is UpdateInfo uinfo)
|
||||
uinfo.Actions.Add(uaction);
|
||||
else if (tempAction is InstallAction iaction && CurActionSet is InstallInfos iinfo)
|
||||
iinfo.Actions.Add(iaction);
|
||||
tempAction = null;
|
||||
}
|
||||
|
||||
private void RadGridView_Actions_UserDeletingRow(object sender, GridViewRowCancelEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user