/// <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); }
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); }
/// <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); }
/// <summary> /// Called before changes to the page are applied. /// </summary> /// <param name="reason"></param> /// <returns></returns> protected virtual bool DoApply(ApplyReason reason) { return(true); }
/// <summary> /// Applies changes to the page. /// </summary> /// <param name="reason"></param> /// <returns></returns> internal bool Apply(ApplyReason reason) { return(this.DoApply(reason)); }
/// <summary> /// Applies changes. /// </summary> /// <param name="reason"></param> /// <returns></returns> bool IPropertyPage.Apply(ApplyReason reason) { return(this.Apply(reason)); }
bool IDialog.Apply(ApplyReason reason) { return(this.Apply(reason)); }