-
Notifications
You must be signed in to change notification settings - Fork 1
/
HostModel.cs
41 lines (33 loc) · 913 Bytes
/
HostModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text;
namespace SSHMan
{
class HostModel : DefaultModel
{
public HostModel() => this.ReadConfig();
private void ReadConfig()
{
Items.Clear();
RaisePropertyChanged(() => Items);
var hostMap = SSHParser.MapHosts();
foreach ((_, var config) in hostMap)
{
Items.Add(config.ToEntry());
}
}
public void Clear()
{
Items.Clear();
RaisePropertyChanged(() => Items);
}
public void Update()
{
ReadConfig();
RaisePropertyChanged(() => Items);
}
public ObservableCollection<SSHHostEntry> Items { get; } = new ObservableCollection<SSHHostEntry>();
}
}