using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Babebi4
{
	public partial class MainForm : Form
	{
		/// of Word

		private void button__Word_LanguageWord__of__Word__Focus_Click(object sender, EventArgs e)
		{
			if (this.Current__Word_LanguageWord__of__Word == null)
			{
				return;
			}

			this.Current__LanguageWord = this.Current__Word_LanguageWord__of__Word.LanguageWordRowParent;

			this.populate__LanguageWord();
		}

		private void bindingSource__Word_LanguageWord__of__Word_CurrentChanged(object sender, EventArgs e)
		{
			if (this.DoNotTriggerCurrentChangedEvent)
			{
				return;
			}

			if (this.bindingSource__Word_LanguageWord__of__Word.Current != null)
			{
				this.Current__Word_LanguageWord__of__Word
					= (BabebiDataSet.Word_LanguageWordRow)(((DataRowView)(this.bindingSource__Word_LanguageWord__of__Word.Current)).Row);
			}
			else
			{
				this.Current__Word_LanguageWord__of__Word = null;
			}
		}

		private void filter__Word_LanguageWord__of__Word()
		{
			if(this.Current__Language != null && this.Current__Word != null)
			{
				this.bindingSource__Word_LanguageWord__of__Word.Filter
					= "LanguageCode = '" 
					+ this.Current__Language.Code 
					+ "' AND WordId = '"
					+ this.Current__Word.Id
					+ "'";

				if (this.bindingSource__Word_LanguageWord__of__Word.Count == 1)
				{
					this.Current__Word_LanguageWord__of__Word
						=
						(BabebiDataSet.Word_LanguageWordRow)
						(
							((DataRowView)(this.bindingSource__Word_LanguageWord__of__Word.Current)).Row
						);
				}
				else
				{ 
					this.Current__Word_LanguageWord__of__Word = null;
				}
			}
			else
			{
				this.bindingSource__Word_LanguageWord__of__Word.Filter = "FALSE";

				this.Current__Word_LanguageWord__of__Word = null;
			}
		}
	}
}