Skip to content

Commit

Permalink
微調整
Browse files Browse the repository at this point in the history
  • Loading branch information
Grabacr07 committed Aug 28, 2018
1 parent e35f91b commit 82f18fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions source/Grabacr07.KanColleViewer/Application.Static.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ partial class Application
{
static Application()
{
AppDomain.CurrentDomain.UnhandledException += (sender, args) => ReportException(sender, args.ExceptionObject as Exception);
AppDomain.CurrentDomain.UnhandledException += (sender, args) => ReportException("AppDomain", sender, args.ExceptionObject as Exception);

TelemetryClient = new TelemetryClient();
TelemetryClient.Context.Session.Id = Guid.NewGuid().ToString();
Expand Down Expand Up @@ -73,29 +73,29 @@ private static bool BootstrapProxy()
return vmodel.DialogResult;
}

private static void ReportException(object sender, Exception exception)
private static void ReportException(string caller, object sender, Exception exception)
{
var now = DateTimeOffset.Now;
var path = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
ProductInfo.Company,
ProductInfo.Product,
"ErrorReports",
$"ErrorReport-{now:yyyyMMdd-HHmmss}-{now.Millisecond:000}.log");

var message = $@"*** Error Report ***
try
{
var now = DateTimeOffset.Now;
var path = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
ProductInfo.Company,
ProductInfo.Product,
"ErrorReports",
$"ErrorReport-{now:yyyyMMdd-HHmmss}-{now.Millisecond:000}.log");

var message = $@"*** Error Report ({caller}) ***
{ProductInfo.Product} ver.{ProductInfo.VersionString}
{DateTimeOffset.Now}
{now}
{new SystemEnvironment()}
Sender: {sender.GetType().FullName}
Exception: {exception.GetType().FullName}
Sender: {(sender is Type t ? t : sender?.GetType())?.FullName}
Exception: {exception?.GetType().FullName}
{exception}
";
try
{
// ReSharper disable once AssignNullToNotNullAttribute
Directory.CreateDirectory(Path.GetDirectoryName(path));
File.AppendAllText(path, message);
Expand Down
2 changes: 1 addition & 1 deletion source/Grabacr07.KanColleViewer/Application.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected override void OnStartup(StartupEventArgs e)
{
this.DispatcherUnhandledException += (sender, args) =>
{
ReportException(sender, args.Exception);
ReportException("Dispatcher", sender, args.Exception);
args.Handled = true;
};

Expand Down
2 changes: 1 addition & 1 deletion source/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly)]

[assembly: AssemblyVersion("4.5.0.2")]
[assembly: AssemblyVersion("4.5.1")]
4 changes: 2 additions & 2 deletions source/Grabacr07.KanColleViewer/Views/KanColleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ private void ChangeSizeByBrowser(Size browserSize)
if (this.previousDock == Dock.Top || this.previousDock == Dock.Bottom)
{
var diffW = this.previousBrowserSize.Value.Width - browserSize.Width;
if (Math.Abs(diffW) > 0.00001) this.Width -= diffW;
if (Math.Abs(diffW) > 0.00001 && this.Width - diffW > 0) this.Width -= diffW;
}
else if (this.previousDock == Dock.Left || this.previousDock == Dock.Right)
{
var diffH = this.previousBrowserSize.Value.Height - browserSize.Height;
if (Math.Abs(diffH) > 0.00001) this.Height -= diffH;
if (Math.Abs(diffH) > 0.00001 && this.Height - diffH > 0) this.Height -= diffH;
}
}
else
Expand Down

0 comments on commit 82f18fd

Please sign in to comment.