Exemplo n.º 1
0
        private void DialogHost_Closing(object sender, CancelEventArgs e)
        {
            string errorIfInvalidIdentifier = this.Model.GetErrorIfInvalidIdentifier(this.ViewName);

            if (!string.IsNullOrEmpty(errorIfInvalidIdentifier))
            {
                ValidatingViewModel.DisplayErrorMessage(this.DialogHost, errorIfInvalidIdentifier);
                e.Cancel = true;
                return;
            }
            if (this.Model.ViewExists(this.ViewName))
            {
                if (this.DialogHost.RequestConfirmation(string.Format(CultureInfo.CurrentCulture, ResourcesExt.OverwriteMessage, this.ViewName), ResourcesExt.AddViewWindowTitle) == MessageBoxResult.Yes)
                {
                    this.Model.IsOverwritingFiles = true;
                    return;
                }
                e.Cancel = true;
            }
        }
Exemplo n.º 2
0
        private void DialogHost_Closing(object sender, CancelEventArgs e)
        {
            string errorIfInvalidIdentifier = this.Model.GetErrorIfInvalidIdentifier(this.ControllerName);

            if (!string.IsNullOrEmpty(errorIfInvalidIdentifier))
            {
                ValidatingViewModel.DisplayErrorMessage(this.DialogHost, errorIfInvalidIdentifier);
                e.Cancel = true;
                return;
            }
            if (this.Model.ControllerExists(this.ControllerName))
            {
                if (this.DialogHost.RequestConfirmation(string.Format(CultureInfo.CurrentCulture, "A file with the name {0} already exists. Do you want to replace it?", this.ControllerName), "Add Controller") == MessageBoxResult.Yes)

                {
                    this.Model.IsOverwritingFiles = true;
                    return;
                }
                e.Cancel = true;
            }
        }