JD2022-TU1/main/tools/modules/JD.CrashReporter/ToolCrashReporterModule.cs

37 lines
No EOL
1.1 KiB
C#

using Plume.Bloomberg;
using Plume.CrashReporter.Views;
using Plume.Interfaces.Modules;
using Plume.Interfaces.WPF.Modules;
using System;
namespace JD.CrashReporter
{
public class ToolCrashReporterModule : IWpfModule
{
private const string BloombergSettingsFileName = "bloomberg_settings_tools.ini";
public void Dispose()
{
}
public void Setup(IModuleSetup setup)
{
// do nothing
}
public void Initialize(IWpfModuleContext context)
{
var bloombergService = context.ServiceManager.Get<IBloombergService>();
if (bloombergService == null)
{
throw new ArgumentException($"Unable to find a valid {nameof(IBloombergService)}.");
}
var bloombergReporter = new BloombergReporter(BloombergSettingsFileName);
bloombergService.ConnectReporter(bloombergReporter);
var crashReporterStatus = new CrashReporterStatusIcon(bloombergService);
context.StatusBarManager.AddStatusControl(crashReporterStatus);
}
}
}