Skip to content

Commit

Permalink
NR: Show window title; log settingsService errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jbe2277 committed Aug 22, 2023
1 parent e5647f8 commit 43251b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/NewsReader/NewsReader.MauiSystem/MauiModule.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Autofac;
using Waf.NewsReader.Presentation;

namespace Waf.NewsReader.MauiSystem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<SingleProject>true</SingleProject>

<!-- Display name -->
<ApplicationTitle>NewsReader</ApplicationTitle>
<ApplicationTitle>Waf NewsReader</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>waf.newsreader</ApplicationId>
Expand Down
6 changes: 6 additions & 0 deletions src/NewsReader/NewsReader.Presentation/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public App(ISettingsService settingsService, IAppInfoService appInfoService, Laz
this.settingsService = settingsService;
this.appInfoService = appInfoService;
InitializeLogging(Log.Default, systemTraceListener?.Create());

settingsService.ErrorOccurred += (_, e) => Log.Default.Error("SettingsService error: {0}" + e.Error);
localizationService?.Initialize();
InitializeCultures(settingsService.Get<AppSettings>());

Expand All @@ -44,6 +46,9 @@ public App(ISettingsService settingsService, IAppInfoService appInfoService, Laz
protected override Window CreateWindow(IActivationState? activationState)
{
var window = base.CreateWindow(activationState);
window.Title = AppInfo.Name;
window.MinimumWidth = 300;
window.MinimumHeight = 400;
window.Created += (_, _) => OnCreated();
window.Deactivated += (_, _) => OnDeactivated();
window.Resumed += (_, _) => OnResumed();
Expand All @@ -53,6 +58,7 @@ protected override Window CreateWindow(IActivationState? activationState)
private void OnCreated()
{
Log.Default.Info("App started {0}, {1} on {2}", appInfoService.AppName, appInfoService.VersionString, DateTime.Now.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ssK", CultureInfo.InvariantCulture));
Log.Default.Info("Device: {0} {1} {2}; Platform: {3} {4}", DeviceInfo.Idiom, DeviceInfo.Manufacturer, DeviceInfo.Model, DeviceInfo.Platform, DeviceInfo.Version);
string? appSecret = null;
GetAppCenterSecret(ref appSecret);
if (appSecret != null) AppCenter.Start(appSecret, typeof(Analytics), typeof(Crashes));
Expand Down

0 comments on commit 43251b3

Please sign in to comment.