public void CheckForUnsavedChangesAnOfferToSave() { if (_o == null) { return; } if (_isEnabled) { if (_activator.YesNo("Save Changes To '" + _o + "'?", "Save Changes")) { Save(); } else { _o.RevertToDatabaseState(); } } }
public void CheckForUnsavedChangesAnOfferToSave() { // If there is no object or it does not exist don't try to save it if (_o == null || !_o.Exists()) { return; } if (_isEnabled) { if (_activator.YesNo("Save Changes To '" + _o + "'?", "Save Changes")) { Save(); } else { _o.RevertToDatabaseState(); } } }
private void Open(IMapsDirectlyToDatabaseTable o) { if (!((DatabaseEntity)o).Exists()) { if (_activator.YesNo($"'{o}' no longer exists, remove from Recent list?", "No longer exists")) { _activator.HistoryProvider.Remove(o); RefreshHistory(); } return; } var cmd = new ExecuteCommandActivate(_activator, o) { AlsoShow = true }; cmd.Execute(); }
/// <summary> /// Offers the user a binary choice and returns true if they accept it. This method is blocking. /// </summary> /// <param name="text">The question to pose</param> /// <param name="caption"></param> /// <returns></returns> protected bool YesNo(string text, string caption) { return(Activator.YesNo(text, caption)); }
private void cbxCatalogues_SelectedIndexChanged(object sender, EventArgs e) { var cata = cbxCatalogues.SelectedItem as Catalogue; if (cata == null) { return; } //if the Catalogue changes clear the old filters because they apply to the last dataset if (_lastCatalogue != null) { if (!Equals(_lastCatalogue, cata))//catalogue has changed { //if there are no user specified ones clear the mandatory filters (if there are any) if (_filterUIs.All(f => f.Mandatory)) { ClearFilters(); } else //there are some user specified ones if ( //confirm with user before we erase these _activator.YesNo( "Changing the dataset will clear the Filters you have configured, is this what you want?", "Change Dataset")) { ClearFilters(); } else { cbxCatalogues.SelectedItem = _lastCatalogue; return; } } } //add any mandatory filters that are not yet part of the configuration foreach (var mandatoryFilter in cata.GetAllMandatoryFilters()) { if (!_filterUIs.Any(f => f.Filter.Equals(mandatoryFilter))) { var m = AddFilter(mandatoryFilter); m.Mandatory = true; //mandatory ones cannot be changed or gotten rid of } } //set the columns var allColumns = cata.GetAllExtractionInformation(ExtractionCategory.Any).ToArray(); cbxColumns.DataSource = allColumns; var identifiers = allColumns.Where(ei => ei.IsExtractionIdentifier).ToArray(); //if no columns have yet been marked as IsExtractionIdentifier then we show all columns and demand that the user lock one in if (identifiers.Length == 0) { UnlockIdentifier(null); } else if (identifiers.Length == 1) { LockIdentifier(identifiers[0]);//there is only one IsExtractionIdentifier so lock it in automatically } else { _knownIdentifiersMode = true; //if there are multiple columns marked with IsExtractionIdentifier then we show all of them but no others //e.g. SMR02 where there could be Mother CHI, Baby CHI and Father CHI do not unmark extraction identifier just because they changed it cbxColumns.DataSource = identifiers; UnlockIdentifier(null); } var allFilters = allColumns.SelectMany(c => c.ExtractionFilters).ToArray(); ddAvailableFilters.DataSource = allFilters; _lastCatalogue = cata; }