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