Skip to content

Commit

Permalink
Update tui to reflect changes to start method
Browse files Browse the repository at this point in the history
  • Loading branch information
amdzy committed Apr 14, 2024
1 parent 44c536b commit 8243130
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
7 changes: 1 addition & 6 deletions NetWarden.Tui/Controllers/MainController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ public MainController(Core.NetWarden netWarden)
_netWarden.ClientsChanged += OnClientsChanged;
}

public void Start()
{
_netWarden?.Start();
}

public void Exit()
{
_netWarden.StopScan();
Expand Down Expand Up @@ -130,7 +125,7 @@ public DataTable GetTableData()

private void UpdateClients()
{
Clients = _netWarden.GetClients();
Clients = _netWarden.GetClients() ?? [];
ClientsChanged?.Invoke(this, EventArgs.Empty);
}

Expand Down
12 changes: 5 additions & 7 deletions NetWarden.Tui/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public static void Main(string[] args)

Application.Init();

var netWarden = GetWarden();
var netWarden = new Core.NetWarden();
InitWarden(netWarden);
var controller = new MainController(netWarden);
controller.Start();

Application.Run(new MainView(controller));
}
Expand All @@ -36,18 +36,16 @@ public static void Main(string[] args)

}

private static Core.NetWarden GetWarden()
private static void InitWarden(Core.NetWarden netWarden)
{
try
{
var netWarden = new Core.NetWarden();
return netWarden;
netWarden.Start();
}
catch (NotSupportedException)
{
Application.Run(new SelectDeviceVew());
var netWarden = new Core.NetWarden();
return netWarden;
netWarden.Restart();
}
}

Expand Down

0 comments on commit 8243130

Please sign in to comment.