private void XMenuEnum_Click(object sender, RoutedEventArgs e) { var editor = new SubWindows.ListEditor("Enum List"); editor.InitList(_noDbService.EnumService.Enums.EnumList.JsonClone(), (list) => { return(EnumTemplates.Default()); }, (list) => { _noDbService.EnumService.Enums.EnumList = list; _noDbService.EnumService.Save(); }, extraActions: new Dictionary <string, Action <NoDbEnumDetail> > { { "Auto Numerate", (NoDbEnumDetail item) => { if (item == null || item.Items.Count < 2) { return; } var start = item.Items.FirstOrDefault().Value; for (int i = 1; i < item.Items.Count; i++) { item.Items[i].Value = start + i; } } } }); editor.ShowDialog(); }
private void IndexButton_Clicked(object sender, RoutedEventArgs e) { if (_selectedTable == null) { return; } var editor = new SubWindows.ListEditor("Indexes / Keys"); editor.InitList(_selectedTable.Indices); editor.ShowDialog(); }
private void RelationButton_Clicked(object sender, RoutedEventArgs e) { if (_selectedTable == null) { return; } var editor = new SubWindows.ListEditor("Relations"); editor.InitList(_selectedTable.Relations, onSelectionChanged: relation => { }); editor.ShowDialog(); }
private void SearchButton_Clicked(object sender, RoutedEventArgs e) { if (_selectedTable == null) { return; } var editor = new SubWindows.ListEditor("Search Items"); editor.InitList(_selectedTable.SearchItems, defaultValueFunc: (list) => { return(_noDbService.SearchService.GetDefaultSearchItem(_selectedTable, list as List <NoDbSearchItem>)); }, extraActions: new Dictionary <string, Action <NoDbSearchItem> > { { "Refresh All Col.", (NoDbSearchItem searchItem) => { if (searchItem == null) { return; } searchItem.AllColumns = _noDbService.SearchService.GetDefaultSearchItem(_selectedTable, null).AllColumns; } }, { "Add Missing Col.", (NoDbSearchItem searchItem) => { if (searchItem == null) { return; } var newColumns = _noDbService.SearchService.GetDefaultSearchItem(_selectedTable, null).AllColumns; for (int i = 0; i < newColumns.Count; i++) { if (!searchItem.AllColumns.Any(x => x.Name == newColumns[i].Name)) { searchItem.AllColumns.Add(newColumns[i]); } } } }, { "Refresh Filter Col.", (NoDbSearchItem searchItem) => { if (searchItem == null) { return; } searchItem.Columns = _noDbService.SearchService.GetDefaultSearchItem(_selectedTable, null).Columns; } }, { "Refresh Grid Col.", (NoDbSearchItem searchItem) => { if (searchItem == null) { return; } searchItem.DisplayedColumns = _noDbService.SearchService.GetDefaultSearchItem(_selectedTable, null).DisplayedColumns; } } }); editor.ShowDialog(); }