public static XmlSchema ValidateSchema(DataGridViewRow row, string filename) { try { XmlSchema schema = SchemaDialogCommand.LoadSchema(filename); // make sure we can load it! return(schema); } catch (Exception ex) { MessageBox.Show(string.Format(SR.SchemaLoadError, filename, ex.Message), SR.SchemaError, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } }
public SchemaDialogEditCommand(DataGridView view, List <SchemaItem> items, DataGridViewRow row, string newSchema) : base(view, items) { this.newSchema = newSchema; this.row = row; SchemaItem item = row.Tag as SchemaItem; if (item != null) { oldSchema = item.Filename; oldNamespace = item.TargetNamespace; schema = item.Schema; } // should succeed because previous code already validated the filename. schema = SchemaDialogCommand.LoadSchema(newSchema); newNamespace = schema == null ? "" : schema.TargetNamespace; index = row.Index; }