Skip to content

Commit

Permalink
Manager: Added dps.report column
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkaaaaa committed Jun 9, 2024
1 parent fdfe74f commit 9f605cf
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ArcdpsLogManager/Sections/LogList.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using Eto.Drawing;
Expand Down Expand Up @@ -44,6 +45,7 @@ public class LogList : Panel
{ "Instabilities", "Fractals of the Mists" },
{ "Scale", "Fractals of the Mists" },
{ "", "Encounter Icon" },
{ "dps.report", "Open log" },
};

public bool ReadOnly { get; init; }
Expand Down Expand Up @@ -401,6 +403,41 @@ private GridView<LogData> ConstructLogGridView(LogDetailPanel detailPanel, Multi
}
});

var dpsReportColumn = new GridColumn()
{
HeaderText = "dps.report",
DataCell = new TextBoxCell
{
Binding = new DelegateBinding<LogData, string>(x => !string.IsNullOrEmpty(x.DpsReportEIUpload.Url) ? "🔗 Open" : "")
},
};

gridView.CellDoubleClick += (sender, args) =>
{
if (args.GridColumn == dpsReportColumn)
{
var data = (LogData)args.Item;

try
{
if (!string.IsNullOrEmpty(data.DpsReportEIUpload.Url))
{
Process.Start(new ProcessStartInfo
{
FileName = data.DpsReportEIUpload.Url,
UseShellExecute = true
});
}
}
catch (Exception ex)
{
MessageBox.Show($"Failed to open report: {ex.Message}");
}
}
};

gridView.Columns.Add(dpsReportColumn);

foreach (var column in gridView.Columns)
{
column.Visible = !Settings.HiddenLogListColumns.Contains(column.HeaderText);
Expand Down

0 comments on commit 9f605cf

Please sign in to comment.