public void Save <T>(string key, T setting) where T : class { var settingJson = JsonConvert.SerializeObject(setting); Log.Info("Save setting " + key + ": " + settingJson); _application.Properties[key] = settingJson; }
public Tuple <bool, string> StartLiving() { Tuple <bool, string> result = Valid(); if (!result.Item1) { return(result); } bool isSuccess = false; var liveStreamAddressInfo = GetliveStreamAddressInfo(); if (liveStreamAddressInfo == null) { return(OperationResult(isSuccess, $"{Name}直播流推送地址获取失败")); } if (_videoLiveBroadcast.State == RecAndLiveState.NotStart || _videoLiveBroadcast.State == RecAndLiveState.Pause) { isSuccess = _videoLiveBroadcast.StartLive(liveStreamAddressInfo.Host, liveStreamAddressInfo.Port, liveStreamAddressInfo.AppName, liveStreamAddressInfo.StreamName); if (!isSuccess) { _logger.Info(liveStreamAddressInfo.ToString()); } return(OperationResult(isSuccess, $"{Name}直播流推送失败...")); } return(OperationResult(isSuccess, $"{Name}当前正在直播")); }
protected override void OnStart(string[] args) { //#if DEBUG // Debugger.Launch(); //Launches and attaches a debugger to the process. //#endif if (!EventLog.SourceExists("DS.AFP.WindowsService.App")) { EventLog.CreateEventSource("DS.AFP.WindowsService.App", "Application"); } EventLog.WriteEntry("DS.AFP.WindowsService.App", "AFPService OnStart开始", EventLogEntryType.Information); LoggerFacade.Info("服务“{0}”启动开始".FormatString(GlobalParams.ServiceName)); bootstrapper = new Bootstrapper(LoggerFacade); bootstrapper.Run(); base.OnStart(args); LoggerFacade.Info("服务“{0}”启动结束".FormatString(GlobalParams.ServiceName)); }
void IModule.Initialize() { //ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver(x => //{ // var viewName = x.FullName; // viewName = viewName.Replace(".Views.", ".ViewModels."); // var viewAssemblyName = x.GetTypeInfo().Assembly.FullName; // var suffix = viewName.EndsWith("View") ? "Model" : "ViewModel"; // var viewModelName = string.Format(CultureInfo.InvariantCulture, "{0}{1}, {2}", viewName, suffix, viewAssemblyName); // return Type.GetType(viewModelName); //}); logger.Info($"Module {this.Description()} loaded."); Initialize(); }
/// <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(); } }
protected override void DoReport(GoogleDriveProgress value) { Logger.Info(value.Status); Description = value.Status; Current = value.Count; if (TotalFiles != null) { int index; if (TotalFiles.TryGetValue(value.Current, out index)) { Current = index + 1; Total = TotalFiles.Count; TimeRemaining = TimeSpan.FromSeconds(Total.Value - Current * TimeElapsed.Value.TotalSeconds / Current); Progress = (double)Current / TotalFiles.Count; NotifyPropertyChanged(HasRemainingArgs); NotifyPropertyChanged(AverageSpeedArgs); } } else { Progress = 0; } }
/// <summary> /// Generates an Info message /// </summary> /// <param name="facade">Logger facade to use</param> /// <param name="msg">Message to use</param> /// <param name="args">Arguments for the message</param> public static void Info(this ILoggerFacade facade, string msg, params object[] args) { facade.Info(Priority.Low, msg, args); }