Skip to content

Commit

Permalink
Added radiobuttons to alarm panel
Browse files Browse the repository at this point in the history
Added method for fillling dgvAlarms with addresslist for testing
  • Loading branch information
NicoSzawlo committed Mar 16, 2023
1 parent 6b66066 commit d51ff4e
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
45 changes: 45 additions & 0 deletions MainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,14 @@ private void checkUnits()
//Refresh alarm datagridview
private void btnAlmRefresh_Click(object sender, EventArgs e)
{

DataGridViewTextBoxColumn AlarmTextCol = new DataGridViewTextBoxColumn();
AlarmTextCol.Name = "Alarmtext";
AlarmTextCol.ReadOnly = true;
dgvAlarms.Columns.Add(AlarmTextCol);
foreach(Alarm alarm in AlarmsViewModel.FillAlarmList("40000", 10000, "MB"))
{
dgvAlarms.Rows.Add(alarm.Text);
}
}

#endregion
Expand Down
3 changes: 3 additions & 0 deletions MainWindow.resx
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,7 @@
i7hc9N5n0LYyBIYVNtArsj8g03CDqiD9k+POecb3kTZmJFAq/QWOk8Y/eP1MyAAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="ttAlmMemSelMixInfo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
17 changes: 16 additions & 1 deletion ViewModels/AlarmsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
using System.Text;
using System.Threading.Tasks;
using TagTool.Models;
using TagTool.Services;

namespace TagTool.ViewModels
{
public class AlarmsViewModel
{
public static List<Alarm> InitiateAlarmList(int size)
private static List<Alarm> GenerateAlarmList(int size)
{
List<Alarm> alarmList = new List<Alarm>();

Expand All @@ -20,5 +21,19 @@ public static List<Alarm> InitiateAlarmList(int size)

return alarmList;
}

public static List<Alarm> FillAlarmList(string startAddress, int size, string prefix)
{
List<Alarm> alarmList = GenerateAlarmList(size);

List<string> addressList = AddressListGenerator.MixList(startAddress, size, prefix);

for (int i = 0; i < alarmList.Count; i++)
{
alarmList[i].Text = addressList[i];
}

return alarmList;
}
}
}

0 comments on commit d51ff4e

Please sign in to comment.