コード例 #1
0
        protected override NWidget CreateExampleContent()
        {
            m_SingleVisiblePanel = new NSingleVisiblePanel();
            m_SingleVisiblePanel.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_SingleVisiblePanel.VerticalPlacement   = ENVerticalPlacement.Top;
            m_SingleVisiblePanel.PreferredWidth      = 400;
            m_SingleVisiblePanel.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_SingleVisiblePanel.BorderThickness = new NMargins(1);

            NStackPanel mainStack = new NStackPanel();

            m_SingleVisiblePanel.Add(mainStack);

            mainStack.Add(CreateHeaderLabel("Mobile Computers"));

            for (int i = 0, count = MobileComputers.Length; i < count; i++)
            {
                NMobileCopmuterInfo info = MobileComputers[i];

                // Create the topic's button
                NButton button = new NButton(info.Name);
                button.Tag = i + 1;
                mainStack.Add(button);

                // Create and add the topic's content
                m_SingleVisiblePanel.Add(CreateComputerInfoWidget(info));
            }

            m_SingleVisiblePanel.VisibleIndexChanged += new Function <NValueChangeEventArgs>(OnVisibleIndexValueChanged);
            m_SingleVisiblePanel.AddEventHandler(NButtonBase.ClickEvent, new NEventHandler <NEventArgs>(new Function <NEventArgs>(OnButtonClicked)));

            return(m_SingleVisiblePanel);
        }
コード例 #2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public NExamplesHomePage()
        {
            // Apply a Windows 8 theme
            Document.InheritStyleSheets = false;
            NUITheme theme = new NWindows8Theme();

            Document.StyleSheets.ApplyTheme(theme);
            m_ExamplesMap = null;

            // Add some custom styles
            Document.StyleSheets.Add(CreateCustomStyleSheet(theme));

            // Load the metafile images
            Stream emfStream = NResources.Instance.GetResourceStream("RBIN_HomePageEmfs_zip");

            m_EmfDecompressor = new NEmfDecompressor();
            NCompression.DecompressZip(emfStream, m_EmfDecompressor);

            // Create the main dock panel
            m_MainPanel = new NDockPanel();
            m_MainPanel.HorizontalSpacing   = GroupHorizontalSpacing;
            m_MainPanel.VerticalSpacing     = GroupVerticalSpacing;
            m_MainPanel.Padding             = new NMargins(GroupHorizontalSpacing, GroupVerticalSpacing);
            m_MainPanel.HorizontalPlacement = ENHorizontalPlacement.Center;
            m_MainPanel.VerticalPlacement   = ENVerticalPlacement.Center;

            // Create the contacts and the header labels
            m_MainPanel.Add(CreateSearchAndContacts(), ENDockArea.Top);
            m_HeaderLabel = CreateHeader();
            m_MainPanel.Add(m_HeaderLabel, ENDockArea.Top);

            // Create the page panel
            m_PagePanel = new NSingleVisiblePanel();
            m_PagePanel.Add(CreateWelcomePanel());
            m_MainPanel.Add(m_PagePanel, ENDockArea.Center);

            // Place the main panel in a scroll content
            NScrollContent scrollContent = new NScrollContent(m_MainPanel);

            scrollContent.WindowBackgroundFill = new NColorFill(BackgroundColor);
            scrollContent.NoScrollHAlign       = ENNoScrollHAlign.Center;
            scrollContent.NoScrollVAlign       = ENNoScrollVAlign.Center;
            scrollContent.HorizontalPlacement  = ENHorizontalPlacement.Fit;
            scrollContent.VerticalPlacement    = ENVerticalPlacement.Fit;
            scrollContent.Border          = null;
            scrollContent.BorderThickness = NMargins.Zero;

            // Place the scroll content in a document box surface to prevent theme style inheritance
            NDocumentBoxSurface surface = new NDocumentBoxSurface(scrollContent);

            surface.TextFill = new NColorFill(TextColor);
            Document.Content = surface;
        }