Refresh service state check every 5 seconds.
parent
022009680b
commit
90434792b0
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.ServiceProcess;
|
||||
using System.Text;
|
||||
using System.Timers;
|
||||
|
||||
using WifiSitter;
|
||||
using WifiSitter.Model;
|
||||
|
@ -15,16 +16,28 @@ namespace WifiSitterGui.ViewModel
|
|||
|
||||
SimpleNetworkState _netState;
|
||||
private ServiceController _sc;
|
||||
private Timer _refreshProperties;
|
||||
private WifiSitterAgentViewModel _parent;
|
||||
|
||||
#endregion // fields
|
||||
|
||||
|
||||
#region constructor
|
||||
|
||||
public MainWindowViewModel () {
|
||||
_netState = new SimpleNetworkState();
|
||||
}
|
||||
public MainWindowViewModel() { }
|
||||
|
||||
public MainWindowViewModel (WifiSitterAgentViewModel Parent) {
|
||||
_parent = Parent;
|
||||
|
||||
_refreshProperties = new Timer();
|
||||
_refreshProperties.Interval = 1000 * 5;
|
||||
_refreshProperties.AutoReset = true;
|
||||
_refreshProperties.Elapsed += (o, e) => {
|
||||
this.OnPropertyChanged("ServiceState");
|
||||
};
|
||||
_refreshProperties.Start();
|
||||
}
|
||||
|
||||
#endregion // constructor
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue