public void AutoGeneratingField()
        {
            DataFormApp_AutoGeneration dataFormApp = new DataFormApp_AutoGeneration();

            this.DataFormAppBase             = dataFormApp;
            dataFormApp.dataForm.ItemsSource = DataClassList.GetDataClassList(2, ListOperations.All);

            this.EnqueueCallback(() =>
            {
                this.ExpectEvent <DataFormAutoGeneratingFieldEventArgs>("AutoGeneratingField");
                dataFormApp.dataForm.AutoGenerateFields = true;
            });

            this.AddToPanelAndWaitForLoad();
            this.WaitForAllEvents();

            this.EnqueueTestComplete();
        }
        public void AutoGeneratingField()
        {
            DataFormApp_AutoGeneration dataFormApp = new DataFormApp_AutoGeneration();
            this.DataFormAppBase = dataFormApp;
            dataFormApp.dataForm.ItemsSource = DataClassList.GetDataClassList(2, ListOperations.All);

            this.EnqueueCallback(() =>
            {
                this.ExpectEvent<DataFormAutoGeneratingFieldEventArgs>("AutoGeneratingField");
                dataFormApp.dataForm.AutoGenerateFields = true;
            });

            this.AddToPanelAndWaitForLoad();
            this.WaitForAllEvents();

            this.EnqueueTestComplete();
        }
        public void SetCurrentItemAfterLoadWithAutoGeneration()
        {
            DataFormApp_AutoGeneration dataFormApp = new DataFormApp_AutoGeneration();

            this.EnqueueCallback(() =>
            {
                this.DataFormAppBase = dataFormApp;
            });

            this.AddToPanelAndWaitForLoad();

            this.EnqueueCallback(() =>
            {
                dataFormApp.dataForm.CurrentItem = new DataClass();
            });

            this.EnqueueTestComplete();
        }
        public void EnsureUneditableTypeCoercesFieldToReadOnlyWhenAutogenerating()
        {
            DataFormApp_AutoGeneration dataFormApp = new DataFormApp_AutoGeneration();
            this.DataFormAppBase = dataFormApp;
            dataFormApp.dataForm.CurrentItem = new DataClassWithUneditableType();

            this.AddToPanelAndWaitForLoad();

            this.EnqueueCallback(() =>
            {
                TextBox textBox = this.DataFormInputControls[5] as TextBox;
                Assert.IsTrue(textBox.IsReadOnly);
                this.ExpectContentLoaded();
                Assert.IsTrue(dataFormApp.dataForm.BeginEdit());
            });

            this.WaitForContentLoaded();

            this.EnqueueCallback(() =>
            {
                TextBox textBox = this.DataFormInputControls[5] as TextBox;
                Assert.IsTrue(textBox.IsReadOnly);

                DataField dataField = dataFormApp.dataForm.Fields[5];
                dataField.IsReadOnly = false;
            });

            // Wait a short while to let the DataField re-generate its UI.
            this.EnqueueDelay(100);

            this.EnqueueCallback(() =>
            {
                TextBox textBox = this.DataFormInputControls[5] as TextBox;
                Assert.IsFalse(textBox.IsReadOnly);

                DataField dataField = dataFormApp.dataForm.Fields[5];
                dataField.IsReadOnly = true;
            });

            // Wait a short while to let the DataField re-generate its UI.
            this.EnqueueDelay(100);

            this.EnqueueCallback(() =>
            {
                TextBox textBox = this.DataFormInputControls[5] as TextBox;
                Assert.IsTrue(textBox.IsReadOnly);

                this.ExpectContentLoaded();
                dataFormApp.dataForm.CommitEdit();
            });

            this.WaitForContentLoaded();

            this.EnqueueCallback(() =>
            {
                Assert.IsFalse(dataFormApp.dataForm.IsEditing);
            });

            this.EnqueueTestComplete();
        }