private void Handler(LiveAndRecordingOperateEventContext context) { Task.Run(() => { switch (context.EventType) { case LiveAndRecordingOperateEventType.Pause: { var paesuRsp = _serviceClient.GetResponse(_webPlatformApiFactory.CreatePauseLiveRequest()); if (!paesuRsp.Success) { _logger.Error(paesuRsp.Message); } break; } case LiveAndRecordingOperateEventType.Stop: { var stopRsp = _serviceClient.GetResponse(_webPlatformApiFactory.CreateStopLiveRequest()); if (!stopRsp.Success) { _logger.Error(stopRsp.Message); } break; } } }); }
/// <summary> /// Generates an Error entry in the log for the exception /// </summary> /// <param name="facade">Facade to use</param> /// <param name="e">Exception to log</param> public static void Error(this ILoggerFacade facade, Exception e) { facade.Error(Priority.Low, e.Message); facade.Error(Priority.Low, e.StackTrace); var inner = e.InnerException; if (inner != null) { facade.Error(inner); } }
private void UploadDocument() { OpenSelectFileDialog(_fileFilter, (fileFullName) => { try { Task.Run(() => { var result = _documentService.UploadDocument(fileFullName, StreamTransferProgress); if (!result.Item1) { MessageBox.Show(result.Item2, "系统提示"); } IsUploadCompleted = true; _isUploading = false; }); } catch (Exception ex) { MessageBox.Show(ex.Message, "系统提示"); _isUploading = false; _logger.Error(ex.Message); } }); }
public static bool CheckCorrectVersionOfAttributeAssembly(Type type) { var studentsAttributeDllFullPath = Path.Combine(_directoryName, SwpAttributesDllName + ".dll"); var studentsAttributeDllVersion = FileVersionInfo.GetVersionInfo(studentsAttributeDllFullPath).FileVersion; var swpTestToolsAttributeDllVersion = type.Assembly.GetReferencedAssemblies().First(a => a.Name == SwpAttributesDllName).Version.ToString(); var versionsAreEqual = swpTestToolsAttributeDllVersion == studentsAttributeDllVersion; if (!versionsAreEqual) { _loggerFacade.Error(String.Format("Die Versionen der {0} Assembly stimmen nicht überein. Das Tool verwendet die Version {1} und Ihre Anwendung die Version {2}", SwpAttributesDllName, swpTestToolsAttributeDllVersion, studentsAttributeDllVersion)); } return(versionsAreEqual); }
public IEnumerable <ILiveStreamAddressInfo> GetLiveStreamAddressList() { if (_liveStreamAddressInfos.Any()) { return(_liveStreamAddressInfos); } var startLiveRsp = _serviceClient.GetResponse(_webPlatformApiFactory.CreateStartLiveRequest()); if (!startLiveRsp.Success) { _logger.Error(startLiveRsp.Message); return(_liveStreamAddressInfos); } foreach (var streamInfo in startLiveRsp.Value.StreamInfo) { var temp = streamInfo.Replace("rtmp://", ""); var tempArr = temp.Split('/'); _liveStreamAddressInfos.Add(new LiveStreamAddressInfo() { Host = tempArr[0], Port = 1935, AppName = tempArr[1], StreamName = tempArr[2] }); } return(_liveStreamAddressInfos); }
private void RegistTypeToSpring(IEnumerable <ModuleInfo> moduleInfos) { if (moduleInfos == null) { return; } IEnumerable <ModuleInfo> entranceModules = moduleInfos.Where(o => o.IsModuleEntrance == true).OrderBy(p => p.ModuleIndex); foreach (ModuleInfo moduleInfo in entranceModules) { if (!this.ModuleNeedsRetrieval(moduleInfo)) { Type t = Type.GetType(moduleInfo.ModuleType, true, true); if (t == null) { Exception ex = new Exception("Exception: system cannot receive type {0}".FormatString(moduleInfo.ModuleType)); loggerFacade.Error(ex); throw ex; } RegisterTypeIfMissing(t.Name, t, true); } } this.LoadModulesThatAreReadyForLoad(); }
/// <summary> /// 退出系统 /// </summary> public void LogOut() { try { var clientDataStr = (Framework.Spring.GlobalObject.Container.GetObject("IDsEnvironment") as AFP.Common.Core.IDsEnvironment).ShareData["ClientData"] as string; if (!string.IsNullOrEmpty(clientDataStr)) { var ClientData = clientDataStr.DeserializeFromJson <ClientData>(); if (ClientData != null) { var BrowserLogOutInfo = new BrowserLogOutInfo { Uri = ClientData.configure.logOutUri, CallBack = () => { //Application.Current.Dispatcher.Invoke(new Action(() => //{ // App.Current.Shutdown(); //})); } }; EventAggregator.GetEvent <BrowserLogOutEventSignal>().Publish(BrowserLogOutInfo); //using (WebClient wc = new WebClient()) //{ // wc.DownloadString(ClientData.configure.logOutUri); logger.Info("browser logout"); //} } else { App.Current.Shutdown(); } } else { App.Current.Shutdown(); } } catch (Exception ex) { logger.Error(ex); App.Current.Shutdown(); } }
public bool Save(List <VideoDeviceAlias> videoDeviceAlias) { if (!videoDeviceAlias.Any()) { return(true); } ICollection <string> contents = new List <string>(); foreach (var item in videoDeviceAlias) { contents.Add(JsonHelper.SerializeObject(item)); } try { FileHelper.DeleteFile(_savePath, _saveFileName); FileHelper.WriteAllLines(_savePath, _saveFileName, contents); } catch (Exception ex) { _logger.Error(ex.Message); return(false); } return(true); }
/// <summary> /// 构造 /// </summary> /// <param name="container"></param> /// <param name="dsconfig"></param> protected ModuleBase(IApplicationContext container, IDsConfigurationSection dsconfig) { //#if DEBUG // Debugger.Launch(); //#endif logger = new LoggerFacade(this.GetType()); DsConfigurationManager dcm = new DsConfigurationManager(); Assembly a = this.GetType().Assembly; string contextName = a.GetName().Name.ToLower(); ParentContaioner = container; //初始化环境信息 this.InitializationDsEnvironment(dsconfig, a.FullName); logger.Debug("{0} Plug-ins start loading".FormatString(AddinInfo.AddinName)); //SyncInfo(dcm); if (File.Exists(AddinInfo.ConfigurationFilePath)) { System.Configuration.Configuration ecs = dcm.Get <System.Configuration.Configuration>(AddinInfo.ConfigurationFilePath); if (ecs == null) { logger.Error("{0} Configuration file loading exception, configuration file does not exist!".FormatString(AddinInfo.AddinName)); } CurrentAddinConfiguration = ecs; this.DsConfigurationSection = dsconfig; AddinConfigurationList.TryAdd(AddinInfo.AddinName, ecs); ParentContaioner.RegisterInstance(this); Container = ChildContainer.Create(container, contextName, ecs); GlobalObject.SetAddinContanier(AddinInfo.AddinName, Container); //初始化WCF服务 WCFServiceContainer.Create(contextName, CurrentAddinConfiguration); //初始化Socket服务 SocketServiceContainer.Create(CurrentAddinConfiguration); } logger.Debug("{0} Plug-in loaded".FormatString(AddinInfo.AddinName)); }
/// <summary> /// Generates an error entry in the log with the message, priority and arguments specified /// </summary> /// <param name="facade">Logger facade to use</param> /// <param name="priority">Priority to use</param> /// <param name="msg">Message to use</param> /// <param name="args">Arguments for the message</param> public static void Error(this ILoggerFacade facade, Priority priority, string msg, params object[] args) { facade.Error(CultureInfo.CurrentCulture, priority, msg, args); }
public static void Error(this ILoggerFacade facade, string msg, params object[] args) { facade.Error(Priority.Low, msg, args); }