/// <summary> /// On startup, register synchronization context /// </summary> /// <param name="e"></param> protected override async void OnStartup(StartupEventArgs e) { TelemetryConfiguration.Active.TelemetryInitializers.Add(new PopcornApplicationInsightsInitializer()); var builder = TelemetryConfiguration.Active.TelemetryProcessorChainBuilder; builder.UseAdaptiveSampling(1); builder.Build(); await ApplicationInsightsHelper.Initialize(); base.OnStartup(e); WatchStart = Stopwatch.StartNew(); Logger.Info( "Popcorn starting..."); Unosquare.FFME.MediaElement.FFmpegDirectory = Constants.FFmpegPath; try { var userService = SimpleIoc.Default.GetInstance <IUserService>(); await userService.GetUser(); await Task.Run(async() => { var netsh = new NetSH(new Utils.CommandLineHarness()); var showResponse = netsh.Http.Show.UrlAcl(Constants.ServerUrl); if (showResponse.ResponseObject.Count == 0) { if (!Helper.IsAdministrator()) { RestartAsAdmin(); } else { RegisterUrlAcl(); } } if (!await FirewallRuleExists("Popcorn Server")) { if (!Helper.IsAdministrator()) { RestartAsAdmin(); } else { await RegisterFirewallRule(); } } _localServer = WebApp.Start <Startup>(Constants.ServerUrl); }); } catch (Exception ex) { Logger.Error(ex); } }
/// <summary> /// On startup, register synchronization context /// </summary> /// <param name="e"></param> protected override void OnStartup(StartupEventArgs e) { var config = TelemetryConfiguration.CreateDefault(); config.TelemetryInitializers.Add(new PopcornApplicationInsightsInitializer()); ApplicationInsightsHelper.Initialize(config); base.OnStartup(e); WatchStart = Stopwatch.StartNew(); Logger.Info( "Popcorn starting..."); Unosquare.FFME.Library.FFmpegDirectory = Constants.FFmpegPath; }
/// <summary> /// On startup, register synchronization context /// </summary> /// <param name="e"></param> protected override async void OnStartup(StartupEventArgs e) { TelemetryConfiguration.Active.TelemetryInitializers.Add(new PopcornApplicationInsightsInitializer()); ApplicationInsightsHelper.Initialize(); base.OnStartup(e); WatchStart = Stopwatch.StartNew(); Logger.Info( "Popcorn starting..."); Unosquare.FFME.Library.FFmpegDirectory = Constants.FFmpegPath; try { SQLitePCL.Batteries.Init(); var userService = SimpleIoc.Default.GetInstance <IUserService>(); await userService.GetUser(); } catch (Exception ex) { Logger.Error(ex); } }