<commit_before>﻿using Eto.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JabbR.Eto.Interface.Dialogs
{
	static class DialogExtensions
	{
		public static Control OkButton (this Dialog dialog, string text = null, Func<bool> clicked = null)
		{
			var control = new Button { Text = text ?? "OK" };
			dialog.DefaultButton = control;
			control.Click += (sender, e) => {
				if (clicked != null && !clicked ())
					return;
				dialog.Close (DialogResult.Cancel);
			};
			return control;
		}

		public static Control CancelButton (this Dialog dialog, string text = null, Func<bool> clicked = null)
		{
			var control = new Button { Text = text ?? "Cancel" };
			dialog.AbortButton = control;
			control.Click += (sender, e) => {
				if (clicked != null && !clicked ())
					return;
				dialog.Close (DialogResult.Cancel);
			};
			return control;
		}
	}
}<commit_msg>- Fix save/ok buttons to return the correct result<commit_after>﻿using Eto.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JabbR.Eto.Interface.Dialogs
{
	static class DialogExtensions
	{
		public static Control OkButton (this Dialog dialog, string text = null, Func<bool> clicked = null)
		{
			var control = new Button { Text = text ?? "OK" };
			dialog.DefaultButton = control;
			control.Click += (sender, e) => {
				if (clicked != null && !clicked ())
					return;
				dialog.Close (DialogResult.Ok);
			};
			return control;
		}

		public static Control CancelButton (this Dialog dialog, string text = null, Func<bool> clicked = null)
		{
			var control = new Button { Text = text ?? "Cancel" };
			dialog.AbortButton = control;
			control.Click += (sender, e) => {
				if (clicked != null && !clicked ())
					return;
				dialog.Close (DialogResult.Cancel);
			};
			return control;
		}
	}
}
{'fraction_non_alphanumeric': 0.128, 'fraction_numerical': 0.0, 'mean_word_length': 3.3729603729603728, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3430845', 'n_tokens_mistral': 675, 'n_tokens_neox': 580, 'n_words': 174}