protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();

            sb.Append("<div class=\"clearFix\">");
            sb.Append("  <div id=\"" + (String.IsNullOrEmpty(BlockID) ? ClientID : BlockID) + "\" class=\"tabsNavigationLinkBox\">");

            if (HasTabItems)
            {
                var visibleTabItems  = TabItems.Where(tab => tab.Visible).ToList();
                var visibleTabsCount = visibleTabItems.Count;

                for (var i = 0; i < visibleTabsCount; i++)
                {
                    sb.Append(visibleTabItems[i].GetTabLink(i == visibleTabsCount - 1));
                }
            }

            sb.Append("  </div>");
            sb.Append("</div>");

            writer.Write(sb.ToString());

            foreach (var tab in TabItems.Where(tab => tab.Visible && string.IsNullOrEmpty(tab.TabHref) && !tab.SkipRender))
            {
                tab.RenderTabContent(writer);
            }
        }
示例#2
0
        private void OnRegistrationJournalCommandExecute()
        {
            TabItem temp = TabItems.Where(x => (string)x.Header == "Журнал регистрации исследований").FirstOrDefault();

            if (temp == null)
            {
                RegistrationJournalViewModel window = new RegistrationJournalViewModel();
                TabItems.Add(CreateTabItem("Журнал регистрации исследований", window));
            }
            else
            {
                SelectedTabItem = temp;
            }

            //windowsList.Add((RegistrationJournalViewModel)tempWindow);
            //var tabItem = new TabItem();
            //tabItem.Header = "Журнал регистрации исследований";
            //ContentControl contentControl = new ContentControl();
            //contentControl.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            //contentControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            //Binding b = new Binding();
            //b.Source = regJournalWindow;
            //b.Source = tempWindow;
            //b.Converter = new ViewModelToViewConverter();
            //contentControl.SetBinding(ContentControl.ContentProperty, b);
            //tabItem.Content = contentControl;
            //SelectedTabItem = tabItem;
            //CurrentWindow = (RegistrationJournalViewModel)tempWindow;
            //CurrentWindow = windowsList[windowsList.Count - 1];
            //CurrentWindow = regJournalWindow;
            //TabItems.Add(tabItem);
        }
示例#3
0
 protected override void OnInit(EventArgs e)
 {
     foreach (var tab in TabItems.Where(tab => tab.Visible))
     {
         Controls.Add(tab);
     }
     base.OnInit(e);
 }
示例#4
0
 void StartLogging()
 {
     StopThreads = false;
     foreach (var tabItem in TabItems.Where(tabItem => tabItem.Content.DataContext is IHaveLoggerGroup))
     {
         var groupId = (tabItem.Content.DataContext as IHaveLoggerGroup).LogGroupId;
         threads.Add(new Thread(() => CreateSomeLogs(groupId)));
     }
     foreach (var thread in threads.Where(x => x.ThreadState == ThreadState.Unstarted))
     {
         thread.Start();
     }
 }
示例#5
0
        private void OnCloseOtherTab()
        {
            List <TabItemModel> deleteItems = TabItems.Where(
                item =>
                item.ItemNamespace != SelectedModel.ItemNamespace || item.DataNum != SelectedModel.DataNum)
                                              .ToList();


            foreach (var item in deleteItems)
            {
                TabItems.Remove(item);
            }
        }
示例#6
0
        private void OnEditCustomersCommandExecute()
        {
            TabItem temp = TabItems.Where(x => (string)x.Header == "Заказчики").FirstOrDefault();

            if (temp == null)
            {
                CustomersEditorViewModel window = new CustomersEditorViewModel();
                TabItems.Add(CreateTabItem("Заказчики", window));
            }
            else
            {
                SelectedTabItem = temp;
            }
        }
示例#7
0
        private void OnEditEngineersCommandExecute()
        {
            TabItem temp = TabItems.Where(x => (string)x.Header == "Список работников").FirstOrDefault();

            if (temp == null)
            {
                EngineersEditorViewModel window = new EngineersEditorViewModel();
                TabItems.Add(CreateTabItem("Список работников", window));
            }
            else
            {
                SelectedTabItem = temp;
            }
        }
示例#8
0
        private void OnCloseAllTabs(object?obj)
        {
            if (obj is not DirectoryTabItemViewModel directoryTabItem)
            {
                return;
            }

            var removedItems = TabItems.Where(i => i != directoryTabItem).ToList();

            foreach (var item in removedItems)
            {
                TabItems.Remove(item);
            }
        }
示例#9
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();

            if (HasTabItems)
            {
                sb.AppendFormat("<div class='viewSwitcher'><ul class='clearFix viewSwitcherAreaWithBottomBorder'>");

                foreach (var tab in TabItems)
                {
                    tab.SortItemsDivID = SortItemsDivID;
                    if (tab.Visible)
                    {
                        sb.Append(tab.GetSortLink(RenderAllTabs));
                    }
                }
            }

            if (HasSortItems)
            {
                if (HasTabItems)
                {
                    sb.Append("<li align='right' style='float: right; list-style: none;'><div class='clearFix'>");
                }

                sb.Append("<table cellspacing='0' cellpadding='0'><tr>");

                if (!string.IsNullOrEmpty(SortItemsHeader))
                {
                    sb.AppendFormat("<td class='viewSwitcherItem'>{0}</td>", SortItemsHeader.HtmlEncode());
                }

                foreach (var sortItem in SortItems)
                {
                    sb.AppendFormat("<td>{0}</td>", sortItem.GetSortLink);
                }

                sb.Append("</tr></table>");

                if (HasTabItems)
                {
                    sb.Append("</div></li>");
                }
            }


            if (HasTabItems)
            {
                sb.Append("</ul></div>");
            }

            writer.Write(sb.ToString());

            foreach (var tab in TabItems.Where(tab => tab.Visible))
            {
                if (RenderAllTabs)
                {
                    tab.RenderTabContent(writer);
                    continue;
                }
                if (tab.IsSelected && DisableJavascriptSwitch)
                {
                    tab.RenderTabContent(writer);
                }
            }
        }