internal ServerBase(IServerConfig config, IDeviceContainer deviceContainer = null, ILogContainer logContainer = null) { if (config == null) { throw new ArgumentNullException("配制信息", "参数为空"); } ServerConfig = config; _deviceContainer = deviceContainer; if (_deviceContainer != null) { _deviceContainer.MouseRightContextMenu += Device_MouseRightContextMenu; } if (logContainer == null) { logContainer = new ConsoleContainer(); } Logger = (new LogFactory()).GetLog(ServerName, logContainer); _monitorException = new MonitorException(); ServiceManager = new ServiceManager(Logger); GraphicsShowManager = new GraphicsShowManager(Logger); DeviceManager = new DeviceManager(Logger); ChannelManager = new ChannelManager(Logger); ControllerManager = new ControllerManager(Logger); IsDisposed = false; }
/// <summary> /// 执行一次监控 /// </summary> /// <returns></returns> protected override async Task OnCheckMonitorAsync() { var drive = new System.IO.DriveInfo(this.DriveName); if (drive.IsReady == false) { var ex = new MonitorException($"磁盘{this.DriveName}不存在"); await this.NotifyAsync(ex); } else { var freeSpaceMB = drive.TotalFreeSpace / 1024 / 1024; if (freeSpaceMB < this.Options.MinFreeSpaceMB) { var ex = new MonitorException($"磁盘{this.DriveName}的可用空间已经不足{this.Options.MinFreeSpaceMB}MB"); await this.NotifyAsync(ex); } } }
protected AppServerBase(string serverName, IConfig config) { if (String.IsNullOrEmpty(serverName) || config == null) { throw new ArgumentNullException("服务名称或配制信息", "参数为空"); } _monitorException = new MonitorException(); IsDisposed = false; ServerName = serverName; Config = config; Logger = (new LogFactory()).GetLog(serverName); DeviceManager = new DeviceManager(); ChannelManager = new ChannelManager(); ControllerManager = new ControllerManager(); }
internal ServerBase(IServerConfig config) { if (config == null) { throw new ArgumentNullException("配制信息", "参数为空"); } ServerConfig = config; _Shows = new Manager <string, IGraphicsShow>(); _Services = new Manager <string, IService>(); _monitorException = new MonitorException(); Logger = (new LogFactory()).GetLog(ServerName); DeviceManager = new DeviceManager(); ChannelManager = new ChannelManager(); ControllerManager = new ControllerManager(); IsDisposed = false; }
private void OnMonitorException(DeviceMonitorExceptionEventArgs args) { MonitorException?.Invoke(this, args); }