Example #1
0
 public void SelectItem()
 {
     if (_lv.SelectedItems.Count > 0)
     {
         TabNavigation.SelectList(_configuration.SubTableServerDbSearch, _lv.SelectedItems.OfType <ReadableTuple <int> >().ToList().Select(p => p.Key).ToList());
     }
 }
Example #2
0
 private void _miSelect_Click(object sender, RoutedEventArgs e)
 {
     if (_lv.SelectedItems.Count > 0)
     {
         TabNavigation.SelectList(ServerDbs.Items, _lv.SelectedItems.Cast <MobDropView>().Select(p => p.ID));
     }
 }
Example #3
0
 private void _miSelect_Click(object sender, RoutedEventArgs e, RangeListView lv, ServerDbs db)
 {
     if (lv.SelectedItems.Count > 0)
     {
         TabNavigation.SelectList(db, lv.SelectedItems.Cast <ICustomEditableView>().Select(p => p.SelectId));
     }
 }
Example #4
0
 private void _miSelect2_Click(object sender, RoutedEventArgs e)
 {
     if (_lv.SelectedItems.Count > 0)
     {
         TabNavigation.SelectList(ServerDbs.MobSkills, _lv.SelectedItems.Cast <MobSkillView>().Where(p => p.MobSkillTuple != null).Select(p => p.MobSkillTuple.GetKey <string>()));
     }
 }
        /// <summary>
        /// Gets the next control in the specified navigation direction.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="direction">The navigation direction.</param>
        /// <returns>
        /// The next element in the specified direction, or null if <paramref name="element"/>
        /// was the last in the requested direction.
        /// </returns>
        public static IInputElement?GetNext(
            IInputElement element,
            NavigationDirection direction)
        {
            element = element ?? throw new ArgumentNullException(nameof(element));

            // If there's a custom keyboard navigation handler as an ancestor, use that.
            var custom = element.FindAncestorOfType <ICustomKeyboardNavigation>(true);

            if (custom is object && HandlePreCustomNavigation(custom, element, direction, out var ce))
            {
                return(ce);
            }

            var result = direction switch
            {
                NavigationDirection.Next => TabNavigation.GetNextTab(element, false),
                NavigationDirection.Previous => TabNavigation.GetPrevTab(element, null, false),
                _ => throw new NotSupportedException(),
            };

            // If there wasn't a custom navigation handler as an ancestor of the current element,
            // but there is one as an ancestor of the new element, use that.
            if (custom is null && HandlePostCustomNavigation(element, result, direction, out ce))
            {
                return(ce);
            }

            return(result);
        }
Example #6
0
        private void _autoSelect()
        {
            if (SdeAppConfiguration.BindItemTabs)
            {
                if (Settings.DbData == ServerDbs.CItems || Settings.DbData == ServerDbs.Items || Settings.DbData == ServerDbs.Items2)
                {
                    _dbSearchPanel._searchTextBox.Text = GSearchEngine <TKey, TValue> .LastSearch;
                }
            }

            if (SdeAppConfiguration.BindItemTabs && LastSelectedTuple != null)
            {
                if (LastSelectedTuple is ReadableTuple <int> )
                {
                    if (Settings.DbData == ServerDbs.CItems)
                    {
                        TabNavigation.SelectQuiet(ServerDbs.CItems, LastSelectedTuple.GetKey <int>());
                    }
                    else if (Settings.DbData == ServerDbs.Items)
                    {
                        TabNavigation.SelectQuiet(ServerDbs.Items, LastSelectedTuple.GetKey <int>());
                    }
                    else if (Settings.DbData == ServerDbs.Items2)
                    {
                        TabNavigation.SelectQuiet(ServerDbs.Items2, LastSelectedTuple.GetKey <int>());
                    }
                }
            }
        }
Example #7
0
		private void _loadMenu() {
			_tabEngine = new TabNavigation(_mainTabControl);
			_recentFilesManager = new SdeRecentFiles(Configuration.ConfigAsker, 6, _menuItemRecentProjects);
			_recentFilesManager.FileClicked += _recentFilesManager_FileClicked;
			_recentFilesManager.Reload();

			_debugList.MouseRightButtonUp += _debugList_MouseRightButtonUp;
		}
Example #8
0
        /// <summary>
        /// 获取结果
        /// </summary>
        private string GetResult(TabNavigation component)
        {
            component.Begin();
            var result = component.ToString();

            _output.WriteLine(result);
            return(result);
        }
Example #9
0
 private void _copyToCallback2(AbstractDb <TKey> dbDest, Table <TKey, ReadableTuple <TKey> > tableDest, TKey newkey, bool executed)
 {
     if (executed)
     {
         tableDest.GetTuple(newkey).Added = true;
         TabNavigation.Select(dbDest.DbSource, newkey);
     }
 }
Example #10
0
        private void _loadMenu()
        {
            _tabEngine                       = new TabNavigation(_mainTabControl);
            _recentFilesManager              = new SdeRecentFiles(SdeAppConfiguration.ConfigAsker, 6, _menuItemRecentProjects);
            _recentFilesManager.FileClicked += _recentFilesManager_FileClicked;
            _recentFilesManager.Reload();

            _debugList.MouseRightButtonUp += _debugList_MouseRightButtonUp;
        }
Example #11
0
        private void _lv_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ListViewItem item = _lv.GetObjectAtPoint <ListViewItem>(e.GetPosition(_lv)) as ListViewItem;

            if (item != null)
            {
                TabNavigation.Select(ServerDbs.Mobs, ((MobDropView)item.Content).ID);
            }
        }
Example #12
0
        private void _lv_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ListViewItem item = _lv.GetObjectAtPoint <ListViewItem>(e.GetPosition(_lv));

            if (item != null)
            {
                TabNavigation.Select(ServerDbs.MobSkills, ((MobSkillView)item.Content).MobSkillTuple.GetKey <string>());
            }
        }
Example #13
0
        public void Add(TabControl mainTabControl, DbHolder holder, TabNavigation tabEngine, SdeEditor editor)
        {
            holder.AddTable(_adb);
            GDbTab copy = holder.GetTab(_adb, mainTabControl);

            if (_adb is AbstractDb <int> )
            {
                _adb.To <int>().Table.Commands.CommandIndexChanged += (e, a) => editor.UpdateTabHeader(_adb.To <int>());
            }
            else if (_adb is AbstractDb <string> )
            {
                _adb.To <string>().Table.Commands.CommandIndexChanged += (e, a) => editor.UpdateTabHeader(_adb.To <string>());
            }

            copy._listView.SelectionChanged += delegate(object sender, SelectionChangedEventArgs args) {
                if (sender is ListView)
                {
                    ListView view = (ListView)sender;
                    tabEngine.StoreAndExecute(new SelectionChanged(copy.Header.ToString(), view.SelectedItem, view, copy));
                }
            };

            ((DisplayLabel)copy.Header).ContextMenu.Items.Cast <MenuItem>().ToList().ForEach(p => p.IsEnabled = true);

            MenuItem mitem = new MenuItem();

            mitem.Icon = new Image {
                Source = ApplicationManager.GetResourceImage("delete.png")
            };
            mitem.Header = "Delete table";
            mitem.Click += delegate {
                holder.RemoveTable(_adb);
                mainTabControl.Items.Remove(copy);

                List <string> tabs = ProjectConfiguration.CustomTabs;
                tabs.Remove(_file);
                ProjectConfiguration.CustomTabs = tabs.Distinct().ToList();
            };

            ((DisplayLabel)copy.Header).ContextMenu.Items.Add(mitem);

            mainTabControl.Items.Insert(mainTabControl.Items.Count, copy);
            _adb.LoadDb();

            if (_adb is AbstractDb <int> )
            {
                copy.To <int>().SearchEngine.Filter(this);
            }
            else if (_adb is AbstractDb <string> )
            {
                copy.To <string>().SearchEngine.Filter(this);
            }

            editor.GdTabs.Add(copy);
        }
Example #14
0
 public static GItemCommand <TKey, ReadableTuple <TKey> > GenerateSelectFrom <TKey>(ServerDbs serverDb, GDbTabWrapper <TKey, ReadableTuple <TKey> > tab)
 {
     return(new GItemCommand <TKey, ReadableTuple <TKey> > {
         AllowMultipleSelection = false,
         DisplayName = String.Format("Select in [{0}]", serverDb.DisplayName),
         ImagePath = "arrowdown.png",
         InsertIndex = 4,
         AddToCommandsStack = false,
         GenericCommand = items => TabNavigation.SelectList(serverDb, items.Select(p => p.GetKey <TKey>()))
     });
 }
        private void _select_Click(object sender, RoutedEventArgs e)
        {
            int value;

            Int32.TryParse(_textBox.Text, out value);

            if (value <= 0)
            {
                return;
            }

            TabNavigation.Select((ServerDbs)_attribute.AttachedObject, value);
        }
Example #16
0
        /// <summary>
        /// Gets the next control in the specified navigation direction.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="direction">The navigation direction.</param>
        /// <returns>
        /// The next element in the specified direction, or null if <paramref name="element"/>
        /// was the last in therequested direction.
        /// </returns>
        public static IInputElement GetNext(
            IInputElement element,
            FocusNavigationDirection direction)
        {
            Contract.Requires <ArgumentNullException>(element != null);

            if (direction == FocusNavigationDirection.Next || direction == FocusNavigationDirection.Previous)
            {
                return(TabNavigation.GetNextInTabOrder(element, direction));
            }
            else
            {
                return(DirectionalNavigation.GetNext(element, direction));
            }
        }
Example #17
0
 public virtual void GetCommands(HashSet <CmdInfo> commands)
 {
     commands.Add(new CmdInfo {
         CmdName       = "select",
         Icon          = "arrowdown.png",
         DisplayName   = "Select in GRF",
         GroupCommand  = true,
         _executeGroup = (t, l) => {
             TabNavigation.SelectList(t.Db, l.Select(p => p.Id));
             return(false);
         },
         _execute = t => {
             TabNavigation.Select(t.Db, t.Id);
             return(false);
         }
     });
 }
Example #18
0
        /// <summary>
        /// Gets the next control in the specified navigation direction.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="direction">The navigation direction.</param>
        /// <returns>
        /// The next element in the specified direction, or null if <paramref name="element"/>
        /// was the last in the requested direction.
        /// </returns>
        public static IInputElement GetNext(
            IInputElement element,
            NavigationDirection direction)
        {
            Contract.Requires <ArgumentNullException>(element != null);

            var customHandler = element.GetSelfAndVisualAncestors()
                                .OfType <ICustomKeyboardNavigation>()
                                .FirstOrDefault();

            if (customHandler != null)
            {
                var(handled, next) = customHandler.GetNext(element, direction);

                if (handled)
                {
                    if (next != null)
                    {
                        return(next);
                    }
                    else if (direction == NavigationDirection.Next || direction == NavigationDirection.Previous)
                    {
                        return(TabNavigation.GetNextInTabOrder((IInputElement)customHandler, direction, true));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }

            if (direction == NavigationDirection.Next || direction == NavigationDirection.Previous)
            {
                return(TabNavigation.GetNextInTabOrder(element, direction));
            }
            else
            {
                throw new NotSupportedException();
            }
        }
        private static bool HandlePreCustomNavigation(
            ICustomKeyboardNavigation customHandler,
            IInputElement element,
            NavigationDirection direction,
            [NotNullWhen(true)] out IInputElement?result)
        {
            if (customHandler != null)
            {
                var(handled, next) = customHandler.GetNext(element, direction);

                if (handled)
                {
                    if (next != null)
                    {
                        result = next;
                        return(true);
                    }
                    else if (direction == NavigationDirection.Next || direction == NavigationDirection.Previous)
                    {
                        var r = direction switch
                        {
                            NavigationDirection.Next => TabNavigation.GetNextTabOutside(customHandler),
                            NavigationDirection.Previous => TabNavigation.GetPrevTabOutside(customHandler),
                            _ => throw new NotSupportedException(),
                        };

                        if (r is object)
                        {
                            result = r;
                            return(true);
                        }
                    }
                }
            }

            result = null;
            return(false);
        }
Example #20
0
 /// <summary>
 /// 测试初始化
 /// </summary>
 public TabNavigationTest(ITestOutputHelper output)
 {
     _output    = output;
     _component = new TabNavigation(new StringWriter());
 }
Example #21
0
		public void Undo(TabNavigation navEngine) {
			if (PreviousPosition != null) {
				PreviousPosition.Execute(navEngine);
			}
		}
Example #22
0
        public void Initialize(GTabSettings <TKey, TValue> settings)
        {
            Settings = settings;

            _displayGrid = new Grid();
            _displayGrid.SetValue(Grid.ColumnProperty, 2);
            _displayGrid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            });
            _displayGrid.ColumnDefinitions.Add(new ColumnDefinition());
            _displayGrid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(10)
            });
            _displayGrid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            });
            _displayGrid.ColumnDefinitions.Add(new ColumnDefinition());

            if (Settings.DbData == ServerDbs.ClientItems ||
                Settings.DbData == ServerDbs.Pet ||
                Settings.DbData == ServerDbs.Pet2 ||
                Settings.DbData == ServerDbs.Mobs ||
                Settings.DbData == ServerDbs.Mobs2 ||
                Settings.DbData == ServerDbs.MobGroups ||
                Settings.DbData == ServerDbs.Items ||
                Settings.DbData == ServerDbs.Items2)
            {
                _viewGrid.Children.Add(_displayGrid);
            }
            else
            {
                ScrollViewer sv = new ScrollViewer();
                sv.SetValue(Grid.ColumnProperty, 2);
                sv.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Auto);
                sv.Focusable = false;
                sv.Content   = _displayGrid;
                _viewGrid.Children.Add(sv);
            }

            ProjectDatabase = settings.ClientDatabase;
            DbComponent     = ProjectDatabase.GetDb <TKey>(settings.DbData);
            Table           = Settings.Table;
            Header          = Settings.TabName;
            Style           = TryFindResource(settings.Style) as Style ?? Style;
            SearchEngine    = settings.SearchEngine;
            SearchEngine.Init(_dbSearchPanel, this);
            Table.TableUpdated += new Table <TKey, TValue> .UpdateTableEventHandler(_table_TableUpdated);

            if (Settings.SearchEngine.SetupImageDataGetter != null)
            {
                ListViewDataTemplateHelper.GenerateListViewTemplateNew(_listView, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
                    new ListViewDataTemplateHelper.GeneralColumnInfo {
                        Header = Settings.AttId.DisplayName, DisplayExpression = "[" + Settings.AttId.Index + "]", SearchGetAccessor = Settings.AttId.AttributeName, FixedWidth = Settings.AttIdWidth, TextAlignment = TextAlignment.Right, ToolTipBinding = "[" + Settings.AttId.Index + "]"
                    },
                    new ListViewDataTemplateHelper.ImageColumnInfo {
                        Header = "", DisplayExpression = "DataImage", SearchGetAccessor = Settings.AttId.AttributeName, FixedWidth = 26, MaxHeight = 24
                    },
                    new ListViewDataTemplateHelper.RangeColumnInfo {
                        Header = Settings.AttDisplay.DisplayName, DisplayExpression = "[" + Settings.AttDisplay.Index + "]", SearchGetAccessor = Settings.AttDisplay.AttributeName, IsFill = true, ToolTipBinding = "[" + Settings.AttDisplay.Index + "]", MinWidth = 100, TextWrapping = TextWrapping.Wrap
                    }
                }, new DatabaseItemSorter(Settings.AttributeList), new string[] { "Deleted", "{DynamicResource CellBrushRemoved}", "Modified", "{DynamicResource CellBrushModified}", "Added", "{DynamicResource CellBrushAdded}", "Normal", "{DynamicResource TextForeground}" });
            }
            else
            {
                ListViewDataTemplateHelper.GenerateListViewTemplateNew(_listView, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
                    new ListViewDataTemplateHelper.GeneralColumnInfo {
                        Header = Settings.AttId.DisplayName, DisplayExpression = "[" + Settings.AttId.Index + "]", SearchGetAccessor = Settings.AttId.AttributeName, FixedWidth = Settings.AttIdWidth, TextAlignment = TextAlignment.Right, ToolTipBinding = "[" + Settings.AttId.Index + "]"
                    },
                    new ListViewDataTemplateHelper.RangeColumnInfo {
                        Header = Settings.AttDisplay.DisplayName, DisplayExpression = "[" + Settings.AttDisplay.Index + "]", SearchGetAccessor = Settings.AttDisplay.AttributeName, IsFill = true, ToolTipBinding = "[" + Settings.AttDisplay.Index + "]", MinWidth = 100, TextWrapping = TextWrapping.Wrap
                    }
                }, new DatabaseItemSorter(Settings.AttributeList), new string[] { "Deleted", "{DynamicResource CellBrushRemoved}", "Modified", "{DynamicResource CellBrushModified}", "Added", "{DynamicResource CellBrushAdded}", "Normal", "{DynamicResource TextForeground}" });
            }

            if (!Settings.CanBeDelayed || Settings.AttributeList.Attributes.Any(p => p.IsSkippable))
            {
                _deployTabControls();
            }

            _initTableEvents();

            if (Settings.ContextMenu != null)
            {
                if (Header is Control)
                {
                    ((Control)Header).ContextMenu = Settings.ContextMenu;
                }
            }

            if (Settings.Loaded != null)
            {
                Settings.Loaded((GDbTabWrapper <TKey, ReadableTuple <TKey> >)(object) this, (GTabSettings <TKey, ReadableTuple <TKey> >)(object) Settings, ProjectDatabase.GetDb <TKey>(Settings.DbData));
            }

            if (Settings.DisplayablePropertyMaker.OnTabVisible != null)
            {
                Settings.DisplayablePropertyMaker.OnTabVisible(this);
            }

            Loaded += delegate {
                TabControl parent = WpfUtilities.FindParentControl <TabControl>(this);

                if (parent != null)
                {
                    parent.SelectionChanged += new SelectionChangedEventHandler(_parent_SelectionChanged);
                }
            };

            _listView.PreviewMouseDown += delegate { _listView.Focus(); };

            _listView.Loaded += delegate {
                try {
                    if (IsVisible)
                    {
                        Keyboard.Focus(_listView);
                    }
                }
                catch {
                }
            };

            ApplicationShortcut.Link(ApplicationShortcut.Paste, () => ImportFromFile("clipboard"), _listView);
            ApplicationShortcut.Link(ApplicationShortcut.AdvancedPaste, () => ImportFromFile("clipboard", true), this);
            ApplicationShortcut.Link(ApplicationShortcut.AdvancedPaste2, () => ImportFromFile("clipboard", true), this);
            ApplicationShortcut.Link(ApplicationShortcut.Cut, () => _miCut_Click(null, null), _listView);
            ApplicationShortcut.Link(ApplicationShortcut.FromString("F3", "Search next empty ID"), () => {
                if (_listView.SelectedItems.Count > 0)
                {
                    ReadableTuple <int> item = (_listView.SelectedItems[_listView.SelectedItems.Count - 1]) as ReadableTuple <int>;
                    var original             = item;

                    if (item != null)
                    {
                        int id = item.Key;

                        while (true)
                        {
                            id++;
                            var idGeneric = (TKey)(object)id;

                            var tuple = (ReadableTuple <int>)(object) Table.TryGetTuple(idGeneric);

                            if (tuple == null && item != original && item != null)
                            {
                                TabNavigation.SelectList(DbComponent.DbSource, new TKey[] { item.GetKey <TKey>() });
                                break;
                            }

                            item = tuple;
                        }
                    }
                }
            }, _listView);
        }
Example #23
0
        public ChannelPage(ChannelData channel, ChannelsPage parentChannelsPage, bool isMasterChannel) : base("div")
        {
            _channel            = channel;
            _parentChannelsPage = parentChannelsPage;
            _isMasterChannel    = isMasterChannel;
            SetBorder(BorderKind.Rounded, StylingColor.Secondary);

            #region Initialize Grid

            Grid grid = new Grid(this);
            grid.AddStyling(StylingOption.MarginRight, 2);
            grid.AddStyling(StylingOption.MarginLeft, 2);
            grid.AddStyling(StylingOption.MarginTop, 4);
            grid.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Initialize Grid

            #region TextInputGroup ProgrammName

            MultiInputGroup channelNameMultiInputGroup = new MultiInputGroup();
            channelNameMultiInputGroup.AppendLabel("Kanal:");
            channelNameMultiInputGroup.AppendLabel(channel.ChannelId.ToString());
            channelNameMultiInputGroup.AppendLabel("  Name:");
            _channelNameTextInput = channelNameMultiInputGroup.AppendTextInput("Kanalname?", true, channel.Name);

            channelNameMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);

            if (!isMasterChannel)
            {
                _deleteChannelButton        = new Button(StylingColor.Danger, asOutline: true, text: "Kanal Löschen", fontAwesomeIcon: "trash");
                _deleteChannelButton.Click += DeleteChannelButtonOnClick;
                channelNameMultiInputGroup.AppendCustomElement(_deleteChannelButton, false);
            }
            else
            {
                _channelNameTextInput.IsDisabled = true;
            }
            grid.AddRow().AppendCollum(channelNameMultiInputGroup);

            #endregion TextInputGroup ProgrammName

            #region add TabNavigate

            _tabNavigation = new TabNavigation(true, true);
            _tabNavigation.AddButton.Click += (sender, args) =>
            {
                ChannelProgramData channelProgramData = ChannelProgramData.CreateNew(channel.ProgramList.Count > 0 ? channel.ProgramList.Max(data => int.TryParse(data.Name, out int parsedInt) ? parsedInt : 1) + 1 : 1);
                channel.ProgramList.Add(channelProgramData);
                ChannelProgrammPage channelProgrammPage = new ChannelProgrammPage(channelProgramData, this, isMasterChannel);
                _channelProgrammPages.Add(channelProgrammPage);
                _tabDictionary.Add(channelProgramData, _tabNavigation.AddTab(channelProgramData.Id.ToString(), channelProgrammPage, channelProgramData.Id == 1));
            };
            grid.AddRow().AppendCollum(_tabNavigation);

            #endregion add TabNavigate

            #region add ChannelProgrammPages

            foreach (ChannelProgramData channelProgramData in channel.ProgramList)
            {
                ChannelProgrammPage channelProgrammPage = new ChannelProgrammPage(channelProgramData, this, isMasterChannel);
                _channelProgrammPages.Add(channelProgrammPage);
                _tabDictionary.Add(channelProgramData, _tabNavigation.AddTab(channelProgramData.Id.ToString(), channelProgrammPage, channelProgramData.Id == channel.ProgramList.First().Id));
                ApplyName(channelProgramData);
            }

            #endregion add ChannelProgrammPages

            #region AddHumiditySensor

            AddHumiditySensor(channel, grid);

            _humiditySensorDropdown.Button.IsDisabled            = _isMasterChannel;
            _humiditySensorEnabledTwoStateButtonGroup.IsDisabled = _isMasterChannel;

            #endregion AddHumiditySensor

            #region SaveChannel Button

            Button saveButton = new Button(StylingColor.Success, true, Button.ButtonSize.Normal, false, "Speichern", fontAwesomeIcon: "save");
            saveButton.AddStyling(StylingOption.MarginTop, 4);
            saveButton.AddStyling(StylingOption.MarginLeft, 4);
            saveButton.AddStyling(StylingOption.MarginBottom, 1);
            saveButton.AddStyling(StylingOption.PaddingLeft, 5);
            saveButton.AddStyling(StylingOption.PaddingRight, 5);
            saveButton.Click += SaveButton_Click;
            grid.AddRow().AppendCollum(saveButton);

            #endregion SaveChannel Button
        }
Example #24
0
		public void Add(TabControl mainTabControl, DbHolder holder, TabNavigation tabEngine, SdeEditor editor) {
			holder.AddTable(_adb);
			GDbTab copy = holder.GetTab(_adb, mainTabControl);

			if (_adb is AbstractDb<int>)
				_adb.To<int>().Table.Commands.CommandIndexChanged += (e, a) => editor.UpdateTabHeader(_adb.To<int>());
			else if (_adb is AbstractDb<string>)
				_adb.To<string>().Table.Commands.CommandIndexChanged += (e, a) => editor.UpdateTabHeader(_adb.To<string>());

			copy._listView.SelectionChanged += delegate(object sender, SelectionChangedEventArgs args) {
				if (sender is ListView) {
					ListView view = (ListView)sender;
					tabEngine.StoreAndExecute(new SelectionChanged(copy.Header.ToString(), view.SelectedItem, view, copy));
				}
			};

			((DisplayLabel) copy.Header).ContextMenu.Items.Cast<MenuItem>().ToList().ForEach(p => p.IsEnabled = true);

			MenuItem mitem = new MenuItem();
			mitem.Icon = new Image { Source = ApplicationManager.GetResourceImage("delete.png") };
			mitem.Header = "Delete table";
			mitem.Click += delegate {
				holder.RemoveTable(_adb);
				mainTabControl.Items.Remove(copy);

				List<string> tabs = ProjectConfiguration.CustomTabs;
				tabs.Remove(_file);
				ProjectConfiguration.CustomTabs = tabs.Distinct().ToList();
			};

			((DisplayLabel) copy.Header).ContextMenu.Items.Add(mitem);

			mainTabControl.Items.Insert(mainTabControl.Items.Count, copy);
			_adb.LoadDb();

			if (_adb is AbstractDb<int>)
				copy.To<int>().SearchEngine.Filter(this);
			else if (_adb is AbstractDb<string>)
				copy.To<string>().SearchEngine.Filter(this);

			editor.GdTabs.Add(copy);
		}
Example #25
0
		public void Execute(TabNavigation navEngine) {
			navEngine.Select(_tabName, _tuple, _view);
		}
Example #26
0
 /// <summary>
 /// 初始化导航选项卡包装器
 /// </summary>
 /// <param name="tabs">导航选项卡</param>
 public TabNavigationWrapper(TabNavigation tabs)
 {
     _container = tabs;
 }