Skip to content

Commit

Permalink
Manager: Add a button to navigate to the selected log
Browse files Browse the repository at this point in the history
  • Loading branch information
Sejsel committed Feb 9, 2020
1 parent f21a370 commit b07533f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions ArcdpsLogManager/Controls/LogDetailPanel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Eto.Drawing;
using Eto.Forms;
using GW2Scratch.ArcdpsLogManager.Analytics;
Expand All @@ -18,7 +20,7 @@ public sealed class LogDetailPanel : DynamicLayout

private readonly Label nameLabel = new Label {Font = Fonts.Sans(16, FontStyle.Bold), Wrap = WrapMode.Word};
private readonly Label resultLabel = new Label {Font = Fonts.Sans(12)};
private readonly Label filenameLabel = new Label {TextAlignment = TextAlignment.Right};
private readonly LinkButton fileNameButton = new LinkButton();
private readonly GroupCompositionControl groupComposition;
private readonly Label parseTimeLabel = new Label();
private readonly Label parseStatusLabel = new Label();
Expand Down Expand Up @@ -63,7 +65,7 @@ public LogData LogData
double seconds = logData.EncounterDuration.TotalSeconds;
string duration = $"{(int) seconds / 60:0}m {seconds % 60:0.0}s";

filenameLabel.Text = logData.FileInfo.Name;
fileNameButton.Text = logData.FileInfo.Name;

resultLabel.Text = $"{result} in {duration}";

Expand Down Expand Up @@ -165,14 +167,18 @@ public LogData LogData
BeginVertical(spacing: new Size(10, 0));
{
Add(null, true);
Add(filenameLabel);
BeginHorizontal();
{
Add(null, true);
Add(fileNameButton);
}
}
EndVertical();

dpsReportUploadButton.Click += (sender, args) => { UploadProcessor.ScheduleDpsReportEIUpload(logData); };
dpsReportOpenButton.Click += (sender, args) =>
{
System.Diagnostics.Process.Start(logData.DpsReportEIUpload.Url);
Process.Start(logData.DpsReportEIUpload.Url);
};

debugButton.Click += (sender, args) =>
Expand All @@ -184,6 +190,18 @@ public LogData LogData

reparseButton.Click += (sender, args) => logProcessor.Schedule(logData);

fileNameButton.Click += (sender, args) =>
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Process.Start("explorer.exe", $"/select,\"{logData.FileName}\"");
}
else
{
Process.Start(logData.FileInfo.DirectoryName);
}
};

Settings.ShowDebugDataChanged += (sender, args) => { debugSection.Visible = Settings.ShowDebugData; };
Shown += (sender, args) =>
{
Expand Down

0 comments on commit b07533f

Please sign in to comment.