bool IPresenter.Open(IUserDefinedSearch search) { IFiltersList tempList = search.Filters.Clone(); bool confirmed = false; using (dialogView = view.CreateDialog(this)) using (var filtersManagerPresenter = filtersManagerFactory(tempList, dialogView)) { dialogView.SetData(new DialogData() { Name = search.Name }); confirm = () => { string name = dialogView.GetData().Name; if (string.IsNullOrWhiteSpace(name)) { alerts.ShowPopup( alertsCaption, "Bad filter name.", AlertFlags.Ok ); return(false); } if (name != search.Name && userDefinedSearches.ContainsItem(name)) { alerts.ShowPopup( alertsCaption, string.Format("Name '{0}' is already used by another filter. Enter another name.", name), AlertFlags.Ok ); return(false); } if (tempList.Items.Count == 0) { alerts.ShowPopup( alertsCaption, "Can not save: filter must have at least one rule.", AlertFlags.Ok ); return(false); } confirmed = true; return(confirmed); }; dialogView.OpenModal(); confirm = null; if (confirmed) { search.Name = dialogView.GetData().Name; search.Filters = tempList; } else { tempList.Dispose(); } } dialogView = null; return(confirmed); }
void IPresenter.Open() { using (currentDialog = view.CreateDialog(this)) { UpdateViewItems(); UpdateControls(); currentDialog.OpenModal(); } currentDialog = null; }
IUserDefinedSearch IPresenter.Open() { using (currentDialog = view.CreateDialog(this)) { UpdateViewItems(); UpdateControls(); currentDialog.OpenModal(); } var tmp = currentDialogResult; currentDialog = null; currentDialogResult = null; return(tmp); }