72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
|
|
using System.Diagnostics;
|
||
|
|
using System.Reflection;
|
||
|
|
using System.Runtime.Versioning;
|
||
|
|
using System.Windows;
|
||
|
|
using System.Windows.Navigation;
|
||
|
|
using TeamsISO.Engine.NdiInterop;
|
||
|
|
|
||
|
|
namespace TeamsISO.App;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Modal "About" dialog. Surfaces enough info that a user filing a support ticket
|
||
|
|
/// can paste version + NDI runtime + OS in a single screenshot.
|
||
|
|
/// </summary>
|
||
|
|
public partial class AboutWindow : Window
|
||
|
|
{
|
||
|
|
public AboutWindow()
|
||
|
|
{
|
||
|
|
InitializeComponent();
|
||
|
|
PopulateText();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void PopulateText()
|
||
|
|
{
|
||
|
|
var asm = typeof(App).Assembly;
|
||
|
|
var info = asm.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
|
||
|
|
?? asm.GetName().Version?.ToString()
|
||
|
|
?? "unknown";
|
||
|
|
VersionText.Text = info;
|
||
|
|
RuntimeText.Text = $".NET {Environment.Version}";
|
||
|
|
OsText.Text = Environment.OSVersion.ToString();
|
||
|
|
NdiText.Text = TryGetNdiVersion();
|
||
|
|
}
|
||
|
|
|
||
|
|
[SupportedOSPlatform("windows")]
|
||
|
|
private static string TryGetNdiVersion()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
using var interop = new NdiInteropPInvoke(
|
||
|
|
Microsoft.Extensions.Logging.Abstractions.NullLogger<NdiInteropPInvoke>.Instance);
|
||
|
|
return interop.GetRuntimeVersion();
|
||
|
|
}
|
||
|
|
catch (Exception ex)
|
||
|
|
{
|
||
|
|
return $"not initialized ({ex.Message})";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnClose(object sender, RoutedEventArgs e) => Close();
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Open the company site in the default browser. We intentionally use the
|
||
|
|
/// shell's URL handler rather than a tab inside the app — this is a
|
||
|
|
/// "tell me more" link, not a workflow.
|
||
|
|
/// </summary>
|
||
|
|
private void OnWebsiteClick(object sender, RoutedEventArgs e)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
Process.Start(new ProcessStartInfo
|
||
|
|
{
|
||
|
|
FileName = "https://wilddragon.net",
|
||
|
|
UseShellExecute = true,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
catch
|
||
|
|
{
|
||
|
|
// best-effort; if shell launch fails the click is a no-op
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|