Example #1
0
        private async Task OpenListTabAction(long id)
        {
            if (id == 0)
            {
                return;
            }
            var     surrogateKey = GetTabIndex();
            TabBase tab          = null;

            try
            {
                tab = await TabFactory.CreateListTab(id, surrogateKey);
            }
            catch
            {
                ListProvider.Id.Value = 0;
                return;
            }
            AddTab(tab);
            if (ListReloadTimeCalclator == null)
            {
                var targetCnt = Tabs.Count() == 0
                    ? 1
                    : Tabs.Count(t => t.GetType() == typeof(TabList));
                ListReloadTimeCalclator = CalcReloadTimeList.GetInstance(targetCnt, tab.Limit);
                tab.RefleshTimer(ListReloadTimeCalclator.CalcReloadTime(tab.Limit));
            }
            else
            {
                tab.RefleshTimer(ListReloadTimeCalclator.AddTab(tab.Limit));
            }
            ListProvider.Id.Value = 0;
        }
Example #2
0
 private void SetSliderWidth()
 {
     if (Tabs != null)
     {
         TabsLayout.SliderView.WidthRequest = (this.Width / Tabs.Count());
     }
 }
Example #3
0
 private void TabSelected(int index)
 {
     if (Tabs?.Count() > index)
     {
         TabSelected(Tabs.ElementAt(index));
     }
 }
        public void CreateNewTab(int auditLogId)
        {
            var auditRecord = _auditLogRepository.GetDdlAudit(auditLogId).SingleOrDefault();

            if (auditRecord != null)
            {
                Tabs.Add(new TabItem {
                    Header = auditRecord.ObjectName, Content = "Edited By: " + auditRecord.Login + "\n\n" + auditRecord.Tsql
                });
                SelectedTabIndex = Tabs.Count() - 1;
            }
        }
Example #5
0
        /// <summary>
        /// If we mess up the tab ordering just reset the order
        /// </summary>
        void FixTabOrdering()
        {
            int tabsWithDefaultOrder = Tabs.Count(x => x.TabOrder == 1);
            int tabsWithMaxOrder     = Tabs.Count(x => x.TabOrder == Tabs.Max(m => m.TabOrder));

            if (tabsWithDefaultOrder > 1 || tabsWithMaxOrder > 1)
            {
                int order = 1;
                foreach (var tab in Tabs.OrderBy(x => x.Title))
                {
                    tab.TabOrder = order;
                    order++;

                    Messenger.Default.Send <DatabaseMessage>(DatabaseMessage.Update(tab.Model));
                }

                // Refresh the view to reapply the sort
                TabsView.Refresh();
            }
        }
        private void SetSelectedTab()
        {
            var count = Tabs.Count();

            SelectedTabIndex = count - 1;
        }
Example #7
0
        //----------------------------------------------------------------------
        public override void DoLayout(Rectangle _rect)
        {
            base.DoLayout(_rect);
            HitBox = LayoutRect;

            Rectangle contentRect = new Rectangle(LayoutRect.X, LayoutRect.Y + (Style.TabHeight - Style.TabBarPanelVerticalOffset), LayoutRect.Width, LayoutRect.Height - (Style.TabHeight - Style.TabBarPanelVerticalOffset));

            mPanel.DoLayout(contentRect);

            int iTabBarStartX = LayoutRect.Left + Style.TabBarLeftOffset;
            int iTabBarEndX   = LayoutRect.Right - Style.TabBarRightOffset;

            int iTabBarWidth = iTabBarEndX - iTabBarStartX;

            int iUnpinnedTabsCount = Tabs.Count(tab => !tab.IsPinned);

            int iPinnedTabsWidth   = Tabs.Sum(tab => tab.IsPinned ? tab.ContentWidth : 0);
            int iUnpinnedTabsWidth = Style.UnpinnedTabWidth * iUnpinnedTabsCount;

            miUnpinnedTabWidth = Style.UnpinnedTabWidth;

            if (iPinnedTabsWidth + iUnpinnedTabsWidth > iTabBarWidth && iUnpinnedTabsCount > 0)
            {
                miUnpinnedTabWidth = (iTabBarWidth - iPinnedTabsWidth) / iUnpinnedTabsCount;
            }

            int iDraggedTabX = 0;

            if (DraggedTab != null)
            {
                iDraggedTabX = Math.Min(iTabBarEndX - miUnpinnedTabWidth, Math.Max(iTabBarStartX, Screen.Game.InputMgr.MouseState.X - DraggedTab.DragOffset));
            }

            int  iTabX               = 0;
            int  iTabIndex           = 0;
            bool bDraggedTabInserted = DraggedTab == null;

            miDraggedTabTargetIndex = Tabs.Count - 1;
            foreach (NotebookTab tab in Tabs)
            {
                if (tab == DraggedTab)
                {
                    continue;
                }

                int iTabWidth = tab.IsPinned ? tab.ContentWidth : miUnpinnedTabWidth;

                if (!tab.IsPinned && !bDraggedTabInserted && iDraggedTabX - iTabBarStartX < iTabX + iTabWidth / 2)
                {
                    miDraggedTabTargetIndex = iTabIndex;
                    iTabX += miUnpinnedTabWidth;
                    bDraggedTabInserted = true;
                }

                Rectangle tabRect = new Rectangle(
                    iTabBarStartX + iTabX,
                    LayoutRect.Y,
                    iTabWidth,
                    Style.TabHeight
                    );

                tab.DoLayout(tabRect);

                iTabX += iTabWidth;
                iTabIndex++;
            }

            if (DraggedTab != null)
            {
                Rectangle tabRect = new Rectangle(
                    iDraggedTabX,
                    LayoutRect.Y,
                    miUnpinnedTabWidth,
                    Style.TabHeight
                    );

                DraggedTab.DoLayout(tabRect);
            }

            Tabs[ActiveTabIndex].PageGroup.DoLayout(contentRect);
        }