namespace RadDataFormAndRIA
{
	using System.Windows.Controls;
	using System.Windows.Navigation;
	using RadDataFormAndRIA.Web.Services;

	/// <summary>
	/// Home page for the application.
	/// </summary>
	public partial class Home : Page
	{
		/// <summary>
		/// Creates a new <see cref="Home"/> instance.
		/// </summary>
		public Home()
		{
			InitializeComponent();

			this.Title = ApplicationStrings.HomePageTitle;
		}

		/// <summary>
		/// Executes when the user navigates to this page.
		/// </summary>
		protected override void OnNavigatedTo(NavigationEventArgs e)
		{
		}

		private void RadDataForm_AutoGeneratingField(object sender, Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs e)
		{
			if (e.PropertyType != typeof(string))
			{
				e.Cancel = true;
			}
		}

		private void RadDataForm_EditEnded(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs e)
		{
			this.customersDataSource.SubmitChanges();
		}
	}
}