<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using L10NSharp;
using SIL.Extensions;
using SIL.WritingSystems;

namespace SIL.Windows.Forms.WritingSystems
{
	public partial class LanguageLookupControl : UserControl
	{
		private readonly LanguageLookupModel _model;
		private string _lastSearchedForText;

		public event EventHandler ReadinessChanged;

		public void UpdateReadiness()
		{
			EventHandler handler = ReadinessChanged;
			if (handler != null)
				handler(this, null);
		}

		public event EventHandler DoubleClicked;

		public LanguageLookupControl()
		{
			InitializeComponent();
			ShowDesiredLanguageNameField = true;
			_model = new LanguageLookupModel();
		}

		public void LoadLanguages()
		{
			_model.LoadLanguages();
		}

		public bool AreLanguagesLoaded
		{
			get { return _model.AreLanguagesLoaded; }
		}

		public bool ShowDesiredLanguageNameField
		{
			set { _desiredLanguageDisplayName.Visible = _desiredLanguageLabel.Visible = value; }
		}

		public Func<LanguageInfo, bool> MatchingLanguageFilter
		{
			set { _model.MatchingLanguageFilter = value; }
		}

		public LanguageInfo SelectedLanguage
		{
			get { return _model.SelectedLanguage; }
			set
			{
				string oldLangTag = _model.LanguageTag;
				_model.SelectedLanguage = value;
				_desiredLanguageDisplayName.Text = _model.DesiredLanguageName;
				if(_model.SelectedLanguage.LanguageTag != oldLangTag)
					UpdateReadiness();
			}
		}

		public string DesiredLanguageName
		{
			get { return _model.DesiredLanguageName; }
		}

		public bool HaveSufficientInformation<commit_msg>Fix null ref in LanguageLookupControl<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using L10NSharp;
using SIL.Extensions;
using SIL.WritingSystems;

namespace SIL.Windows.Forms.WritingSystems
{
	public partial class LanguageLookupControl : UserControl
	{
		private readonly LanguageLookupModel _model;
		private string _lastSearchedForText;

		public event EventHandler ReadinessChanged;

		public void UpdateReadiness()
		{
			EventHandler handler = ReadinessChanged;
			if (handler != null)
				handler(this, null);
		}

		public event EventHandler DoubleClicked;

		public LanguageLookupControl()
		{
			InitializeComponent();
			ShowDesiredLanguageNameField = true;
			_model = new LanguageLookupModel();
		}

		public void LoadLanguages()
		{
			_model.LoadLanguages();
		}

		public bool AreLanguagesLoaded
		{
			get { return _model.AreLanguagesLoaded; }
		}

		public bool ShowDesiredLanguageNameField
		{
			set { _desiredLanguageDisplayName.Visible = _desiredLanguageLabel.Visible = value; }
		}

		public Func<LanguageInfo, bool> MatchingLanguageFilter
		{
			set { _model.MatchingLanguageFilter = value; }
		}

		public LanguageInfo SelectedLanguage
		{
			get { return _model.SelectedLanguage; }
			set
			{
				string oldLangTag = _model.LanguageTag;
				_model.SelectedLanguage = value;
				_desiredLanguageDisplayName.Text = _model.DesiredLanguageName;
				if(_model.LanguageTag != oldLangTag)
					UpdateReadiness();
			}
		}

		public string DesiredLanguageName
		{
			get { return _model.DesiredLanguageName; }
		}

		public bool HaveSufficientInformation
{'fraction_non_alphanumeric': 0.07406331687481847, 'fraction_numerical': 0.0011617775196049957, 'mean_word_length': 4.38125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4820627', 'n_tokens_mistral': 1162, 'n_tokens_neox': 987, 'n_words': 225}