public TabItem tabControl_OnTabCreated(UIElementInfo uiElement, TabItem tab, int tabIndex)
    {
        switch (uiElement.ElementName.ToLowerCSafe())
        {
            case "tools":
                // Hide "Tools" tab if none of modules is available (E-commerce or Contact management)
                bool toolsAvailable = LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Ecommerce, ModuleEntry.ECOMMERCE) || LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.ContactManagement, ModuleEntry.ONLINEMARKETING);
                if (!toolsAvailable)
                {
                    return null;
                }
                break;

            case "buy":
                if (!LicenseKeyInfoProvider.OnlyTrialLicenseKeys)
                {
                    return null;
                }
                break;

            case "dashboard":
                // Add hash to url
                tab.RedirectUrl = URLHelper.ResolveUrl(URLHelper.EnsureHashToQueryParameters(uiElement.ElementTargetURL));
                break;
        }

        return tab;
    }
Exemple #2
0
        public void TabItemIsEnabledPropertyUpdateTest()
        {
            TabControl tabControl = new TabControl();

            TabItem tabItem1 = new TabItem();
            TabItem tabItem2 = new TabItem();

            tabControl.Items.Add(tabItem1);
            tabControl.Items.Add(tabItem2);

            CreateAsyncTask(tabControl,
                () => Assert.IsTrue(tabControl.IsEnabled),
                () => Assert.IsTrue(tabItem1.IsEnabled),
                () => Assert.IsTrue(tabItem2.IsEnabled),

                () => tabItem1.IsEnabled = false,
                () => tabControl.IsEnabled = false,
                () => Assert.IsFalse(tabItem1.IsEnabled),
                () => Assert.IsFalse(tabItem2.IsEnabled),

                () => tabControl.IsEnabled = true,
                () => Assert.IsFalse(tabItem1.IsEnabled),
                () => Assert.IsTrue(tabItem2.IsEnabled)
            );

            EnqueueTestComplete();
        }
        public void First_Tab_Should_Be_Selected_By_Default()
        {
            TabItem selected;
            var target = new TabControl
            {
                Template = new FuncControlTemplate<TabControl>(CreateTabControlTemplate),
                Items = new[]
                {
                    (selected = new TabItem
                    {
                        Name = "first",
                        Content = "foo",
                    }),
                    new TabItem
                    {
                        Name = "second",
                        Content = "bar",
                    },
                }
            };

            target.ApplyTemplate();

            Assert.Equal(0, target.SelectedIndex);
            Assert.Equal(selected, target.SelectedItem);
        }
    public static void AddPages(TabControl tabControl, string tabName, bool maxSize, params Page[] pages)
    {
        Grid grid = new Grid();
        grid.Width = double.NaN;
        grid.Height = double.NaN;
        grid.Margin = new Thickness(0);
        grid.VerticalAlignment = VerticalAlignment.Top;

        if (maxSize)
        {
            grid.HorizontalAlignment = HorizontalAlignment.Stretch;
            grid.VerticalAlignment = VerticalAlignment.Stretch;
        }

        int index = 0;
        foreach (var item in pages)
        {
            ColumnDefinition col = new ColumnDefinition();
            col.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(col);
            SetPageToGrid(item, grid, 0, index);
            index++;
        }

        TabItem tabItem = new TabItem();
        tabItem.Header = tabName;
        tabItem.Content = grid;
        tabControl.Items.Add(tabItem);
    }
    protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        switch (element.ElementName.ToLowerCSafe())
        {
            case "customers.customfields":

                // Check if customer has any custom fields
                FormInfo formInfo = FormHelper.GetFormInfo("ecommerce.customer", false);
                if (!formInfo.GetFormElements(true, false, true).Any())
                {
                    return null;
                }
                break;

            case "customers.newsletters":
                if (!ModuleEntry.IsModuleLoaded(ModuleEntry.NEWSLETTER))
                {
                    return null;
                }
                break;

            case "customers.credit":
                // Hide Credit tab for anonymous customer
                if ((customerInfoObj == null) || !customerInfoObj.CustomerIsRegistered)
                {
                    return null;
                }
                break;
        }

        return tab;
    }
Exemple #6
0
    public static void AddPage(TabControl tabControl, string tapName, Page page, bool maxSize = true)
    {
        if (maxSize)
        {
            page.Width = double.NaN;
            page.Height = double.NaN;
            page.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            page.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
        }

        Frame frame = new Frame();
        if (maxSize)
        {
            frame.Width = double.NaN;
            frame.Height = double.NaN;
            frame.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            frame.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
        }

        frame.Content = page;
        TabItem tabItem = new TabItem();
        tabItem.Header = tapName;
        tabItem.Content = frame;
        tabControl.Items.Add(tabItem);
    }
        //*******************************************************
        //
        // The AddTab_Click server event handler is used to add
        // a new security tab for this portal
        //
        //*******************************************************
        protected void AddTab_Click(Object Sender, EventArgs e)
        {
            // Obtain PortalSettings from Current Context
            PortalSettings portalSettings = (PortalSettings) Context.Items["PortalSettings"];

            // New tabs go to the end of the list
            TabItem t = new TabItem();
            t.TabName = "New Tab";
            t.TabId = -1;
            t.TabOrder = 999;
            portalTabs.Add(t);

            // write tab to database
            Configuration config = new Configuration();
            t.TabId = config.AddTab(portalSettings.PortalId, t.TabName, t.TabOrder);

            // reload the _portalSettings from the database
            HttpContext.Current.Items["PortalSettings"] = new PortalSettings(portalSettings.PortalId, t.TabId);

            // Reset the order numbers for the tabs within the list
            OrderTabs();

            // Redirect to edit page
            Response.Redirect("~/Admin/TabLayout.aspx?tabid=" + t.TabId);
        }
    protected TabItem CMSDesk_Default_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        // Ensure additional permissions to 'Content' tab
        if (element.ElementName.ToLowerCSafe() == "content")
        {
            if (!IsUserAuthorizedPerContent())
            {
                exploreTreePermissionMissing = true;
                return null;
            }
        }
        else if (element.ElementName.ToLowerCSafe() == "ecommerce")
        {
            if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Ecommerce, ModuleEntry.ECOMMERCE))
            {
                return null;
            }
        }
        else if (element.ElementName.ToLowerCSafe() == "onlinemarketing")
        {
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING))
            {
                return null;
            }
        }

        return tab;
    }
    /// <summary>
    /// Initializes workflow edit menu.
    /// </summary>
    protected void InitalizeMenu()
    {
        // General tab
        TabItem general = new TabItem()
                            {
                                Text = GetString("general.general"),
                                RedirectUrl = "Workflow_General.aspx?workflowId=" + WorkflowId,
                                OnClientClick = "SetHelpTopic('helpTopic', 'workflow_general');"
                            };
        SetTab(general);

        // Steps tab
        TabItem steps = new TabItem()
                            {
                                Text = GetString("Development-Workflow_Edit.Steps"),
                                RedirectUrl = CurrentWorkflow.IsBasic ? "Workflow_Steps.aspx?workflowId=" + WorkflowId : "Workflow_Designer.aspx?workflowId=" + WorkflowId,
                                OnClientClick = CurrentWorkflow.IsBasic ? "SetHelpTopic('helpTopic', 'workflow_steps');" : "SetHelpTopic('helpTopic', 'workflow_designer');"
                            };
        SetTab(steps);

        // Display additional tabs for document workflow
        if (CurrentWorkflow.IsDocumentWorkflow)
        {
            // Hide if no site or no running site
            if ((SiteInfoProvider.GetSitesCount() > 0))
            {
                // Scopes tab
                TabItem scopes = new TabItem()
                {
                    Text = GetString("Development-Workflow_Edit.Scopes"),
                    RedirectUrl = "Workflow_Scopes.aspx?workflowId=" + WorkflowId,
                    OnClientClick = "SetHelpTopic('helpTopic', 'workflow_scope');"
                };
                SetTab(scopes);
            }
        }

        // E-mails tab
        TabItem emails = new TabItem()
        {
            Text = GetString("Development-Workflow_Edit.Emails"),
            RedirectUrl = "Workflow_Emails.aspx?workflowId=" + WorkflowId,
            OnClientClick = "SetHelpTopic('helpTopic', 'workflow_emails');"
        };
        SetTab(emails);

        // Display additional tabs for document workflow
        if (CurrentWorkflow.IsDocumentWorkflow)
        {
            // Documents tab
            TabItem docs = new TabItem()
            {
                Text = GetString("general.documents"),
                RedirectUrl = "Workflow_Documents.aspx?workflowId=" + WorkflowId,
                OnClientClick = "SetHelpTopic('helpTopic', 'workflow_documents');"
            };
            SetTab(docs);
        }
    }
    protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        int siteId = SiteID;
        bool splitViewSupported = false;
        string lowerElementName = element.ElementName.ToLowerCSafe();

        // Skip some elements if editing just SKU without document binding
        switch (lowerElementName)
        {
            case "products.relatedproducts":
                if (NodeID <= 0)
                {
                    return null;
                }

                break;

            case "products.documents":
                if ((NodeID <= 0) && DisplayTreeInProducts)
                {
                    if (!CurrentUser.IsGlobalAdministrator || (sku == null) || !sku.IsGlobal)
                    {
                        return null;
                    }
                }

                break;

            case "products.workflow":
            case "products.versions":
                splitViewSupported = true;
                if ((NodeID <= 0) || (DocumentManager.Workflow == null))
                {
                    return null;
                }

                break;
        }

        // Ensure tab preselection
        if (lowerElementName.StartsWithCSafe("products.") && (lowerElementName.Substring("products.".Length) == selectedTab))
        {
            CurrentMaster.Tabs.SelectedTab = tabIndex;
        }

        // Add SiteId parameter to each tab
        if (!string.IsNullOrEmpty(tab.RedirectUrl) && (siteId != CMSContext.CurrentSiteID))
        {
            tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "siteId", siteId.ToString());
        }

        // Ensure split view mode
        if (splitViewSupported && CMSContext.DisplaySplitMode)
        {
            tab.RedirectUrl = GetSplitViewUrl(tab.RedirectUrl);
        }

        return tab;
    }
Exemple #11
0
 public void SetIsEnabled()
 {
     TabItem tabItem = new TabItem();
     tabItem.IsEnabled = false;
     Assert.IsFalse(tabItem.IsEnabled);
     tabItem.IsEnabled = true;
     Assert.IsTrue(tabItem.IsEnabled);
 }
Exemple #12
0
        public void TabItemDefaultValuesTest()
        {
            TabItem tabItem = new TabItem();

            Assert.IsNull(tabItem.Header);
            Assert.IsFalse(tabItem.IsSelected);
            Assert.IsNull(tabItem.TestHook.TabControlParent);
        }
 protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
 {
     // Skip objects tab element if not have proper license
     if ((element.ElementName.ToLowerCSafe() == "myrecyclebin.objects") && !LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.ObjectVersioning))
     {
         return null;
     }
     return tab;
 }
 // TODO JaroslavK: Po presunuti prijde odstranit
 protected TabItem Page_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
 {
     // Hide actions tab
     if (element.ElementName.EqualsCSafe("Automation_actions", true) && !CurrentUser.IsGlobalAdministrator)
     {
         return null;
     }
     return tab;
 }
    private TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        // Add SiteId parameter to each tab
        if (!string.IsNullOrEmpty(tab.RedirectUrl))
        {
            tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "siteId", SiteID.ToString());
        }

        return tab;
    }
    protected TabItem CMSModules_ContactManagement_Pages_Tools_ContactManagement_Header_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        switch (tabIndex)
        {
            case 0: tab.OnClientClick = "SetHelpTopic('helpTopic','waiting_for_my_approval')";
                break;

            case 1: tab.OnClientClick = "SetHelpTopic('helpTopic','onlinemarketing_pendingcontacts_list')";
                break;
        }

        return tab;
    }
    protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        string lowerElementName = element.ElementName.ToLowerCSafe();

        // Ensure tab preselection
        if (lowerElementName.StartsWithCSafe("contentproduct.") &&
            (lowerElementName.Substring("contentproduct.".Length) == selectedTab))
        {
            CurrentMaster.Tabs.SelectedTab = tabIndex;
        }

        return tab;
    }
    protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        if (element.ElementName.ToLowerCSafe() == "orders.customfields")
        {
            // Check if order has any custom fields
            FormInfo formInfo = FormHelper.GetFormInfo("ecommerce.order", false);
            if (!formInfo.GetFormElements(true, false, true).Any())
            {
                return null;
            }
        }

        return tab;
    }
        void OnClick(object sender, RoutedEventArgs e)
        {
            tabcon = new System.Windows.Controls.TabControl();
            ti1 = new TabItem();
            ti1.Header = "Background";
            tabcon.Items.Add(ti1);
            ti2 = new TabItem();
            ti2.Header = "Foreground";
            tabcon.Items.Add(ti2);
            ti3 = new TabItem();
            ti3.Header = "FontFamily";
            tabcon.Items.Add(ti3);

            cv2.Children.Add(tabcon);
        }
Exemple #20
0
 public void AddTab(string code, string name, Classes.CodeType type)
 {
     Visual_NXC.Controls.highlighterBox h = new Visual_NXC.Controls.highlighterBox();
     h.BorderStyle = BorderStyle.None;
     h.Dock = DockStyle.Fill;
     h.Text = code;
     h.AcceptsTab = true;
     h.CaseSensitive = true;
     InitSyntaxHighlighter(h);
     h.RefreshHighlighting();
     TabItem i = new TabItem(name, type, h);
     tabBar1.AddTab(i);
     panel1.Controls.Clear();
     panel1.Controls.Add(h);
 }
    protected TabItem tabElem_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        string elementName = element.ElementName.ToLowerCSafe();
        string siteName = CMSContext.CurrentSiteName;
        if ((elementName == "onlinemarketing.languages") && (!CultureInfoProvider.IsSiteMultilignual(siteName) || !CultureInfoProvider.LicenseVersionCheck()))
        {
            return null;
        }

        if (elementName.StartsWithCSafe("onlinemarketing.") && (!ModuleEntry.IsModuleLoaded("cms.onlinemarketing")))
        {
            return null;
        }

        return tab;
    }
Exemple #22
0
        public void GetDesiredSizeWithoutMarginTest()
        {
            Size size = new Size();
            TabItem tabItem = new TabItem();
            tabItem.Height = 100;
            tabItem.Width = 100;

            CreateAsyncTask(tabItem,
                () => tabItem.Margin = new Thickness(5, 5, 5, 5),
                () => size = TabPanel.GetDesiredSizeWithoutMargin(tabItem),
                () => Assert.AreEqual(size.Height, 100),
                () => Assert.AreEqual(size.Width, 100)
            );

            EnqueueTestComplete();
        }
    protected TabItem tabElem_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        string elementName = element.ElementName.ToLowerCSafe();

        if (elementName.StartsWithCSafe("validation.") && (elementName.Substring("validation.".Length) == selected))
        {
            selectedTabIndex = tabIndex;
        }

        if (tab.RedirectUrl != null)
        {
            tab.RedirectUrl = URLHelper.AppendQuery(URLHelper.RemoveQuery(tab.RedirectUrl), URLHelper.Url.Query);
        }

        return tab;
    }
    protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        // Global objects tab will be displayed only to global admin
        if (!currentUser.IsGlobalAdministrator && (element.ElementName.ToLowerCSafe() == "configuration.settings.globalobjects"))
        {
            return null;
        }

        // Add SiteId parameter to each tab
        if (!string.IsNullOrEmpty(tab.RedirectUrl))
        {
            tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "siteId", SiteID.ToString());
        }

        return tab;
    }
    /// <summary>
    /// Initializes workflow edit menu.
    /// </summary>
    protected void InitalizeMenu()
    {
        // General tab
        TabItem general = new TabItem()
        {
            Text = GetString("general.general"),
            RedirectUrl = "Tab_General.aspx?processId=" + ProcessID,
            OnClientClick = "SetHelpTopic('helpTopic', 'ma_process_general');"
        };
        SetTab(general);

        // Steps tab
        TabItem steps = new TabItem()
        {
            Text = GetString("ma.process.steps"),
            RedirectUrl = "Tab_Steps.aspx?processId=" + ProcessID,
            OnClientClick = "SetHelpTopic('helpTopic', 'ma_process_designer');"
        };
        SetTab(steps);

        // Triggers tab
        TabItem triggers = new TabItem()
        {
            Text = GetString("ma.trigger.list"),
            RedirectUrl = AddSiteQuery("Trigger/List.aspx?processId=" + ProcessID, (IsSiteManager ? UniSelector.US_ALL_RECORDS : SiteID)),
            OnClientClick = "SetHelpTopic('helpTopic', 'ma_process_triggers');"
        };
        SetTab(triggers);

        // Contacts tab
        TabItem contacts = new TabItem()
        {
            Text = GetString("om.contact.list"),
            RedirectUrl = AddSiteQuery("Tab_Contacts.aspx?processId=" + ProcessID, (IsSiteManager ? UniSelector.US_ALL_RECORDS : SiteID)),
            OnClientClick = "SetHelpTopic('helpTopic', 'ma_process_contacts');"
        };
        SetTab(contacts);

        // Reports tab
        TabItem reports = new TabItem()
        {
            Text = GetString("general.report"),
            RedirectUrl = AddSiteQuery("Tab_Report.aspx?processId=" + ProcessID, (IsSiteManager ? UniSelector.US_ALL_RECORDS : SiteID)),
            OnClientClick = "SetHelpTopic('helpTopic', 'ma_process_report');"
        };
        SetTab(reports);
    }
    /// <summary>
    /// Sets tabs for tab menu
    /// </summary>
    private void InitializeTabMenu()
    {
        if (ModuleEntry.IsModuleLoaded(ModuleEntry.NEWSLETTER) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.NEWSLETTER, CMSContext.CurrentSiteName))
        {
            TabItem newsletter = new TabItem();
            newsletter.Text = GetString("newsletter_edit.newsletters");
            newsletter.RedirectUrl = "#NewsletterGroup";
            tabControlElem.TabItems.Add(newsletter);
        }

        if (ModuleEntry.IsModuleLoaded(ModuleEntry.BLOGS) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.BLOGS, CMSContext.CurrentSiteName))
        {
            TabItem blog = new TabItem();
            blog.Text = GetString("blog.blogs");
            blog.RedirectUrl = "#BlogGroup";
            tabControlElem.TabItems.Add(blog);
        }

        if (ModuleEntry.IsModuleLoaded(ModuleEntry.MESSAGEBOARD) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.MESSAGEBOARD, CMSContext.CurrentSiteName))
        {
            TabItem board = new TabItem();
            board.Text = GetString("board.header.messageboards");
            board.RedirectUrl = "#BoardGroup";
            tabControlElem.TabItems.Add(board);
        }

        if (ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.FORUMS, CMSContext.CurrentSiteName))
        {
            TabItem forum = new TabItem();
            forum.Text = GetString("forum_list.headercaption");
            forum.RedirectUrl = "#ForumGroup";
            tabControlElem.TabItems.Add(forum);
        }

        if (ModuleEntry.IsModuleLoaded(ModuleEntry.REPORTING) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.REPORTING, CMSContext.CurrentSiteName))
        {
            TabItem report = new TabItem();
            report.Text = GetString("reporting.reports");
            report.RedirectUrl = "#ReportGroup";
            tabControlElem.TabItems.Add(report);
        }

        tabControlElem.SelectedTab = -1;
        tabControlElem.UrlTarget = "_self";
    }
    private static TabItem tabElem_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        switch (element.ElementName.ToLowerCSafe())
        {
            case "myprofile.notifications":
                if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Notifications, ModuleEntry.NOTIFICATIONS) ||
                    !ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.NOTIFICATIONS, CMSContext.CurrentSiteName))
                {
                    return null;
                }
                break;

            case "myprofile.categories":
                if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Categories", CMSContext.CurrentSiteName))
                {
                    return null;
                }
                break;
        }

        return tab;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Excluded binding types
        string[] excludedBindingObjects = { SiteObjectType.CULTURESITE.ToLowerCSafe() };

        // Get site bindings
        string[] otherBindingTypes = SiteInfo.TYPEINFO.OtherBindingObjectTypes.Split(';');

        for (int i = 0; i < otherBindingTypes.Length; i++)
        {
            string type = otherBindingTypes[i];
            if (!excludedBindingObjects.Contains(type.ToLowerCSafe()))
            {
                // Create binding object out of type
                BaseInfo bindingType = CMSObjectHelper.GetReadOnlyObject(type);
                if ((bindingType != null) && bindingType.TypeInfo.IsSiteBinding)
                {
                    // Get other side of the site binding
                    string otherSide = bindingType.TypeInfo.ParentObjectType;
                    string safeOtherSide = TranslationHelper.GetSafeClassName(otherSide);

                    // Build URL
                    string url = "Site_SiteObjects_Content.aspx?siteid=" + QueryHelper.GetInteger("siteid", 0) + "&objecttype=" + otherSide + "&bindingtype=" + type;
                    url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url));

                    // Initialize tab
                    TabItem tab = new TabItem
                                      {
                                          Text = GetString("objecttasks." + safeOtherSide),
                                          RedirectUrl = url
                                      };

                    CurrentMaster.Tabs.AddTab(tab);
                }
            }
        }

        CurrentMaster.Tabs.UrlTarget = "content";
    }
Exemple #29
0
        public void TabStripPlacementTest()
        {
            TabControl tabControl = new TabControl();
            TabItem tabItem = new TabItem();

            Assert.AreEqual(tabItem.TabStripPlacement, Dock.Top);

            tabControl.Items.Add(tabItem);
            tabItem.IsSelected = true;

            tabControl.TabStripPlacement = Dock.Bottom;
            Assert.AreEqual(tabItem.TabStripPlacement, Dock.Bottom);

            tabControl.TabStripPlacement = Dock.Left;
            Assert.AreEqual(tabItem.TabStripPlacement, Dock.Left);

            tabControl.TabStripPlacement = Dock.Right;
            Assert.AreEqual(tabItem.TabStripPlacement, Dock.Right);

            tabControl.TabStripPlacement = Dock.Top;
            Assert.AreEqual(tabItem.TabStripPlacement, Dock.Top);
        }
    /// <summary>
    /// Initializes scheduled tasks tabs.
    /// </summary>
    private void InitalizeMenu()
    {
        string siteParam = SiteID > 0 ? "?siteid=" + SiteID : "?selectedsiteid=' + selectedSiteId + '";

        // Tasks tab
        TabItem tasks = new TabItem()
        {
            Text = GetString("scheduler.tasks"),
            RedirectUrl = "Tab_Tasks.aspx" + siteParam,
            OnClientClick = "SetHelpTopic('helpTopic', 'tasks_list');"
        };
        SetTab(tasks);

        // System tasks tab
        TabItem systemTasks = new TabItem()
        {
            Text = GetString("scheduler.systemtasks"),
            RedirectUrl = "Tab_SystemTasks.aspx" + siteParam,
            OnClientClick = "SetHelpTopic('helpTopic', 'systemtasks_list');"
        };
        SetTab(systemTasks);
    }
Exemple #31
0
        public void saveChatPalette()
        {
            string strFilePath = null, strWrite;
            //タブ数を数える。
            int intTabCount = TabControl.Items.Count;

            if (intTabCount == 0)
            {
                return;
            }
            //タブ内容の容器を作る。
            SaveData sd = new SaveData();

            sd.palettes = new DataChatPalette[intTabCount];

            // 各タブのデータを格納する。
            for (int i = 0; i < intTabCount; i++)
            {
                sd.palettes[i] = new DataChatPalette();
                TabItem tabTemp = (TabItem)TabControl.Items[i];
                sd.palettes[i].paletteID = i + 1;
                sd.palettes[i].order     = i;
                sd.palettes[i].label     = tabTemp.Header.ToString();
                sd.palettes[i].stock     = composeLines(i);
                sd.palettes[i].textColor = "#000000";
            }

            var options = new JsonSerializerOptions()
            {
                Encoder       = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, //.Create(UnicodeRanges.All),
                WriteIndented = true
            };

            strWrite = JsonSerializer.Serialize(sd, options);
            strWrite = strWrite.Replace("\u3000", " ");//Encoredで" "は"\u3000"にエスケープされるため修正。

            // ファイルセーブポイント設定
            var dlgSave = new Microsoft.Win32.SaveFileDialog();

            try
            {
                dlgSave.DefaultExt  = ".json";
                dlgSave.Filter      = "チャットパレットファイル(.json)|*.json|全てのファイル(*.*)|*.*";
                dlgSave.FilterIndex = 1;
                if (dlgSave.ShowDialog() == true)
                {
                    this.IsEnabled = false;
                    strFilePath    = dlgSave.FileName;
                    this.IsEnabled = true;
                }
            }
            catch (ArgumentException e)
            {
                MessageBox.Show("Error SavaChatPalette :\n" + e.ToString());
            }
            // ファイル書き込み
            if (strFilePath == "" || strFilePath == null)
            {
                return;
            }

            using (StreamWriter writer = new StreamWriter(strFilePath, false, Encoding.GetEncoding("utf-8")))
            {
                writer.Write(strWrite);
            }


            return;
        }
Exemple #32
0
        public SearchResponse PerformSearch(TabItem tab, SearchParameters parameters)
        {
            Assert.ArgumentNotNull(tab, nameof(tab));
            Assert.ArgumentNotNull(parameters, nameof(parameters));

            // Init Query
            var initArgs = new InitQueryArgs
            {
                TabItem          = tab,
                SearchParameters = parameters
            };

            CorePipeline.Run(Pipeline.InitQuery, initArgs);
            Assert.ArgumentNotNullOrEmpty(initArgs.IndexName, nameof(initArgs.IndexName));

            var searchIndex = ContentSearchManager.GetIndex(initArgs.IndexName);

            using (var context = searchIndex.CreateSearchContext(initArgs.SearchSecurityOption))
            {
                var query = context.GetQueryable <SearchResultItem>();

                var watch = System.Diagnostics.Stopwatch.StartNew();

                // Build Query
                var queryArgs = new BuildQueryArgs
                {
                    TabItem          = tab,
                    SearchParameters = parameters,
                    Query            = query,
                    SearchContext    = context
                };
                CorePipeline.Run(Pipeline.BuildQuery, queryArgs);
                query = queryArgs.Query;

                // Apply Selected Facets
                var selectedFacets = GetSelectedFacets(parameters.SelectedFacets, tab.Facets);
                var finalQuery     = ApplySelectedFacets(query, selectedFacets, parameters);

                // Add common (unselected) facet-ons to lessen additional queries
                var unselectedFacets = GetUnselectedFacets(parameters.SelectedFacets, tab.Facets);
                finalQuery = ApplyFacetOn(finalQuery, unselectedFacets, parameters);

                // Execute
                var results = finalQuery.Cast <NimbleSearchResultItem>().GetResults();

                // Correct facet counts (for selected facets only)
                var facets = CorrectFacetCounts(query, selectedFacets, parameters, results.Facets?.Categories);


                watch.Stop();



                // Map Results
                var resultArgs = new MapResultArgs
                {
                    TabItem            = tab,
                    SearchParameters   = parameters,
                    TotalSearchResults = results.TotalSearchResults,
                    Hits          = results.Hits,
                    FacetResults  = facets,
                    QueryDuration = watch.ElapsedMilliseconds
                };
                CorePipeline.Run(Pipeline.MapResult, resultArgs);

                return(resultArgs.Response);
            }
        }
        private void AddNewTab(string nick, string ip)
        {
            //Check if the tab is previously open
            foreach (TabItem _t in TabControl.Items)
            {
                if (ip == ((string)_t.Tag).Remove(0, ((string)_t.Tag).IndexOf(':') + 1) && nick == ((string)_t.Tag).Remove(((string)_t.Tag).IndexOf(':')))
                {
                    return;
                }
            }

            Image      _closeButtonImage = new Image();
            StackPanel _st    = new StackPanel();
            StackPanel _st2   = new StackPanel();
            Button     _btn   = new Button();
            Button     _btn2  = new Button();
            Button     _btn3  = new Button();
            Button     _btn4  = new Button();
            TabItem    _tab   = new TabItem();
            Grid       _grd   = new Grid();
            TextBlock  _txt   = new TextBlock();
            TextBox    _txt2  = new TextBox();
            ListBox    _ltbox = new ListBox();
            Binding    _bndng = new Binding();

            //Tab Item Header
            _btn.Padding             = new Thickness(0.5);
            _btn.Height              = 17;
            _btn.Width               = 17;
            _btn.BorderThickness     = new Thickness(0);
            _btn.GotMouseCapture    += new MouseEventHandler(MouseDownOnTabCloseButton);
            _btn.LostMouseCapture   += new MouseEventHandler(MouseUpOnTabCloseButton);
            _btn.Focusable           = false;
            _btn.Margin              = new Thickness(7, 0, 0, 0);
            _st.VerticalAlignment    = VerticalAlignment.Center;
            _st.HorizontalAlignment  = HorizontalAlignment.Center;
            _closeButtonImage.Source = new BitmapImage(new Uri(@"/Resources/Images/NormalCloseIcon.png", UriKind.Relative));
            _closeButtonImage.Height = 13;
            _closeButtonImage.Width  = 13;
            _st.Children.Add(_closeButtonImage);
            _btn.Content           = _st;
            _st2.Orientation       = Orientation.Horizontal;
            _txt.VerticalAlignment = VerticalAlignment.Center;

            if (nick.Length > 12)
            {
                _txt.Text = nick.Substring(0, 9) + "...";
            }
            else
            {
                _txt.Text = nick;
            }

            _st2.Children.Add(_txt);
            _st2.Children.Add(_btn);

            _tab.Header = _st2;

            //Content
            RowDefinition rdefinition  = new RowDefinition();
            RowDefinition rdefinition2 = new RowDefinition();

            rdefinition.Height = new GridLength(451, GridUnitType.Star);
            _grd.RowDefinitions.Add(rdefinition);
            rdefinition2.Height = new GridLength(25, GridUnitType.Pixel);
            _grd.RowDefinitions.Add(rdefinition2);
            _ltbox.SetValue(Grid.RowProperty, 0);
            _bndng.Path               = new PropertyPath("ActualWidth");
            _bndng.ElementName        = "MainContentGrid";
            _bndng.ConverterParameter = "0.7142857-228.61272-86";
            _bndng.Converter          = new Converters.MessageboxWidthConverter();
            _txt2.SetBinding(TextBox.WidthProperty, _bndng);
            _txt2.HorizontalAlignment = HorizontalAlignment.Left;
            _txt2.Height = 22;
            _txt2.SetValue(Grid.RowProperty, 1);
            _txt2.TextWrapping      = TextWrapping.Wrap;
            _txt2.VerticalAlignment = VerticalAlignment.Center;
            _btn2.Content           = "Send";
            _btn2.IsDefault         = true;
            _btn2.Tag = nick + ":" + ip;
            _btn2.HorizontalAlignment = HorizontalAlignment.Right;
            _btn2.SetValue(Grid.RowProperty, 1);
            _btn2.VerticalAlignment = VerticalAlignment.Center;
            _btn2.Width             = 40;
            _btn2.Margin            = new Thickness(0, 2, 0, 0);
            _btn2.Click            += new RoutedEventHandler(SendMessageButtonClicked);
            _btn3.Content           = "CL";
            _btn3.Tag = nick + ":" + ip;
            _btn3.HorizontalAlignment = HorizontalAlignment.Right;
            _btn3.SetValue(Grid.RowProperty, 1);
            _btn3.VerticalAlignment = VerticalAlignment.Center;
            _btn3.Width             = 20;
            _btn3.Margin            = new Thickness(0, 2, 43, 0);
            _btn3.Click            += new RoutedEventHandler(CallButtonClicked);
            _btn4.Content           = "FL";
            _btn4.Tag = nick + ":" + ip;
            _btn4.HorizontalAlignment = HorizontalAlignment.Right;
            _btn4.SetValue(Grid.RowProperty, 1);
            _btn4.VerticalAlignment = VerticalAlignment.Center;
            _btn4.Width             = 20;
            _btn4.Margin            = new Thickness(0, 2, 66, 0);
            _btn4.Click            += new RoutedEventHandler(SendFileButtonClicked);

            _grd.Children.Add(_ltbox);
            _grd.Children.Add(_txt2);
            _grd.Children.Add(_btn2);
            _grd.Children.Add(_btn3);
            _grd.Children.Add(_btn4);

            _tab.Content = _grd;

            _tab.Tag = nick + ":" + ip;
            //Finally add it
            TabControl.Items.Add(_tab);

            //If it is the only tab change focus to it
            if (TabControl.Items.Count == 1)
            {
                TabControl.SelectedIndex = 0;
            }
        }
Exemple #34
0
        public void LoadDataSource(string ID, string IDCliente, string IDSessione)
        {
            id = int.Parse(ID.ToString());
            cBusinessObjects.idcliente  = int.Parse(IDCliente.ToString());
            cBusinessObjects.idsessione = int.Parse(IDSessione.ToString());

            dati = cBusinessObjects.GetData(id, typeof(Excel_Compensazioni));



            ArrayList Al = new ArrayList();

            foreach (DataRow dtrow in dati.Rows)
            {
                if (dtrow["periodo"] != null)
                {
                    if (!Al.Contains(dtrow["periodo"].ToString()))
                    {
                        Al.Add(dtrow["periodo"].ToString());
                    }
                }
            }



            if (Al.Count == 0)
            {
                Al.Add("Tributo XX");
            }

            foreach (string item in Al)
            {
                TabItem ti = new TabItem();
                ti.Header = item;

                tabControl.Items.Add(ti);
            }

            TabItem tiout = new TabItem();

            tiout.Header = App.NewTabHeaderText;

            tabControl.Items.Add(tiout);

            gtCompensazioni = new GenericTable(tblCompensazioni, _ReadOnly);

            gtCompensazioni.ColumnsAlias         = new string[] { "Data", "Tributi Compensati", "Importi" };
            gtCompensazioni.ColumnsValues        = new string[] { "name", "codice", "importoPagato" };
            gtCompensazioni.ColumnsWidth         = new double[] { 1.0, 3.0, 1.0 };
            gtCompensazioni.ColumnsMinWidth      = new double[] { 0.0, 0.0, 0.0 };
            gtCompensazioni.ColumnsTypes         = new string[] { "string", "string", "money" };
            gtCompensazioni.ColumnsAlignment     = new string[] { "right", "left", "right" };
            gtCompensazioni.ColumnsReadOnly      = new bool[] { false, false, false };
            gtCompensazioni.ConditionalReadonly  = new bool[] { false, false, false };
            gtCompensazioni.ConditionalAttribute = "new";
            gtCompensazioni.ColumnsHasTotal      = new bool[] { false, false, true };
            gtCompensazioni.AliasTotale          = "Credito residuo (Credito esistente - Tot. importi)";
            gtCompensazioni.xml  = false;
            gtCompensazioni.dati = dati;
            gtCompensazioni.ColumnAliasTotale = 1;

            gtCompensazioni.TotalHasBeenCalculated += GtCompensazioni_TotalHasBeenCalculated;
        }
Exemple #35
0
        private void ConnectToDB(SqlCommand command, Functions functions)
        {
            using (connection)
            {
                try
                {
                    connection.ConnectionString = connectionString;
                    connection.Open();

                    command.Connection = connection;

                    switch (functions)
                    {
                    case Functions.ReadTable:
                    {
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                for (int i = 0; i < reader.FieldCount; i++)
                                {
                                    table.Columns.Add(reader.GetName(i));
                                }

                                do
                                {
                                    while (reader.Read())
                                    {
                                        DataRow r = table.NewRow();
                                        for (int i = 0; i < reader.FieldCount; i++)
                                        {
                                            r[i] = reader[i];
                                        }
                                        table.Rows.Add(r);
                                    }
                                } while (reader.NextResult());
                            }
                        }
                    }
                    break;

                    case Functions.ReadDatabase:
                    {
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    DataGrid grid = new DataGrid();
                                    grid.Name = "grid";
                                    TabItem item = new TabItem();
                                    item.Header  = reader["name"];
                                    item.Content = grid;
                                    tabControl.Items.Add(item);
                                }
                            }
                        }
                    }
                    break;

                    case Functions.Delete:
                    {
                        command.ExecuteNonQuery();
                        DataRow[] rows = table.Select($"Id = {int.Parse(tb_id.Text)}");

                        if (rows.Length > 0)
                        {
                            rows[0].Delete();
                        }
                    }
                    break;
                    }
                }
                catch (SqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Exemple #36
0
 public WhatsInTheBox(int index, TabItem tabItem, StashControl stash)
 {
     this.Index   = index;
     this.TabItem = tabItem;
     this.Stash   = stash;
 }
        public void KeyboardTest()
        {
            using (var setup = new TestSetupHelper("TabView Tests"))
            {
                Log.Comment("Set focus inside the TabView");
                UIObject tabContent = FindElement.ByName("FirstTabContent");
                tabContent.SetFocus();

                TabItem firstTab  = FindElement.ByName <TabItem>("FirstTab");
                TabItem secondTab = FindElement.ByName <TabItem>("SecondTab");
                TabItem lastTab   = FindElement.ByName <TabItem>("LastTab");

                Button addButton = FindElement.ById <Button>("AddButton");

                Verify.IsTrue(firstTab.IsSelected, "First Tab should be selected initially");
                Button firstTabButton = FindElement.ByName <Button>("FirstTabButton");
                Verify.IsTrue(firstTabButton.HasKeyboardFocus, "Focus should start in the First Tab");

                // Ctrl+Tab to the second tab:
                KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control);
                Verify.IsTrue(secondTab.IsSelected, "Ctrl+Tab should move selection to Second Tab");
                Button secondTabButton = FindElement.ByName <Button>("SecondTabButton");
                Verify.IsTrue(secondTabButton.HasKeyboardFocus, "Focus should move to the content of the Second Tab");

                // Ctrl+Shift+Tab to the first tab:
                KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift);
                Verify.IsTrue(firstTab.IsSelected, "Ctrl+Shift+Tab should move selection to First Tab");
                Verify.IsTrue(firstTabButton.HasKeyboardFocus, "Focus should move to the content of the First Tab");

                // Ctrl+Shift+Tab to the last tab:
                KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control | ModifierKey.Shift);
                Verify.IsTrue(lastTab.IsSelected, "Ctrl+Shift+Tab should move selection to Last Tab");
                Verify.IsTrue(lastTab.HasKeyboardFocus, "Focus should move to the last tab (since it has no focusable content)");

                // Ctrl+Tab to the first tab:
                KeyboardHelper.PressKey(Key.Tab, ModifierKey.Control);
                Verify.IsTrue(firstTab.IsSelected, "Ctrl+Tab should move selection to First Tab");
                Verify.IsTrue(firstTab.HasKeyboardFocus, "Focus should move to the first tab");

                KeyboardHelper.PressKey(Key.Up);
                Verify.IsTrue(firstTab.HasKeyboardFocus, "Up key should not move focus");

                KeyboardHelper.PressKey(Key.Down);
                Verify.IsTrue(firstTab.HasKeyboardFocus, "Down key should not move focus");

                KeyboardHelper.PressKey(Key.Right);
                Verify.IsTrue(secondTab.HasKeyboardFocus, "Right Key should move focus to the second tab");

                KeyboardHelper.PressKey(Key.Left);
                Verify.IsTrue(firstTab.HasKeyboardFocus, "Left Key should move focus to the first tab");

                addButton.SetFocus();
                Verify.IsTrue(addButton.HasKeyboardFocus, "AddButton should have keyboard focus");

                KeyboardHelper.PressKey(Key.Left);
                Verify.IsTrue(lastTab.HasKeyboardFocus, "Left Key from AddButton should move focus to last tab");

                KeyboardHelper.PressKey(Key.Right);
                Verify.IsTrue(addButton.HasKeyboardFocus, "Right Key from Last Tab should move focus to Add Button");

                firstTab.SetFocus();

                // Ctrl+f4 to close the tab:
                Log.Comment("Verify that pressing ctrl-f4 closes the tab");
                KeyboardHelper.PressKey(Key.F4, ModifierKey.Control);
                Wait.ForIdle();

                VerifyElement.NotFound("FirstTab", FindBy.Name);

                // Move focus to the second tab content
                secondTabButton.SetFocus();
                Wait.ForIdle();
            }
        }
Exemple #38
0
        private void TabItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TabItem tab  = sender as TabItem;
            News    news = new News();

            var         listNews = news.getVNNew("https://vnexpress.net/" + tab.Tag.ToString());
            ItemNews_UC itemNews;

            foreach (var item in listNews)
            {
                itemNews = new ItemNews_UC();
                itemNews.newsTitle.Text   = item[0];
                itemNews.newsContent.Text = item[1];
                itemNews.Tag = item[2];

                switch (tab.Tag.ToString())
                {
                case "tin-tuc-24h":
                    stack_tinmoi.Children.Add(itemNews);
                    break;

                case "thoi-su":
                    stack_thoisu.Children.Add(itemNews);
                    break;

                case "the-gioi":
                    stack_thegioi.Children.Add(itemNews);
                    break;

                case "kinh-doanh":
                    stack_kinhdoanh.Children.Add(itemNews);
                    break;

                case "giai-tri":
                    stack_giaitri.Children.Add(itemNews);
                    break;

                case "the-thao":
                    stack_thethao.Children.Add(itemNews);
                    break;

                case "phap-luat":
                    stack_phapluat.Children.Add(itemNews);
                    break;

                case "giao-duc":
                    stack_giaoduc.Children.Add(itemNews);
                    break;

                case "doi-song":
                    stack_doisong.Children.Add(itemNews);
                    break;

                case "du-lich":
                    stack_dulich.Children.Add(itemNews);
                    break;

                case "khoa-hoc":
                    stack_khoahoc.Children.Add(itemNews);
                    break;

                case "so-hoa":
                    stack_sohoa.Children.Add(itemNews);
                    break;

                default:
                    break;
                }
            }
        }
Exemple #39
0
        public new virtual void Show()
        {
            IsOpen = true;
            OverlayStashTabList.Clear();

            foreach (StashTab i in MainWindow.stashTabsModel.StashTabs)
            {
                //i.PrepareOverlayList();
                //i.ActivateNextCell(true);
                TabItem   newStashTabItem;
                TextBlock tbk = new TextBlock()
                {
                    Text = i.TabName, Padding = new Thickness(22, 2, 22, 2)
                };
                //if (i.ItemOrderList.Count > 0)
                //{
                //    if (Properties.Settings.Default.ColorStash != "")
                //    {
                //        tbk.Background = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(Properties.Settings.Default.ColorStash));
                //    }
                //    else
                //    {
                //        tbk.Background = Brushes.Red;
                //    }
                //}

                //tbk.Background = i.TabHeaderColor;
                tbk.DataContext = i;
                tbk.SetBinding(TextBlock.BackgroundProperty, new System.Windows.Data.Binding("TabHeaderColor"));
                tbk.FontSize = 16;
                //if(i..Co > 0)
                //{
                //    if (Properties.Settings.Default.ColorStash != "")
                //    {
                //        i.TabHeaderColor = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(Properties.Settings.Default.ColorStash));
                //    }
                //    else
                //    {
                //        i.TabHeaderColor = Brushes.Red;
                //    }
                //}

                i.TabHeader = tbk;

                //TextBlockList.Add(tbk, i.TabIndex);

                //string name = i.TabName + "GridControl";
                if (i.Quad)
                {
                    newStashTabItem = new TabItem
                    {
                        Header  = tbk,
                        Content = new UserControls.DynamicGridControlQuad
                        {
                            ItemsSource = i.OverlayCellsList,
                        }
                    };
                }
                else
                {
                    newStashTabItem = new TabItem
                    {
                        Header  = tbk,
                        Content = new UserControls.DynamicGridControl
                        {
                            ItemsSource = i.OverlayCellsList
                        }
                    };
                }

                //TabItem newStashTabItem = new TabItem;
                //newStashTabItem.Header = i.TabName;
                ////newStashTabItem.DataContext = i.ItemList;
                //newStashTabItem.Content = i.TabNumber;
                OverlayStashTabList.Add(newStashTabItem);

                //Trace.WriteLine("works");


                //OverlayStashTabList.Add(i);
            }

            StashTabOverlayTabControl.SelectedIndex = 0;

            ChaosRecipeEnhancer.currentData.PrepareSelling();
            ChaosRecipeEnhancer.currentData.ActivateNextCell(true);

            MainWindow.overlay.OpenStashTabOverlay.Content = "Hide";

            MouseHook.Start();
            base.Show();

            //Test();
        }
Exemple #40
0
 private void AddTab(TabItem tabWrappedControl)
 {
     Tabs.Add(tabWrappedControl);
     RaisePropertyChanged(() => Tabs);
 }
Exemple #41
0
        public void DisplaySource(
            string sourceFilePath,
            string text,
            int lineNumber    = 0,
            int column        = 0,
            Action preprocess = null,
            NavigationHelper navigationHelper = null,
            bool displayPath = true)
        {
            var existing = Find(sourceFilePath);

            if (existing != null)
            {
                Visibility = Visibility.Visible;
                tabControl.SelectedItem = existing;
                var textViewer = existing.Content as TextViewerControl;
                if (textViewer != null)
                {
                    textViewer.SetPathDisplay(displayPath);

                    if (textViewer.Text != text)
                    {
                        textViewer.SetText(text);
                    }

                    textViewer.DisplaySource(lineNumber, column);
                }

                return;
            }

            var textViewerControl = new TextViewerControl();

            textViewerControl.DisplaySource(sourceFilePath, text, lineNumber, column, preprocess, navigationHelper);
            var tab = new SourceFileTab()
            {
                FilePath = sourceFilePath,
                Text     = text
            };
            var tabItem = new TabItem()
            {
                Tag     = tab,
                Content = textViewerControl
            };
            var header = new SourceFileTabHeader(tab);

            tabItem.Header         = header;
            header.CloseRequested += t =>
            {
                var tabItem = Tabs.FirstOrDefault(tabItem => tabItem.Tag == t);
                if (tabItem != null)
                {
                    Tabs.Remove(tabItem);
                }
            };
            tabItem.HeaderTemplate = (DataTemplate)Application.Current.Resources["SourceFileTabHeaderTemplate"];
            textViewerControl.SetPathDisplay(displayPath);

            Tabs.Add(tabItem);
            tabControl.SelectedItem = tabItem;
        }
Exemple #42
0
 public object GetInstance(TabItem tab)
 {
     return(this);
 }
Exemple #43
0
 public TabContent(int index, TabItem tabItem, StashControl stash)
 {
     this.Index   = index;
     this.TabItem = tabItem;
     this.Stash   = stash;
 }
Exemple #44
0
        private void AddParamsToPanel()
        {
            var pathParamPanel = new StackPanel();

            AddParamToPanel(config.ParamsManager.GetMainParam(), pathParamPanel);
            mainParamsPanel.Children.Add(pathParamPanel);
            Grid.SetRow(pathParamPanel, 0);

            var tabbedOptionsPanel = new System.Windows.Controls.TabControl
            {
                Margin = new Thickness(0, 5, 0, 5)
            };

            foreach (var group in config.ParamsManager.GetGroups())
            {
                var paramGroup = new TabItem()
                {
                    Header = group.Description
                };

                var groupParams = config.ParamsManager.GetParamsByGroup(group).Where(p => !string.IsNullOrWhiteSpace(p.WpfName));

                var stackPanel = new WrapPanel();

                foreach (var param in groupParams)
                {
                    var newPanel = new WrapPanel();
                    newPanel.Margin = new Thickness(2, 0, 2, 0);
                    AddParamToPanel(param, newPanel);
                    stackPanel.Children.Add(newPanel);
                }
                paramGroup.Content = stackPanel;
                tabbedOptionsPanel.Items.Add(paramGroup);
            }
            mainParamsPanel.Children.Add(tabbedOptionsPanel);
            Grid.SetRow(tabbedOptionsPanel, 1);

            runButton = new Button {
                Content = Language.Message("Run")
            };
            Language.Loaded += () => { runButton.Content = Language.Message("Run"); };
            runButton.Click += RunButtonOnClick;
            resetButton      = new Button {
                Content = "Restore Defaults"
            };
            resetButton.Click += ResetButtonOnClick;

            var buttonPanel    = new Grid();
            var colDefinition1 = new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            };
            var colDefinition2 = new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            };

            buttonPanel.ColumnDefinitions.Add(colDefinition1);
            buttonPanel.ColumnDefinitions.Add(colDefinition2);
            buttonPanel.Children.Add(runButton);
            Grid.SetColumn(runButton, 0);
            buttonPanel.Children.Add(resetButton);
            Grid.SetColumn(runButton, 1);
            Grid.SetRow(buttonPanel, 2);
            mainParamsPanel.Children.Add(buttonPanel);
        }
Exemple #45
0
        public void DeepCopy(StackPanel refSp)
        {
            TabControl tbc  = new TabControl();
            StackPanel sp   = new StackPanel();
            Grid       gNee = null;

            foreach (Grid refg in refSp.Children.OfType <Grid>())
            {
                if (refg.Name != "grdTit")
                {
                    gNee = DeepCopyNee(refg);
                }
            }
            Button btnDel = new Button();

            btnDel.Click  += btnDel_Click;
            btnDel.Width   = 120;
            btnDel.Height  = 40;
            btnDel.Margin  = new Thickness(0, 10, 0, 10);
            btnDel.Content = Txt.s._[(int)TxI.PREP_DEL];
            if (mSlDB.eStt == ExamStt.Prep)
            {
                btnDel.IsEnabled  = true;
                btnDel.Foreground = Theme.s._[(int)BrushId.FG];
                btnDel.Background = Theme.s._[(int)BrushId.Button_Hover];
            }
            else
            {
                btnDel.IsEnabled  = false;
                btnDel.Foreground = Theme.s._[(int)BrushId.FG_Gray];
                btnDel.Background = Theme.s._[(int)BrushId.BG_Gray];
            }
            sp.Children.Add(btnDel);
            sp.Children.Add(gNee);
            grdDB = DeepCopyNee(gNee);
            grdDB.Children.Clear();
            ScrollViewer vwr = null;

            foreach (ScrollViewer refscrvwr in refSp.Children.OfType <ScrollViewer>())
            {
                vwr = DeepCopy(refscrvwr);
            }
            vwr.Content = grdDB;
            sp.Children.Add(vwr);
            tbiDB = new TabItem();
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(Txt.s._[(int)TxI.NEE_LS_DB], 0);
            tbiDB.Header  = sb.ToString();
            tbiDB.Content = sp;
            tbc.Items.Add(tbiDB);
            //
            sp = new StackPanel();
            Grid gTit = null;

            foreach (Grid refg in refSp.Children.OfType <Grid>())
            {
                if (refg.Name == "grdTit")
                {
                    gTit = DeepCopyTit(refg);
                }
                else
                {
                    gNee = DeepCopyNee(refg);
                }
            }
            sp.Children.Add(gTit);
            sp.Children.Add(gNee);
            grdTmp = DeepCopyNee(gNee);
            grdTmp.Children.Clear();
            foreach (ScrollViewer refscrvwr in refSp.Children.OfType <ScrollViewer>())
            {
                vwr = DeepCopy(refscrvwr);
            }
            vwr.Content = grdTmp;
            sp.Children.Add(vwr);
            tbiTmp = new TabItem();
            sb.Clear();
            sb.AppendFormat(Txt.s._[(int)TxI.NEE_LS_TMP], 0);
            tbiTmp.Header  = sb.ToString();;
            tbiTmp.Content = sp;
            tbc.Items.Add(tbiTmp);
            //
            Content = tbc;
        }
        public void Load(string FileName)
        {
            try
            {
                XmlDocument Xml = new XmlDocument();
                Xml.Load(FileName);

                switch (Xml.DocumentElement.LocalName)
                {
                case "ClientConnections":
                    this.connections.Load(FileName, Xml);
                    this.FileName = FileName;

                    this.ConnectionTree.Items.Clear();
                    foreach (TreeNode Node in this.connections.RootNodes)
                    {
                        this.AddNode(Node);
                    }
                    break;

                case "Sniff":
                    TabItem TabItem = MainWindow.NewTab(Path.GetFileName(FileName));
                    this.MainWindow.Tabs.Items.Add(TabItem);

                    SnifferView SnifferView = new SnifferView(null);
                    TabItem.Content = SnifferView;

                    SnifferView.Sniffer = new TabSniffer(TabItem, SnifferView);

                    this.MainWindow.Tabs.SelectedItem = TabItem;

                    SnifferView.Load(Xml, FileName);
                    break;

                case "Chat":
                    TabItem = MainWindow.NewTab(Path.GetFileName(FileName));
                    this.MainWindow.Tabs.Items.Add(TabItem);

                    ChatView ChatView = new ChatView(null);
                    ChatView.Input.IsEnabled      = false;
                    ChatView.SendButton.IsEnabled = false;

                    TabItem.Content = ChatView;

                    this.MainWindow.Tabs.SelectedItem = TabItem;

                    ChatView.Load(Xml, FileName);
                    break;

                case "SensorData":
                    TabItem = MainWindow.NewTab(Path.GetFileName(FileName));
                    this.MainWindow.Tabs.Items.Add(TabItem);

                    SensorDataView SensorDataView = new SensorDataView(null, null, false);
                    TabItem.Content = SensorDataView;

                    this.MainWindow.Tabs.SelectedItem = TabItem;

                    SensorDataView.Load(Xml, FileName);
                    break;

                case "SearchResult":
                    TabItem = MainWindow.NewTab(Path.GetFileName(FileName));
                    this.MainWindow.Tabs.Items.Add(TabItem);

                    SearchResultView SearchResultView = new SearchResultView();
                    TabItem.Content = SearchResultView;

                    this.MainWindow.Tabs.SelectedItem = TabItem;

                    SearchResultView.Load(Xml, FileName);
                    break;

                case "Script":
                    TabItem = MainWindow.NewTab(Path.GetFileName(FileName));
                    this.MainWindow.Tabs.Items.Add(TabItem);

                    ScriptView ScriptView = new ScriptView();
                    TabItem.Content = ScriptView;

                    this.MainWindow.Tabs.SelectedItem = TabItem;

                    ScriptView.Load(Xml, FileName);
                    break;

                case "EventOutput":
                    TabItem = MainWindow.NewTab(Path.GetFileName(FileName));
                    this.MainWindow.Tabs.Items.Add(TabItem);

                    LogView LogView = new LogView(false);
                    TabItem.Content = LogView;

                    this.MainWindow.Tabs.SelectedItem = TabItem;

                    LogView.Load(Xml, FileName);
                    break;

                default:
                    throw new Exception("Unrecognized file format.");
                }
            }
            catch (Exception ex)
            {
                ex = Log.UnnestException(ex);
                MessageBox.Show(ex.Message, ex.Message, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #47
0
        /// <summary>
        /// Removes the tab linked to the given sprite sheet.
        /// </summary>
        private void RemoveSpriteSheetTab(SpriteSheet removedSpriteSheet)
        {
            TabItem tab = GetSpriteSheetTab(removedSpriteSheet);

            SpritesheetsList.Items.Remove(tab);
        }
Exemple #48
0
 public frmXepLop(DevComponents.DotNetBar.TabControl _tabControl, TabItem _tab)
 {
     InitializeComponent();
     tabControl = _tabControl;
     tab        = _tab;
 }
Exemple #49
0
        /// <summary>
        /// Tab页选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tcPersonalRd_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl tc = sender as TabControl;

            if (tc == null)
            {
                return;
            }
            if (this.Pager != null)
            {
                this.Pager.PageCount = 0;
                this.Pager.PageIndex = 1;
            }
            string strHeaderText = ((TabItem)tc.SelectedItem).Header.ToString();

            foreach (object obj in tc.Items)
            {
                TabItem tiCurr = obj as TabItem;
                if (tiCurr.Header.ToString() != strHeaderText)
                {
                    tiCurr.Tag = "close";
                }
                else
                {
                    tiCurr.Tag = "open";
                }
            }

            switch (strHeaderText)
            {
            //case "未提交":
            //    strCheckState = Convert.ToInt32(SMT.SaaS.FrameworkUI.CheckStates.UnSubmit).ToString();
            //    strIsForward = "0";     //"0"表示非转发单据,"1"表示转发单据
            //    BindGrid(1);//第一次分页索引是1
            //    break;
            case "审核中":
                strCheckState = Convert.ToInt32(SMT.SaaS.FrameworkUI.CheckStates.Approving).ToString();
                strIsForward  = "0";        //"0"表示非转发单据,"1"表示转发单据
                //strCreateDateFrom = DateTime.Now.AddDays(-30).ToString();
                //strCreateDateTo = DateTime.Now.ToString();
                InitGrid(1);
                break;

            case "审核通过":
                strCheckState = Convert.ToInt32(SMT.SaaS.FrameworkUI.CheckStates.Approved).ToString();
                strIsForward  = "0";        //"0"表示非转发单据,"1"表示转发单据
                InitGrid(1);
                break;

            case "审核未通过":
                strCheckState = Convert.ToInt32(SMT.SaaS.FrameworkUI.CheckStates.UnApproved).ToString();
                strIsForward  = "0";        //"0"表示非转发单据,"1"表示转发单据
                InitGrid(1);
                break;

            case "转发":
                strCheckState = Convert.ToInt32(SMT.SaaS.FrameworkUI.CheckStates.Approved).ToString();
                strIsForward  = "1";        //"0"表示非转发单据,"1"表示转发单据
                BindGrid(1);
                break;

            default:
                strCheckState = Convert.ToInt32(SMT.SaaS.FrameworkUI.CheckStates.Approving).ToString();
                strIsForward  = "0";        //"0"表示非转发单据,"1"表示转发单据
                BindGrid(1);
                break;
            }
        }
Exemple #50
0
        private void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string head = "";

            if (e.RemovedItems.Count > 0)
            {
                head = ((TabItem)tabControl.Items[CurrentTabSelectedIndex]).Header.ToString();
                foreach (DataRow dtrow in dati.Rows)
                {
                    if (dtrow["periodo"].ToString() == head)
                    {
                        dtrow["txtCreditoEsistente"] = txtCreditoEsistente.Text;
                    }
                }
            }



            if (e.AddedItems.Count > 0 && (e.AddedItems[0]).GetType().Name == "TabItem")
            {
                if (((string)(((TabItem)(e.AddedItems[0])).Header)) == App.NewTabHeaderText)
                {
                    if (_ReadOnly)
                    {
                        MessageBox.Show(App.MessaggioSolaScrittura, "Attenzione");
                        return;
                    }

                    var dialog = new wInputBox("Inserire Nome del nuovo tributo");
                    dialog.ShowDialog();

                    string newHeader = dialog.ResponseText;

                    if (newHeader == "")
                    {
                        MessageBox.Show("Attenzione, tributo non valido");
                        tabControl.SelectedIndex = 0;
                        return;
                    }

                    foreach (TabItem item in tabControl.Items)
                    {
                        if (((string)(item.Header)) == newHeader)
                        {
                            MessageBox.Show("Attenzione, tributo già esistente");
                            tabControl.SelectedIndex = 0;
                            return;
                        }
                    }

                    TabItem ti = new TabItem();
                    ti.Header = newHeader;


                    tabControl.Items.Insert(tabControl.Items.Count - 1, ti);
                    tabControl.SelectedIndex = tabControl.Items.Count - 2;

                    gtCompensazioni.filtercolumn = "periodo";
                    gtCompensazioni.filtervalue  = newHeader;
                    gtCompensazioni.GenerateTable();
                }
                else
                {
                    head = ((string)(((TabItem)(e.AddedItems[0])).Header));
                    foreach (DataRow dtrow in dati.Rows)
                    {
                        if (dtrow["periodo"].ToString() == head)
                        {
                            txtCreditoEsistente.Text = dtrow["txtCreditoEsistente"].ToString();
                        }
                    }
                    gtCompensazioni.filtercolumn = "periodo";
                    gtCompensazioni.filtervalue  = ((string)(((TabItem)(e.AddedItems[0])).Header));
                    gtCompensazioni.GenerateTable();
                }
            }
            CurrentTabSelectedIndex = tabControl.SelectedIndex;
        }
Exemple #51
0
        private static TabItem AnimationsTab()
        {
            Border          border1;
            Border          border2;
            RotateTransform rotate;
            Button          button1;

            var result = new TabItem
            {
                Header  = "Animations",
                Content = new StackPanel
                {
                    Orientation = Orientation.Vertical,
                    Gap         = 4,
                    Margin      = new Thickness(10),
                    Children    = new Controls
                    {
                        new TextBlock
                        {
                            Text       = "Animations",
                            FontWeight = FontWeight.Medium,
                            FontSize   = 20,
                            Foreground = SolidColorBrush.Parse("#212121"),
                        },
                        new TextBlock
                        {
                            Text       = "A few animations showcased below",
                            FontSize   = 13,
                            Foreground = SolidColorBrush.Parse("#727272"),
                            Margin     = new Thickness(0, 0, 0, 10)
                        },
                        (button1 = new Button
                        {
                            Content = "Animate",
                            Width = 120,
                            [Grid.ColumnProperty] = 1,
                            [Grid.RowProperty] = 1,
                        }),
                        new Canvas
                        {
                            ClipToBounds = false,
                            Children     = new Controls
                            {
                                (border1 = new Border
                                {
                                    Width = 100,
                                    Height = 100,
                                    HorizontalAlignment = HorizontalAlignment.Center,
                                    VerticalAlignment = VerticalAlignment.Center,
                                    Background = Brushes.Crimson,
                                    RenderTransform = new RotateTransform(),
                                    Child = new Grid
                                    {
                                        Children = new Controls
                                        {
                                            new Ellipse()
                                            {
                                                Width = 100,
                                                Height = 100,
                                                Fill =
                                                    new RadialGradientBrush()
                                                {
                                                    GradientStops =
                                                    {
                                                        new GradientStop(Colors.Blue,  0),
                                                        new GradientStop(Colors.Green, 1)
                                                    },
                                                    Radius = 75
                                                }
                                            },
                                            new Perspex.Controls.Shapes.Path
                                            {
                                                Data =
                                                    StreamGeometry.Parse(
                                                        "F1 M 16.6309,18.6563C 17.1309,8.15625 29.8809,14.1563 29.8809,14.1563C 30.8809,11.1563 34.1308,11.4063 34.1308,11.4063C 33.5,12 34.6309,13.1563 34.6309,13.1563C 32.1309,13.1562 31.1309,14.9062 31.1309,14.9062C 41.1309,23.9062 32.6309,27.9063 32.6309,27.9062C 24.6309,24.9063 21.1309,22.1562 16.6309,18.6563 Z M 16.6309,19.9063C 21.6309,24.1563 25.1309,26.1562 31.6309,28.6562C 31.6309,28.6562 26.3809,39.1562 18.3809,36.1563C 18.3809,36.1563 18,38 16.3809,36.9063C 15,36 16.3809,34.9063 16.3809,34.9063C 16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z"),
                                                Fill =
                                                    new LinearGradientBrush()
                                                {
                                                    GradientStops =
                                                    {
                                                        new GradientStop(Colors.Green,         0),
                                                        new GradientStop(Colors.LightSeaGreen, 1)
                                                    }
                                                },
                                                HorizontalAlignment = HorizontalAlignment.Center,
                                                VerticalAlignment = VerticalAlignment.Center,
                                                RenderTransform = new MatrixTransform(Matrix.CreateScale(2, 2))
                                            }
                                        }
                                    },
                                    [Canvas.LeftProperty] = 100,
                                    [Canvas.TopProperty] = 100,
                                }),
                                (border2 = new Border
                                {
                                    Width = 100,
                                    Height = 100,
                                    HorizontalAlignment = HorizontalAlignment.Center,
                                    VerticalAlignment = VerticalAlignment.Center,
                                    Background = Brushes.Coral,
                                    Child = new Image
                                    {
                                        Source = new Bitmap(GetImage("github_icon.png")),
                                        HorizontalAlignment = HorizontalAlignment.Center,
                                        VerticalAlignment = VerticalAlignment.Center,
                                    },
                                    RenderTransform = (rotate = new RotateTransform
                                    {
                                        PropertyTransitions = new PropertyTransitions
                                        {
                                            RotateTransform.AngleProperty.Transition(500),
                                        }
                                    }),
                                    PropertyTransitions = new PropertyTransitions
                                    {
                                        Layoutable.WidthProperty.Transition(300),
                                        Layoutable.HeightProperty.Transition(1000),
                                    },
                                    [Canvas.LeftProperty] = 400,
                                    [Canvas.TopProperty] = 100,
                                }),
                            }
                        }
                    },
                },
            };

            button1.Click += (s, e) =>
            {
                if (border2.Width == 100)
                {
                    border2.Width = border2.Height = 400;
                    rotate.Angle  = 180;
                }
                else
                {
                    border2.Width = border2.Height = 100;
                    rotate.Angle  = 0;
                }
            };

            var start   = Animate.Stopwatch.Elapsed;
            var degrees = Animate.Timer
                          .Select(x =>
            {
                var elapsed  = (x - start).TotalSeconds;
                var cycles   = elapsed / 4;
                var progress = cycles % 1;
                return(360.0 * progress);
            });

            border1.RenderTransform.Bind(
                RotateTransform.AngleProperty,
                degrees,
                BindingPriority.Animation);

            return(result);
        }
Exemple #52
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            controllerUpdater = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 0, 0, 10)
            };
            controllerUpdater.Tick += Link;
            controllerUpdater.Start();

            new Thread(() =>
            {
                XmlRpcUtil.ShowOutputFromXmlRpcPInvoke();

                // ROS stuff
                ROS.Init(new string[0], "The_UI_" + System.Environment.MachineName.Replace("-", "__"));
                nh = new NodeHandle();
                Dispatcher.Invoke(new Action(() =>
                {
                    battvolt.startListening(nh);
                    EStop.startListening(nh);
                    MotorGraph.startListening(nh);
                    rosout_control.startListening(nh);
                    spinningstuff.startListening(nh, "/imu/data");
                }));
                velPub       = nh.advertise <gm.Twist>("/cmd_vel", 1);
                multiplexPub = nh.advertise <m.Byte>("/cam_select", 1);
                armPub       = nh.advertise <am.ArmMovement>("/arm/movement", 1);
                ArmON        = nh.advertise <m.Bool>("arm/on", 1);
                mast_pub     = nh.advertise <m.Bool>("raise_camera_mast", 1);

                tilt_pub = new Publisher <m.Int32> [4];

                for (int i = 0; i < 4; i++)
                {
                    tilt_pub[i] = nh.advertise <m.Int32>("camera" + i + "/tilt", 1);
                }

                Dispatcher.Invoke(new Action(() =>
                {
                    mainCameras = new TabItem[] { MainCamera1, MainCamera2, MainCamera3, MainCamera4 };
                    subCameras  = new TabItem[] { SubCamera1, SubCamera2, SubCamera3, SubCamera4 };
                    mainImages  = new ROS_ImageWPF.CompressedImageControl[] { camImage0, camImage1, camImage2, camImage3 };
                    subImages   = new ROS_ImageWPF.SlaveImage[] { camImageSlave0, camImageSlave1, camImageSlave2, camImageSlave3 };
                    for (int i = 0; i < mainCameras.Length; i++)
                    {
                        mainImages[i].AddSlave(subImages[i]);
                    }
                    subCameras[1].Focus();
                    adr(false);

                    // instantiating some global helpers

                    /*detectors = new DetectionHelper[4];
                     * for (int i = 0; i < 4; ++i)
                     * {
                     *  detectors[i] = new DetectionHelper(nh, i, this);
                     * }*/
                }));

#if !INSTANT_DETECTION_DEATH
                while (ROS.ok)
                {
                    Dispatcher.Invoke(new Action(() =>
                    {
                        for (int i = 0; i < 4; ++i)
                        {
                            detectors[i].churnAndBurn();
                        }
                    }));
                    Thread.Sleep(100);
                }
#endif
            }).Start();
        }
Exemple #53
0
        private static TabItem ButtonsTab()
        {
            var result = new TabItem
            {
                Header  = "Button",
                Content = new ScrollViewer()
                {
                    CanScrollHorizontally = false,
                    Content = new StackPanel
                    {
                        Margin      = new Thickness(10),
                        Orientation = Orientation.Vertical,
                        Gap         = 4,
                        Children    = new Controls
                        {
                            new TextBlock
                            {
                                Text       = "Button",
                                FontWeight = FontWeight.Medium,
                                FontSize   = 20,
                                Foreground = SolidColorBrush.Parse("#212121"),
                            },
                            new TextBlock
                            {
                                Text       = "A button control",
                                FontSize   = 13,
                                Foreground = SolidColorBrush.Parse("#727272"),
                                Margin     = new Thickness(0, 0, 0, 10)
                            },
                            new Button
                            {
                                Width   = 150,
                                Content = "Button"
                            },
                            new Button
                            {
                                Width     = 150,
                                Content   = "Disabled",
                                IsEnabled = false,
                            },
                            new TextBlock
                            {
                                Margin     = new Thickness(0, 40, 0, 0),
                                Text       = "ToggleButton",
                                FontWeight = FontWeight.Medium,
                                FontSize   = 20,
                                Foreground = SolidColorBrush.Parse("#212121"),
                            },
                            new TextBlock
                            {
                                Text       = "A toggle button control",
                                FontSize   = 13,
                                Foreground = SolidColorBrush.Parse("#727272"),
                                Margin     = new Thickness(0, 0, 0, 10)
                            },
                            new ToggleButton
                            {
                                Width     = 150,
                                IsChecked = true,
                                Content   = "On"
                            },
                            new ToggleButton
                            {
                                Width     = 150,
                                IsChecked = false,
                                Content   = "Off"
                            },
                        }
                    }
                },
            };


            return(result);
        }
        private void AddTab(string tabHeading = null, DockPanel mainContent = null)
        {
            try
            {
                Random rnd      = new Random();
                int    rndvalue = rnd.Next(1000, 9000);



                /////////////////// START : TAB HEADER ///////////////////
                Label lblHeaderLabel = new Label();


                lblHeaderLabel.Content = (tabHeading == null) ? string.Format("Tab {0}", rndvalue) : tabHeading;
                lblHeaderLabel.Name    = string.Format("lblTab{0}", rndvalue);
                lblHeaderLabel.Style   = Resources["styleLblTabHeader"] as Style;

                Label lblHeaderTabClose = new Label();
                lblHeaderTabClose.Content  = " x ";
                lblHeaderTabClose.Name     = string.Format("btnTab{0}", rndvalue);
                lblHeaderTabClose.Style    = Resources["styleBtnTabHeader"] as Style;
                lblHeaderTabClose.MouseUp += tabHeader_BubbledClickEvent;
                lblHeaderTabClose.Tag      = string.Format("tab{0}", rndvalue); // will help to close the corresponding tab


                StackPanel headerStackPanel = new StackPanel();
                headerStackPanel.Orientation = Orientation.Horizontal;
                headerStackPanel.Children.Add(lblHeaderLabel);
                headerStackPanel.Children.Add(lblHeaderTabClose);
                headerStackPanel.Name     = string.Format("spHeadTab{0}", rndvalue);
                headerStackPanel.MouseUp += tabHeader_BubbledClickEvent;

                /////////////////// END : TAB HEADER ///////////////////

                TabItem tab = new TabItem();

                tab.Header              = headerStackPanel;
                tab.Name                = string.Format("tab{0}", rndvalue);
                tab.MouseUp            += tabHeader_BubbledClickEvent;
                tab.Content             = mainContent;
                tab.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                tab.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;

                tbcPrimary.Items.Add(tab);

                // Select current Tab
                int newIndex = tbcPrimary.Items.Count;
                if (newIndex >= tbcPrimary.Items.Count)
                {
                    --newIndex;
                }
                if (newIndex < 0)
                {
                    newIndex = 0;
                }
                tbcPrimary.SelectedIndex = newIndex;
            }

            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageHandler.ShowErrorMessage(ex.Message);
            }

            catch (ValidationException ex)
            {
                MessageHandler.ShowErrorMessage(ex.Message);
            }
            catch (ConnectedDalException ex)
            {
                MessageHandler.ShowErrorMessage(ex.Message);
            }
            catch (Exception ex)
            {
                MessageHandler.ShowErrorMessage(ex.Message);
            }
        }
        void PopulateSettingsDock(IEnumerable <UISetting> settings, DockPanel dock)
        {
            void Dispatch(Action action)
            {
                if (Thread.CurrentThread.ManagedThreadId == Dispatcher.Thread.ManagedThreadId)
                {
                    action();
                }
                else
                {
                    Dispatcher.InvokeAsync(action).Task.GetAwaiter().GetResult();
                }
            }

            dock.LastChildFill = false;
            foreach (var sett in settings)
            {
                if (sett is UILabel)
                {
                    var s     = sett as UILabel;
                    var label = new Label()
                    {
                        Content = s.Text, FontSize = s.FontSize, Margin = new Thickness(0, 0, 0, s.Padding)
                    };
                    DockPanel.SetDock(label, Dock.Top);

                    dock.Children.Add(label);
                }
                if (sett is UINumber)
                {
                    var s      = sett as UINumber;
                    var number = new NumberSelect()
                    {
                        Minimum = (decimal)s.Minimum, Maximum = (decimal)s.Maximum, DecimalPoints = s.DecialPoints, Step = (decimal)s.Step, Value = (decimal)s.Value
                    };
                    number.MinWidth = 100;
                    var label = new Label()
                    {
                        Content = s.Text, FontSize = 16
                    };
                    var d = new DockPanel()
                    {
                        HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, s.Padding)
                    };
                    if (!(s.Text == null || s.Text == ""))
                    {
                        number.Margin = new Thickness(5, 0, 0, 1);
                        d.Children.Add(label);
                    }
                    d.Children.Add(number);
                    DockPanel.SetDock(d, Dock.Top);
                    number.ValueChanged += (_, e) => { s.Value = (double)e.NewValue; };
                    dock.Children.Add(d);

                    s.EnableToggled += (enable) =>
                    {
                        Dispatch(() => number.IsEnabled = enable);
                    };
                }
                if (sett is UINumberSlider)
                {
                    var    s   = sett as UINumberSlider;
                    double min = s.Minimum;
                    double max = s.Maximum;
                    if (s.Logarithmic)
                    {
                        min = Math.Log(min, 2);
                        max = Math.Log(max, 2);
                    }
                    var number = new ValueSlider()
                    {
                        Minimum = min, Maximum = max, TrueMin = (decimal)s.TrueMinimum, TrueMax = (decimal)s.TrueMaximum, DecimalPoints = s.DecialPoints
                    };
                    if (s.Logarithmic)
                    {
                        number.nudToSlider = v => Math.Log(v, 2);
                        number.sliderToNud = v => Math.Pow(2, v);
                    }
                    number.Value    = s.Value;
                    number.MinWidth = 400;
                    var label = new Label()
                    {
                        Content = s.Text, FontSize = 16
                    };
                    var d = new DockPanel()
                    {
                        HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, s.Padding)
                    };
                    if (!(s.Text == null || s.Text == ""))
                    {
                        number.Margin = new Thickness(5, 0, 0, 1);
                        d.Children.Add(label);
                    }
                    d.Children.Add(number);
                    DockPanel.SetDock(d, Dock.Top);
                    number.ValueChanged += (_, e) => { s.Value = e.NewValue; };
                    dock.Children.Add(d);

                    s.EnableToggled += (enable) =>
                    {
                        Dispatch(() => number.IsEnabled = enable);
                    };
                }
                if (sett is UIDropdown)
                {
                    var s    = sett as UIDropdown;
                    var drop = new ComboBox()
                    {
                        FontSize = 16
                    };
                    var label = new Label()
                    {
                        Content = s.Text, FontSize = 16
                    };
                    foreach (var o in s.Options)
                    {
                        drop.Items.Add(new ComboBoxItem()
                        {
                            Content = o, FontSize = 16
                        });
                    }
                    var d = new DockPanel()
                    {
                        HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, s.Padding)
                    };
                    if (!(s.Text == null || s.Text == ""))
                    {
                        drop.Margin = new Thickness(5, 0, 0, 0);
                        d.Children.Add(label);
                    }
                    d.Children.Add(drop);
                    DockPanel.SetDock(d, Dock.Top);
                    drop.SelectionChanged += (_, e) =>
                    {
                        var combo = (ComboBox)e.Source;
                        s.Index = combo.SelectedIndex;
                        s.Value = s.Options[combo.SelectedIndex];
                    };
                    drop.SelectedIndex = s.Index;
                    dock.Children.Add(d);

                    s.EnableToggled += (enable) =>
                    {
                        Dispatch(() => drop.IsEnabled = enable);
                    };
                }
                if (sett is UICheckbox)
                {
                    var s     = sett as UICheckbox;
                    var check = new BetterCheckbox()
                    {
                        FontSize = 16, Text = s.Text
                    };
                    DockPanel.SetDock(check, Dock.Top);
                    check.CheckToggled += (_, e) =>
                    {
                        s.Checked = e.NewValue;
                    };
                    check.Margin    = new Thickness(0, 0, 0, s.Padding);
                    check.IsChecked = s.Checked;
                    dock.Children.Add(check);

                    s.EnableToggled += (enable) =>
                    {
                        Dispatch(() => check.IsEnabled = enable);
                    };
                }
                if (sett is UITabs)
                {
                    var s    = sett as UITabs;
                    var tabs = new TabControl();
                    foreach (var k in s.Tabs.Keys)
                    {
                        var item = new TabItem()
                        {
                            Header = k
                        };
                        var d = new DockPanel()
                        {
                            Margin = new Thickness(10)
                        };
                        d.LastChildFill = false;
                        var c = new Grid();
                        c.Children.Add(d);
                        item.Content = c;
                        PopulateSettingsDock(s.Tabs[k], d);
                        tabs.Items.Add(item);
                    }
                    dock.Children.Add(tabs);
                    dock.LastChildFill = true;
                    break;
                }
            }
        }
Exemple #56
0
    public async void OpenCustomPauseMenu()
    {
        TabView MenuContainer = new TabView("This is the title", "Subtitle");

        MenuContainer.SideStringTop    = "Player_Name";
        MenuContainer.SideStringMiddle = "Middle_String";
        MenuContainer.SideStringBottom = "Bottom_string";
        MenuContainer.DisplayHeader    = true;
        _menuPool.AddPauseMenu(MenuContainer);


        TabItem Item1 = new TabItem("simple TabItem");

        TabTextItem Item2 = new TabTextItem("TabTextItem", "This is the Title inside", "With a cool text to be added where you can write whatever you want");

        TabItemSimpleList Item3 = new TabItemSimpleList("TabItemSimpleList", new Dictionary <string, string>()
        {
            ["Item 1"] = "subItem 1",
            ["Item 2"] = "subItem 2",
            ["Item 3"] = "subItem 3",
            ["Item 4"] = "subItem 4",
            ["Item 5"] = "subItem 5",
            ["Item 6"] = "subItem 6"
        });


        List <UIMenuItem> items = new List <UIMenuItem>()
        {
            new UIMenuItem("Item 1"),
            new UIMenuCheckboxItem("Item 2", true),
            new UIMenuListItem("Item 3", new List <dynamic>()
            {
                "Item1", 2, 3.0999
            }, 0),
            new UIMenuSliderItem("Item 4", "", true),
            new UIMenuSliderProgressItem("Item 5", 20, 0),
        };

        TabInteractiveListItem    Item4 = new TabInteractiveListItem("TabInteractiveListItem", items);
        List <MissionInformation> info  = new List <MissionInformation>()
        {
            new MissionInformation("Mission 1", new List <Tuple <string, string> >()
            {
                new Tuple <string, string>("item 1", "description 1"),
                new Tuple <string, string>("item 2", "description 2"),
                new Tuple <string, string>("item 3", "description 3"),
                new Tuple <string, string>("item 4", "description 4"),
                new Tuple <string, string>("item 5", "description 5"),
            }),
            new MissionInformation("Mission 2", new List <Tuple <string, string> >()
            {
                new Tuple <string, string>("item 1", "description 1"),
                new Tuple <string, string>("item 2", "description 2"),
                new Tuple <string, string>("item 3", "description 3"),
                new Tuple <string, string>("item 4", "description 4"),
                new Tuple <string, string>("item 5", "description 5"),
            }),
        };
        TabSubmenuItem Item5 = new TabSubmenuItem("TabSubmenuItem", new List <TabItem>()
        {
            new TabItem("simple TabItem"),
            new TabTextItem("TabTextItem", "This is the Title inside", "With a cool text to be added where you can write whatever you want"),
            new TabItemSimpleList("TabItemSimpleList", new Dictionary <string, string>()
            {
                ["Item 1"] = "subItem 1",
                ["Item 2"] = "subItem 2",
                ["Item 3"] = "subItem 3",
                ["Item 4"] = "subItem 4",
                ["Item 5"] = "subItem 5",
                ["Item 6"] = "subItem 6"
            }),
            new TabMissionSelectItem("Mission tab", info),
            new TabInteractiveListItem("TabInteractiveListItem", items)
        });
        TabMissionSelectItem Item6 = new TabMissionSelectItem("Mission tab", info);

        MenuContainer.AddTab(Item1);
        MenuContainer.AddTab(Item2);
        MenuContainer.AddTab(Item3);
        MenuContainer.AddTab(Item4);
        MenuContainer.AddTab(Item5);
        MenuContainer.AddTab(Item6);
        // this way we can choose which tab is the defualt one
        Item1.Active          = true;
        Item1.Focused         = true;
        Item1.Visible         = true;
        MenuContainer.Visible = true;
        // items have events exactly the same as UIMenuItems and you can handle TabInteractiveListItem items just like that
    }
        private bool SaveItemData(TabItem tab)
        {
            // Clear old errors
            ErrorLog.Document.Blocks.Clear();

            if (!HasChanged)
            {
                // Nothing to update
                return(false);
            }

            #region SaveLoad
            try
            {
                // For these we amend the 0x3F area which requires save/load
                if (Equals(tab, Weapons) || Equals(tab, Bows) || Equals(tab, Shields) ||
                    Equals(tab, Armor))
                {
                    var weaponList = items.Where(x => x.Page == 0).ToList();
                    var bowList    = items.Where(x => x.Page == 1).ToList();
                    var arrowList  = items.Where(x => x.Page == 2).ToList();
                    var shieldList = items.Where(x => x.Page == 3).ToList();
                    var armorList  = items.Where(x => x.Page == 4 || x.Page == 5 || x.Page == 6).ToList();

                    var y = 0;
                    if (Equals(tab, Weapons))
                    {
                        foreach (var item in weaponList)
                        {
                            var foundTextBox = (TextBox)FindName("Value_" + item.ValueAddressHex);
                            if (foundTextBox != null)
                            {
                                var offset = (uint)(SaveItemStart + (y * 0x8));
                                gecko.WriteUInt(offset, Convert.ToUInt32(foundTextBox.Text));
                            }

                            y++;
                        }
                    }

                    if (Equals(tab, Bows))
                    {
                        // jump past weapons before we start
                        y += weaponList.Count;

                        foreach (var item in bowList)
                        {
                            var foundTextBox = (TextBox)FindName("Value_" + item.ValueAddressHex);
                            if (foundTextBox != null)
                            {
                                var offset = (uint)(SaveItemStart + (y * 0x8));

                                gecko.WriteUInt(offset, Convert.ToUInt32(foundTextBox.Text));
                            }

                            y++;
                        }
                    }

                    if (Equals(tab, Shields))
                    {
                        // jump past weapons/bows/arrows before we start
                        y += weaponList.Count + bowList.Count + arrowList.Count;

                        foreach (var item in shieldList)
                        {
                            var foundTextBox = (TextBox)FindName("Value_" + item.ValueAddressHex);
                            if (foundTextBox != null)
                            {
                                var offset = (uint)(SaveItemStart + (y * 0x8));

                                gecko.WriteUInt(offset, Convert.ToUInt32(foundTextBox.Text));
                            }

                            y++;
                        }
                    }

                    if (Equals(tab, Armor))
                    {
                        // jump past weapons/bows/arrows/shields before we start
                        y += weaponList.Count + bowList.Count + arrowList.Count + shieldList.Count;

                        foreach (var item in armorList)
                        {
                            var offset = (uint)(SaveItemStart + (y * 0x8));

                            var foundTextBox = (TextBox)FindName("Value_" + item.ValueAddressHex);
                            if (foundTextBox != null)
                            {
                                gecko.WriteUInt(offset, Convert.ToUInt32(foundTextBox.Text));
                            }

                            y++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex, "Attempting to save data in 0x3FCE7FF0 region.");
            }
            #endregion

            #region Modified
            try
            {
                // Only update what has changed to avoid corruption.
                foreach (var tb in tbChanged)
                {
                    if (string.IsNullOrEmpty(tb.Text))
                    {
                        continue;
                    }

                    // These text boxes have been edited
                    var type = tb.Name.Split('_')[0];
                    var tag  = tb.Tag;

                    if (type == "Id")
                    {
                        var newName = Encoding.Default.GetBytes(tb.Text);

                        var address  = uint.Parse(tag.ToString(), NumberStyles.HexNumber);
                        var thisItem = items.Single(i => i.NameStart == address);

                        // clear current name
                        var zeros = new byte[36];
                        for (var i = 0; i < zeros.Length; i++)
                        {
                            zeros[i] = 0x0;
                        }

                        gecko.WriteBytes(address, zeros);

                        uint x = 0x0;
                        foreach (var b in newName)
                        {
                            gecko.WriteBytes(address + x, new[] { b });
                            x = x + 0x1;
                        }

                        thisItem.Id = tb.Text;

                        // Name
                        var foundTextBox = (TextBox)FindName("JsonName_" + tag);
                        if (foundTextBox != null)
                        {
                            foundTextBox.Text = GetNameFromId(thisItem.Id, thisItem.PageName);
                        }
                    }

                    if (type == "Value")
                    {
                        var  address = uint.Parse(tag.ToString(), NumberStyles.HexNumber);
                        int  val;
                        bool parsed = int.TryParse(tb.Text, out val);
                        if (parsed)
                        {
                            gecko.WriteUInt(address, Convert.ToUInt32(val));
                        }
                    }

                    if (type == "Page")
                    {
                        var  address = uint.Parse(tag.ToString(), NumberStyles.HexNumber);
                        int  val;
                        bool parsed = int.TryParse(tb.Text, out val);
                        if (parsed && val < 10 && val >= 0)
                        {
                            gecko.WriteUInt(address, Convert.ToUInt32(val));
                        }
                    }

                    if (type == "Mod")
                    {
                        var  address = uint.Parse(tag.ToString(), NumberStyles.HexNumber);
                        uint val;
                        bool parsed = uint.TryParse(tb.Text, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out val);
                        if (parsed)
                        {
                            gecko.WriteUInt(address, val);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex, "Attempting to update changed fields");
            }
            #endregion

            #region Codes
            try
            {
                // For the 'Codes' tab we mimic JGecko and send cheats to codehandler
                if (Equals(tab, Codes))
                {
                    // Disable codehandler before we modify
                    gecko.WriteUInt(CodeHandlerEnabled, 0x00000000);

                    // clear current codes
                    var array = new byte[4864];
                    Array.Clear(array, 0, array.Length);
                    gecko.WriteBytes(CodeHandlerStart, array);

                    // Write our selected codes to mem stream
                    var ms = new MemoryStream();
                    foreach (var code in codes)
                    {
                        var b = BitConverter.GetBytes(code);
                        ms.Write(b.Reverse().ToArray(), 0, 4);
                    }

                    var bytes = ms.ToArray();
                    gecko.WriteBytes(CodeHandlerStart, bytes);

                    // Re-enable codehandler
                    gecko.WriteUInt(CodeHandlerEnabled, 0x00000001);

                    // Save controller choice

                    /*
                     * if (Controller.SelectedValue.ToString() != Settings.Default.Controller)
                     * {
                     * Settings.Default.Controller = Controller.SelectedValue.ToString();
                     * Settings.Default.Save();
                     * }
                     */
                }

                DebugGrid.ItemsSource = items;
                DebugGrid.UpdateLayout();
                Debug.UpdateLayout();

                // clear changed after save
                tbChanged.Clear();
                cbChanged.Clear();
                ddChanged.Clear();
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
            #endregion

            return(true);
        }
Exemple #58
0
        private void DoConnect(DeviceStatus status, bool result)
        {
            if (result && status.Control != null)
            {
                // Associate L & R Joy-Cons
                if (status.Joy != null)
                {
                    if (status.Joy.Type == JoyControl.JoystickType.LeftJoyCon || status.Joy.Type == JoyControl.JoystickType.RightJoyCon)
                    {
                        foreach (var item in tabControl.Items)
                        {
                            if (item is TabItem && ((TabItem)item).Content is JoyControl)
                            {
                                var jc = ((JoyControl)((TabItem)item).Content);
                                if (jc.associatedJoyCon == null)
                                {
                                    if ((jc.Type == JoyControl.JoystickType.LeftJoyCon || jc.Type == JoyControl.JoystickType.RightJoyCon) &&
                                        jc.Type != status.Joy.Type)
                                    {
                                        jc.AssociateJoyCon(status.Joy);
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }

                var prefs = AppPrefs.Instance.GetDevicePreferences(status.Info.DeviceID);

                // If connection to device succeeds add a tab
                TabItem    tab   = new TabItem();
                StackPanel stack = new StackPanel {
                    Orientation = Orientation.Horizontal
                };
                stack.Children.Add(new Image
                {
                    Source              = status.Icon,
                    Height              = 12,
                    Margin              = new Thickness(0, 0, 4, 0),
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Left
                });

                // Use the nickname if there is one
                if (prefs != null && !string.IsNullOrWhiteSpace(prefs.nickname))
                {
                    stack.Children.Add(new TextBlock {
                        Text = prefs.nickname
                    });
                }
                else
                {
                    stack.Children.Add(new TextBlock {
                        Text = status.nickname.Content.ToString()
                    });
                }

                tab.Header  = stack;
                tab.Content = status.Control;
                tabControl.Items.Add(tab);
            }
            else if (!AppPrefs.Instance.suppressConnectionLost)
            {
                // Display message
                MessageBox.Show("Unable to Connect Device", "Failed", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
        /// <summary>
        /// 查询完毕回调
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void SelectCallback(object sender, UploadStringCompletedEventArgs e)
        {
            //if (activeLayer != null && !activeLayer.Equals(m_catalog.ActiveLayerObj))
            //{//不是同一个图层,清除原来的结果
            //    tabControl1.Items.Clear();
            //}

            dataPager1.DataContext = null;
            tabControl1.Items.Clear();
            if (activeLayer != null)
            {
            }
            pageSize = activeLayer.GetPageSize();
            CLayerSelectAndGetAtt selRlt = this.activeLayer.OnLayerSelectAndGetAtt(e);


            _lastSelRlt = selRlt;
            TabItem  item;
            string   name;
            DataGrid grid     = null;
            int      maxCount = 0;

            if (selRlt.Count == null)
            {
                return;
            }
            for (int k = 0; k < selRlt.Count.Length; k++)        //GDB
            {
                for (int i = 0; i < selRlt.Count[k].Length; i++) //层
                {
                    if (selRlt.Count[k][i] > 0 && selRlt.AttDS[k].attTables != null && selRlt.AttDS[k].attTables[i].Rows != null)
                    {
                        name = activeLayer.LayerObj.LayerAccessInfo[k].LayerInfoList[i].LayerDataName;
                        if (this.FindName(name) == null)
                        {
                            item = new TabItem()
                            {
                                Header = name,
                                Name   = name
                            };
                            grid = new DataGrid()
                            {
                                Name   = "datagrid" + name + "_" + k + "_" + i,
                                Height = 221,
                                Width  = 493,
                                AutoGenerateColumns = false,
                                IsReadOnly          = true,
                                Tag = new TmpInfo()
                                {
                                    LayerIndex = i, GDBIndex = k
                                }
                            };
                            grid.MouseLeftButtonUp += new MouseButtonEventHandler(DataGrid_MouseLeftButtonUp);
                            grid.LoadingRow        += new EventHandler <DataGridRowEventArgs>(DataGrid_LoadingRow);
                            item.Content            = grid;
                            if (ContextMenuService.GetContextMenu(grid) == null)
                            {
                                ContextMenu contextMenu = GetContexMenu(k, i);
                                ContextMenuService.SetContextMenu(grid, contextMenu);
                            }
                            tabControl1.Items.Add(item);
                        }
                        else
                        {
                            item = this.FindName(name) as TabItem;
                            grid = item.Content as DataGrid;
                            grid.Columns.Clear();
                            grid.ItemsSource = null;
                        }
                        List <string> addColumnlHeadArr = new List <string>();
                        addColumnlHeadArr.Add("FID");
                        string[][] arr = new string[/*selRlt.Count[0][i]*/ selRlt.AttDS[k].attTables[i].Rows.Length + 1][];
                        arr[0] = selRlt.AttDS[k].attTables[i].Columns.FldName;

                        List <string[]> addColumnlContentArr = new List <string[]>();
                        string[]        fidArr = new string[selRlt.AttDS[k].attTables[i].Rows.Length];
                        for (int j = 0; j < selRlt.AttDS[k].attTables[i].Rows.Length; j++)
                        {
                            fidArr[j]  = selRlt.AttDS[k].attTables[i].Rows[j].FID.ToString();
                            arr[j + 1] = selRlt.AttDS[k].attTables[i].Rows[j].Values;
                        }
                        addColumnlContentArr.Add(fidArr);
                        if (maxCount < selRlt.Count[k][i])
                        {
                            maxCount = selRlt.Count[k][i];
                        }
                        BindClass bingclass = new BindClass();
                        dataPager1.DataContext = new PagedCollectionView(bingclass.ColumnDisplay(grid, arr, addColumnlHeadArr, addColumnlContentArr));
                        item.IsSelected        = true;
                    }
                }
            }
            if (maxCount > 0)
            {
                dataPager1.PageSize          = (int)Math.Ceiling(Convert.ToDouble(pageSize * pageSize) / maxCount);
                dataPager1.PageIndexChanged += new EventHandler <EventArgs>(dataPager1_PageIndexChanged);
            }
            if (tabControl1.Items.Count <= 0) //&& grid != null && grid.ItemsSource == null)
            // m_graphicsLayer.MapContainer.SetErrorText("没有符合条件的数据,请重新操作!");
            {
                MessageBox.Show("没有查询到结果,请更换条件后重试!", "提示", MessageBoxButton.OK);
            }
            else
            {
                this.Show();
            }
        }
 protected override void SelectTab(TabItem <IScreen> tab)
 {
     // override base method to prevent current item from being changed on click.
     // depend on screen push/exit to change current item instead.
     tab.Value.MakeCurrent();
 }