Skip to content

Commit

Permalink
Added refreshing of Alarm DGV to Fb selection
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoSzawlo committed Jan 16, 2023
1 parent 41f95bd commit ec144c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void btnLibraryAddAlarm_Click(object sender, EventArgs e)
//Delete Selected Alarm
private void btnLibraryDeleteAlarm_Click(object sender, EventArgs e)
{

FbList[SelectedFbId].Alarms.RemoveAt(dgvLibraryAlarms.CurrentCell.RowIndex);
}
//Change Alarm List value based on cell value
private void dgvLibraryAlarms_CellValueChanged(object sender, DataGridViewCellEventArgs e)
Expand Down Expand Up @@ -151,6 +151,7 @@ private void lvLibraryFunctionblocks_ItemSelectionChanged(object sender, ListVie
{
SelectedFbId = LibraryViewModel.selectedFb(FbList, lvLibraryFunctionblocks.SelectedIndices);
LibraryViewModel.loadFb(FbList[SelectedFbId], this.txtLibraryFbName, this.txtLibrarySize, this.txtLibraryDescription, this.dgvLibraryAlarms, this.dgvLibraryParameters);
refreshLibraryAlarmView();
}
}
catch (Exception ex)
Expand Down
1 change: 0 additions & 1 deletion Services/DataTableHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ private static DataTable InitAlarmsDt()
dt.Columns.Add("Text");
return dt;
}

}
}
7 changes: 6 additions & 1 deletion ViewModels/LibraryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public static int selectedFb(List<FunctionBlock> fbs,ListView.SelectedIndexColle
}
return selectedId;
}

public static DataGridView loadAlarmDgv(FunctionBlock fb, DataGridView dgv)
{
DataTable dt = DataTableHandler.AlarmsToDt(fb.Alarms);
Expand Down Expand Up @@ -71,6 +70,12 @@ public static List<Alarm> NewAlarm(List<Alarm> alarms)
}
return alarms;
}
public static List<Alarm> RemoveAlarm(List<Alarm> oldList, int dtIndex)
{
List<Alarm> newList = new List<Alarm>();
return newList;
}

public static List<Alarm> ModifyAlarmList(int cellPosX, int cellPosY, string cellValue, List<Alarm> alarmList)
{
switch (cellPosX)
Expand Down

0 comments on commit ec144c7

Please sign in to comment.