Fixed null errors when service isn't running.
parent
7bb46addb7
commit
d912745622
|
@ -49,16 +49,17 @@ namespace WifiSitterGui.ViewModel
|
|||
}
|
||||
|
||||
|
||||
public List<SimpleNic> Nics { get { return NetState.Nics; } }
|
||||
public List<SimpleNic> Nics { get { return NetState?.Nics; } }
|
||||
|
||||
|
||||
public string ServiceState {
|
||||
get {
|
||||
try { if (_sc == null) _sc = new ServiceController("WifiSitter"); }
|
||||
ServiceControllerStatus status;
|
||||
try { if (_sc == null) _sc = new ServiceController("WifiSitter"); status = _sc.Status; }
|
||||
catch { return "No Service"; }
|
||||
|
||||
_sc.Refresh();
|
||||
switch (_sc.Status) {
|
||||
switch (status) {
|
||||
case ServiceControllerStatus.Running:
|
||||
return "Running";
|
||||
case ServiceControllerStatus.Stopped:
|
||||
|
|
Loading…
Reference in New Issue