public static void View <TBasedProxy, TExtendedProxy>(TBasedProxy selectedItem, IDatabaseReader <TBasedProxy, TExtendedProxy> databaseReader, Func <TExtendedProxy, bool, Window> getWindow) { if (selectedItem == null) { return; } var extendedProxy = SafeRunMethod.WithReturn(() => databaseReader.GetExtendedProxy(selectedItem)); if (extendedProxy == null) { return; } getWindow(extendedProxy, true).ShowDialog(); }
public static void Edit <TBasedProxy, TExtendedProxy, TWindow>(TBasedProxy selectedItem, IDatabaseReader <TBasedProxy, TExtendedProxy> databaseReader, Func <TExtendedProxy, bool, TWindow> getWindow, IDatabaseEditor <TBasedProxy, TExtendedProxy> databaseEditor) where TWindow : Window, IProxyWindowWithExtendedProxy <TExtendedProxy> { if (selectedItem == null) { return; } var oldProxy = SafeRunMethod.WithReturn(() => databaseReader.GetExtendedProxy(selectedItem)); if (oldProxy == null) { return; } var window = getWindow(oldProxy, false); if (window.ShowDialog() != true) { return; } SafeRunMethod.WithoutReturn(() => databaseEditor.Edit(oldProxy, window.ExtendedProxy)); }
private static string[] GetGroupNames(HttpClientProvider httpClientProvider) { return(SafeRunMethod.WithReturn(() => httpClientProvider.GetDatabaseGroupReader().GetAllBasedProies())?.Select(group => group.GroupName).ToArray()); }