<commit_before>using Avalonia;
using AvalonStudio.Commands;
using ReactiveUI;
using System;
using System.Composition;
using WalletWasabi.Helpers;

namespace WalletWasabi.Gui.Shell.Commands
{
	internal class ExitCommands
	{
		public Global Global { get; }

		[ExportCommandDefinition("File.LockScreen")]
		public CommandDefinition LockScreenCommand { get; }

		[ExportCommandDefinition("File.Exit")]
		public CommandDefinition ExitCommand { get; }

		[ImportingConstructor]
		public ExitCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
		{
			Global = Guard.NotNull(nameof(Global), global.Global);

			var lockScreen = ReactiveCommand.Create(OnLockScreen);
			var exit = ReactiveCommand.Create(OnExit);

			lockScreen.ThrownExceptions.Subscribe(ex => Logging.Logger.LogWarning<ExitCommands>(ex));
			exit.ThrownExceptions.Subscribe(Logging.Logger.LogWarning<ExitCommands>);

			LockScreenCommand = new CommandDefinition(
			   "Lock Screen",
			   commandIconService.GetCompletionKindImage("Lock"),
			   lockScreen);

			ExitCommand = new CommandDefinition(
			   "Exit",
			   commandIconService.GetCompletionKindImage("Exit"),
			   exit);
		}

		private void OnLockScreen()
		{
			Global.UiConfig.LockScreenActive = true;
		}<commit_msg>Simplify exception catching<commit_after>using Avalonia;
using AvalonStudio.Commands;
using ReactiveUI;
using System;
using System.Composition;
using WalletWasabi.Helpers;

namespace WalletWasabi.Gui.Shell.Commands
{
	internal class ExitCommands
	{
		public Global Global { get; }

		[ExportCommandDefinition("File.LockScreen")]
		public CommandDefinition LockScreenCommand { get; }

		[ExportCommandDefinition("File.Exit")]
		public CommandDefinition ExitCommand { get; }

		[ImportingConstructor]
		public ExitCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
		{
			Global = Guard.NotNull(nameof(Global), global.Global);

			var lockScreen = ReactiveCommand.Create(OnLockScreen);
			var exit = ReactiveCommand.Create(OnExit);

			lockScreen.ThrownExceptions.Subscribe(Logging.Logger.LogWarning<ExitCommands>);
			exit.ThrownExceptions.Subscribe(Logging.Logger.LogWarning<ExitCommands>);

			LockScreenCommand = new CommandDefinition(
			   "Lock Screen",
			   commandIconService.GetCompletionKindImage("Lock"),
			   lockScreen);

			ExitCommand = new CommandDefinition(
			   "Exit",
			   commandIconService.GetCompletionKindImage("Exit"),
			   exit);
		}

		private void OnLockScreen()
		{
			Global.UiConfig.LockScreenActive = true;
		}
{'fraction_non_alphanumeric': 0.09426551453260015, 'fraction_numerical': 0.0, 'mean_word_length': 5.227383863080685, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3392843', 'n_tokens_mistral': 820, 'n_tokens_neox': 710, 'n_words': 135}