示例#1
0
            public static void Edit <TTable, TWindow>(TTable selectedItem, Func <TTable, bool, TWindow> getWindow, IDatabaseEditor <TTable> databaseEditor, Func <TTable, Guid> getId, Action actionAfterSuccess = null) where TWindow : Window, IWindowWithChecking <TTable>
            {
                if (selectedItem == null)
                {
                    return;
                }

                var window = getWindow(selectedItem, false);

                if (window.ShowDialog() != true)
                {
                    return;
                }

                SafeRunMethod.WithoutReturn(() => {
                    databaseEditor.Edit(getId(selectedItem), window.Table);
                    actionAfterSuccess?.Invoke();
                });
            }
示例#2
0
            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));
            }