public static void LoadSItemGroupVisualUpdate(GDbTabWrapper <int, ReadableTuple <int> > tab, GTabSettings <int, ReadableTuple <int> > settings, BaseDb gdb) { List <DbAttribute> attributes = ServerItemGroupSubAttributes.AttributeList.Attributes; List <int> indexes = new SpecifiedIndexProvider(new int[] { 2, 3, 4, 5, 6, 7 }).GetIndexes(); Grid grid = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == 0 && (int)p.GetValue(Grid.ColumnProperty) == 2) as Grid; if (grid == null) { return; } int row = 2; int column = 0; for (int i = 0; i < indexes.Count; i++) { if (indexes[i] > -1 && indexes[i] < attributes.Count) { var attribute = attributes[indexes[i]]; if (attribute.IsSkippable) { var attached = gdb.Attached[attribute.DisplayName]; bool isSet = attached != null && (bool)gdb.Attached[attribute.DisplayName]; tab.Dispatch(delegate { var label = grid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column); var content = grid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column + 1); if (label != null) { label.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed; label.IsEnabled = isSet; } if (content != null) { content.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed; content.IsEnabled = isSet; } }); } } row += 2; } }
public static void TgOnTabVisualUpdate(GDbTabWrapper <TKey, ReadableTuple <TKey> > tab, GTabSettings <TKey, ReadableTuple <TKey> > settings, BaseDb gdb) { tab.Dispatch(delegate { ((UIElement)tab.Content).IsEnabled = IsTabEnabled(settings, gdb); }); List <DbAttribute> attributes = settings.AttributeList.Attributes; if (gdb.LayoutIndexes != null) { AbstractProvider provider = AbstractProvider.GetProvider(gdb.LayoutIndexes); if (provider is GroupIndexProvider) { return; } List <int> indexes = provider.GetIndexes(); int row = 0; int column; for (int i = 0; i < indexes.Count; i += 2) { column = 0; if (indexes[i] > -1 && indexes[i] < attributes.Count) { var attribute = attributes[indexes[i]]; if (attribute.IsSkippable) { var attached = gdb.Attached[attribute.DisplayName]; bool isSet = attached == null || (bool)gdb.Attached[attribute.DisplayName]; tab.Dispatch(delegate { var label = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column); var content = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column + 1); if (label != null) { label.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed; label.IsEnabled = isSet; } if (content != null) { content.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed; content.IsEnabled = isSet; } }); } } column += 3; if (i + 1 < indexes.Count) { if (indexes[i + 1] > -1 && indexes[i + 1] < attributes.Count) { var attribute = attributes[indexes[i + 1]]; if (attribute.IsSkippable) { var attached = gdb.Attached[attribute.DisplayName]; bool isSet = attached == null || (bool)gdb.Attached[attribute.DisplayName]; tab.Dispatch(delegate { var label = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column); var content = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column + 1); if (label != null) { label.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed; label.IsEnabled = isSet; } if (content != null) { content.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed; content.IsEnabled = isSet; } }); } } } row += 2; } } }