Example #1
0
        /// <summary>
        /// Applies changes to the dialog.
        /// </summary>
        /// <returns></returns>
        private bool Apply(ApplyReason reason)
        {
            // before...
            CancelEventArgs e = new CancelEventArgs();

            this.OnApplying(e);
            if (e.Cancel)
            {
                return(false);
            }

            // apply...
            bool result = this.DoApply(reason);

            // what happened...?
            if (result)
            {
                this.OnApplySuccessful();
            }
            else
            {
                this.OnApplyFailed();
            }

            // return...
            return(result);
        }
Example #2
0
        protected override bool DoApply(ApplyReason reason)
        {
            if (base.DoApply(reason) == false)
            {
                return(false);
            }

            if (Settings == null)
            {
                throw new InvalidOperationException("Settings is null.");
            }
            if (LocalSettings == null)
            {
                throw new InvalidOperationException("LocalSettings is null.");
            }

            // set...
            if (this.radioDefaultDatabase.Checked)
            {
                this.Settings.DatabaseName = null;
            }
            else
            {
                this.Settings.DatabaseName = this.textDatabaseName.Text;
            }
            this.Settings.NamespaceName = this.textNamespace.Text;

            // radio...
            if (this.radioDotNetV1.Checked)
            {
                this.Settings.TargetVersion = DotNetVersion.V1;
            }
            else
            {
                this.Settings.TargetVersion = DotNetVersion.V2;
            }

            // entities...
            this.LocalSettings.EntitiesFolderPath = this.textFolderPath.Text;
            this.Settings.BaseType = this.textBoxEntityBaseType.Text;

            // services...
            this.LocalSettings.DtoFolderPath = this.textServicesFolderPath.Text;
            this.Settings.DtoBaseType        = this.textBoxServicesBaseType.Text;

            // ok...
            return(true);
        }
Example #3
0
        /// <summary>
        /// Applies dialog changes.
        /// </summary>
        /// <param name="reason"></param>
        /// <returns></returns>
        protected override bool DoApply(ApplyReason reason)
        {
            if (base.DoApply(reason) == false)
            {
                return(false);
            }

            // name...
            string name = this.textName.Text;

            if (name == null || name.Length == 0)
            {
                Alert.ShowWarning(this, "You must supply a connection name.");
                return(false);
            }

            // check...
            ConnectionType connectionType = this.SelectedConnectionType;

            if (connectionType == null)
            {
                Alert.ShowWarning(this, "You must select a connection type.");
                return(false);
            }

            // string...
            string connectionString = this.ConnectionString;

            if (connectionString == null || connectionString.Length == 0)
            {
                Alert.ShowWarning(this, "You must enter a connection string.");
                return(false);
            }

            // set...
            this.ConnectionSettings = new ConnectionSettings(name, connectionType.Type, connectionString);

            // test...
            if (reason == ApplyReason.OKPressed)
            {
                this.TestInternal();
            }

            // ok...
            return(true);
        }
Example #4
0
 /// <summary>
 /// Called before changes to the page are applied.
 /// </summary>
 /// <param name="reason"></param>
 /// <returns></returns>
 protected virtual bool DoApply(ApplyReason reason)
 {
     return(true);
 }
Example #5
0
 /// <summary>
 /// Applies changes to the page.
 /// </summary>
 /// <param name="reason"></param>
 /// <returns></returns>
 internal bool Apply(ApplyReason reason)
 {
     return(this.DoApply(reason));
 }
Example #6
0
 /// <summary>
 /// Applies changes.
 /// </summary>
 /// <param name="reason"></param>
 /// <returns></returns>
 bool IPropertyPage.Apply(ApplyReason reason)
 {
     return(this.Apply(reason));
 }
Example #7
0
 bool IDialog.Apply(ApplyReason reason)
 {
     return(this.Apply(reason));
 }