コード例 #1
0
        private void _generateGrid(ref int line, GenericDatabase database, TabControl control, DisplayableProperty <TKey, ReadableTuple <TKey> > generalProperties, BaseDb gdb)
        {
            if (gdb.LayoutIndexes != null)
            {
                AbstractProvider metaProvider = AbstractProvider.GetProvider(gdb.LayoutIndexes);

                if (metaProvider is GroupIndexProvider)
                {
                    AbstractProvider gridProvider = AbstractProvider.GetProvider(gdb.GridIndexes);
                    gridProvider.GroupAs = typeof(SpecifiedIndexProvider);
                    bool col = false;

                    foreach (IIndexProvider provider in metaProvider.Providers)
                    {
                        AbstractProvider gridLayout = gridProvider.Next <AbstractProvider>();
                        GTabsMaker.PrintGrid(ref line, (col = !col) ? 0 : 3, 1, 2, provider, gridLayout, generalProperties, gdb.AttributeList);
                        if (col)
                        {
                            line--;
                        }
                    }
                }
                else
                {
                    GTabsMaker.Print(ref line, metaProvider, generalProperties, gdb.AttributeList);
                }
            }
            else
            {
                GTabsMaker.Print(ref line, new SpecifiedRangeIndexProvider(new int[] { 0, gdb.AttributeList.Attributes.Count }), generalProperties, gdb.AttributeList);
            }
        }
コード例 #2
0
ファイル: TabGenerator.cs プロジェクト: userid0/RagnarokSDE
        public void GenerateGridDefault(ref int line, TabSettings <TKey> settings)
        {
            if (settings.Gdb.LayoutIndexes != null)
            {
                AbstractProvider metaProvider = AbstractProvider.GetProvider(settings.Gdb.LayoutIndexes);

                if (metaProvider is GroupIndexProvider)
                {
                    AbstractProvider gridProvider = AbstractProvider.GetProvider(settings.Gdb.GridIndexes);
                    gridProvider.GroupAs = typeof(SpecifiedIndexProvider);
                    bool col = false;

                    foreach (IIndexProvider provider in metaProvider.Providers)
                    {
                        AbstractProvider gridLayout = gridProvider.Next <AbstractProvider>();
                        GTabsMaker.PrintGrid(ref line, (col = !col) ? 0 : 3, 1, 2, provider, gridLayout, settings.GeneralProperties, settings.Gdb.AttributeList);
                        if (col)
                        {
                            line--;
                        }
                    }
                }
                else
                {
                    GTabsMaker.Print(ref line, metaProvider, settings.GeneralProperties, settings.Gdb.AttributeList);
                }
            }
            else
            {
                GTabsMaker.Print(ref line, new SpecifiedRangeIndexProvider(new int[] { 0, settings.Gdb.AttributeList.Attributes.Count }), settings.GeneralProperties, settings.Gdb.AttributeList);
            }
        }
コード例 #3
0
        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;
                }
            }
        }