Exemplo n.º 1
0
 public override void CreatePages()
 {
     DocName = "Report";
     Pages.Add(new IntroductionPage()
     {
         Content = "Day la bao cao"
     });
     Pages.Add(new MenuPage()
     {
         Content = "Table of content "
     });
     Pages.Add(new NormalPage()
     {
         Content = "1 + 1 ?= 2", Pagenumber = 1, Header = "Bao cao khoa hoc"
     });
     Pages.Add(new NormalPage()
     {
         Content = "2 + 2 ?= 4", Pagenumber = 2, Header = "Bao cao khoa hoc"
     });
     Pages.Add(new ConclutionPage()
     {
         Content = "Tong ket ", Pagenumber = 3, Header = "Bao cao khoa hoc"
     });
 }
        public cache_file_resource_layout_table(CacheBase Cache, int Address)
        {
            EndianReader Reader = Cache.Reader;

            Reader.SeekTo(Address);

            #region Shared Cache Block
            Reader.SeekTo(Address + 12);
            int iCount  = Reader.ReadInt32();
            int iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                SharedCaches.Add(new SharedCache(Cache, iOffset + 264 * i));
            }
            #endregion

            #region Page Block
            Reader.SeekTo(Address + 24);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                Pages.Add(new Page(Cache, iOffset + 88 * i));
            }
            #endregion

            #region Segment Block
            Reader.SeekTo(Address + 48);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                Segments.Add(new Segment(Cache, iOffset + 24 * i));
            }
            #endregion
        }
Exemplo n.º 3
0
        void PopulateMaster()
        {
            try
            {
                var pages = new[]
                {
                    new PageType {
                        Name = "Pesquisar Cartas", TypePage = ViewModelType.GetChartViewModel
                    },
                    new PageType {
                        Name = "Conversor de Unidades", TypePage = ViewModelType.UnitsViewModel
                    },
                };

                foreach (var item in pages)
                {
                    Pages.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Exemplo n.º 4
0
 protected void btnAdd_Click(Object Sender, EventArgs e)
 {
     if (Request.Form[hdnId.UniqueID] == "0")
     {
         oPage.Add(Int32.Parse(Request.Form[hdnParent.UniqueID]), txtTitle.Text, txtUrlTitle.Text, txtMenuTitle.Text, txtBrowser.Text, Int32.Parse(ddlTemplate.SelectedItem.Value), Int32.Parse(Request.Form[hdnRelated.UniqueID]), txtNav.Text, txtNavOver.Text, txtDescription.Text, txtToolTip.Text, txtSProc.Text, (chkWindow.Checked ? 1 : 0), txtUrl.Text, ddlTarget.SelectedItem.Value, (chkNavigation.Checked == true ? 1 : 0), (chkEnabled.Checked == true ? 1 : 0));
     }
     else
     {
         oPage.Update(Int32.Parse(Request.Form[hdnId.UniqueID]), Int32.Parse(Request.Form[hdnParent.UniqueID]), txtTitle.Text, txtUrlTitle.Text, txtMenuTitle.Text, txtBrowser.Text, Int32.Parse(ddlTemplate.SelectedItem.Value), Int32.Parse(Request.Form[hdnRelated.UniqueID]), txtNav.Text, txtNavOver.Text, txtDescription.Text, txtToolTip.Text, txtSProc.Text, (chkWindow.Checked ? 1 : 0), txtUrl.Text, ddlTarget.SelectedItem.Value, (chkNavigation.Checked == true ? 1 : 0), (chkEnabled.Checked == true ? 1 : 0));
     }
     if (Request.Form[hdnOrder.UniqueID] != "")
     {
         string strOrder = Request.Form[hdnOrder.UniqueID];
         int    intCount = 0;
         while (strOrder != "")
         {
             intCount++;
             int intPage = Int32.Parse(strOrder.Substring(0, strOrder.IndexOf("&")));
             strOrder = strOrder.Substring(strOrder.IndexOf("&") + 1);
             oPage.UpdateOrder(intPage, intCount);
         }
     }
     Response.Redirect(Request.Path);
 }
Exemplo n.º 5
0
        private void CreateTransformPage()
        {
            var page = new DisplayContainer();

            Pages.Add(page);

            float x = Screen.Half.Width;
            float y = 30;

            new Image(TryLoad("helptransform0.png"))
            {
                Parent   = page,
                Position = new Point(x, y),
                Anchor   = new Distance(0.5f, 0)
            };
            y += 200;

            new Image(TryLoad("helptransform1.png"))
            {
                Parent   = page,
                Position = new Point(x, y),
                Anchor   = new Distance(0.5f, 0)
            };
        }
Exemplo n.º 6
0
        public void AddPage(IWizardPageInfo page, IWizardPageNotificationObject notificationObject = null)
        {
            if (page != null)
            {
                if (GetPageIndex(page.PageName) == -1)
                {
                    Pages.Add(page);

                    page.PageStatusChanged   += OnPageStatusChanged;
                    page.PagePropertyChanged += OnPagePropertyChanged;

                    if (notificationObject != null)
                    {
                        page.NotificationObject = notificationObject;
                    }

                    // If this is first page we insert, navigate to it
                    if (_currentIndex == -1)
                    {
                        GoToPage(0);
                    }
                }
            }
        }
        private void CreatePagesWithChords(SongViewModel song)
        {
            Label testLabel = SongTextPresentationView.GetGhostLabelInstance();

            string[]      allText    = song.Text.Split(Environment.NewLine.ToCharArray());
            string[]      allChords  = song.Chords.Split(Environment.NewLine.ToCharArray());
            int           linesLeft  = allText.Length;
            List <string> leftText   = allText.ToList();
            List <string> leftChords = allChords.ToList();



            while (linesLeft > 0)
            {
                int linesFitted = PresentationPageHelper.GetFitPageModel(leftText.ToArray(), testLabel, song.Title, FontSize, song.SongKey, addChords: true, chordsToFit: leftChords.ToArray());
                if (linesFitted != -1)
                {
                    Pages.Add(PresentationPageHelper.PresentationPageModel);
                    linesLeft -= linesFitted;
                    leftText.RemoveRange(0, linesFitted);
                    leftChords.RemoveRange(0, linesFitted);
                }
            }
        }
Exemplo n.º 8
0
 public override WizardPage GetNextPage(WizardPage page)
 {
     if (page == this.providerSelectionPage)
     {
         ScmRepositoryProvider repoProvider = this.providerSelectionPage.SelectedRepositoryProvider;
         if (repoProvider != null)
         {
             if (this.repositorySelectionPages == null)
             {
                 this.repositorySelectionPages = new Dictionary <string, RepositorySelectionPage>();
             }
             string providerId = repoProvider.Id;
             RepositorySelectionPage result = null;
             if (!this.repositorySelectionPages.TryGetValue(providerId, out result))
             {
                 result = new RepositorySelectionPage(repoProvider);
                 Pages.Add(result);
                 this.repositorySelectionPages.Add(providerId, result);
             }
             return(result);
         }
     }
     return(null);
 }
        void PopulateMaster()
        {
            try
            {
                var pages = new[]
                {
                    new PageType {
                        Name = "Page 1", TypePage = ViewModelType.UmViewModel
                    },
                    new PageType {
                        Name = "Page 2", TypePage = ViewModelType.DoisViewModel
                    },
                };

                foreach (var item in pages)
                {
                    Pages.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 添加 Tab 由侧边栏菜单调用
        /// </summary>
        /// <param name="menu"></param>
        public void AddTab(BootstrapMenu menu)
        {
            var tab = Tabs.FirstOrDefault(tb => tb.Id == menu.Id);

            if (tab == null)
            {
                tab = new Tab();
                tab.Init(menu);
                Tabs.ForEach(t => t.SetActive(false));
                Tabs.Add(tab);
                Pages.ForEach(p => p.Active = false);
                Pages.Add(new PageContentAttributes()
                {
                    Id = menu.Id, Name = menu.Url, Active = true
                });
            }
            else
            {
                Tabs.ForEach(t => t.SetActive(t.Id == tab.Id));
                Pages.ForEach(p => p.Active = p.Id == tab.Id);
            }
            curId = tab.Id;
            StateHasChanged();
        }
Exemplo n.º 11
0
        public void Init()
        {
            loaded = false;

            Pages.Clear();

            // connections

            if (obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.EnergyStream &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Controller_PID &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.LevelGauge &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.AnalogGauge &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.DigitalGauge &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Input &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Switch &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec)
            {
                var tab1 = new DocumentPage {
                    Closable = false
                };
                tab1.Text = "Connections";

                var cont0 = UI.Shared.Common.GetDefaultContainer();

                UI.Shared.Common.CreateAndAddLabelRow(cont0, "Object Connections Editor".Localize());

                UI.Shared.Common.CreateAndAddDescriptionRow(cont0, "ConnectorsEditorDescription".Localize());
                new DWSIM.UI.Desktop.Editors.ConnectionsEditor(obj, cont0);

                cont0.Width = this.Width - 30;

                var scr1 = new Scrollable()
                {
                    Content = cont0
                };
                tab1.Content = scr1;

                Pages.Add(tab1);

                PageConnections = tab1;
            }

            // properties

            var tab2 = new DocumentPage {
                Closable = false
            };

            tab2.Text = "Properties";

            Pages.Add(tab2);

            var cont = UI.Shared.Common.GetDefaultContainer();

            cont.Width = this.Width - 30;

            if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream)
            {
                new DWSIM.UI.Desktop.Editors.MaterialStreamEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn)
            {
                new DWSIM.UI.Desktop.Editors.DistillationColumnEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn)
            {
                new DWSIM.UI.Desktop.Editors.AbsorptionColumnEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.AdjustEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Controller_PID)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.PIDControllerEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.SpecEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Recycle)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.RecycleEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_EnergyRecycle)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.EnergyRecycleEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.LevelGauge)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.LevelGaugeEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AnalogGauge)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.AnalogGaugeEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DigitalGauge)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.DigitalGaugeEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Switch)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.SwitchEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Input)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.InputEditor.Populate(obj, cont);
            }
            else
            {
                new DWSIM.UI.Desktop.Editors.GeneralEditors(obj, cont);
            }

            tab2.Content = new Scrollable()
            {
                Content = cont, Width = this.Width - 30
            };

            if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Pipe)
            {
                tab2.Text = "General";
                var cont2 = UI.Shared.Common.GetDefaultContainer();
                cont2.Tag   = "Hydraulic Profile";
                cont2.Width = this.Width - 30;
                new PipeHydraulicProfile(obj, cont2);
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = cont2, Width = this.Width - 30
                })
                {
                    Text = "Hydraulic Profile", Closable = false
                });
                var cont3 = UI.Shared.Common.GetDefaultContainer();
                cont3.Tag   = "Thermal Profile";
                cont3.Width = this.Width - 30;
                new PipeThermalProfile(obj, ((Pipe)obj).ThermalProfile, cont3);
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = cont3, Width = this.Width - 30
                })
                {
                    Text = "Thermal Profile", Closable = false
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.CustomUO)
            {
                tab2.Text = "General";
                var cont2 = new TableLayout {
                    Padding = new Padding(10), Spacing = new Size(5, 5)
                };
                cont2.Tag   = "Python Script";
                cont2.Width = this.Width - 30;
                if (Application.Instance.Platform.IsWpf)
                {
                    var scripteditor = new Eto.Forms.Controls.Scintilla.Shared.ScintillaControl()
                    {
                        ScriptText = ((CustomUO)obj).ScriptText
                    };
                    var dyn1 = new DynamicLayout();
                    dyn1.CreateAndAddLabelAndButtonRow("Click to commit script changes", "Update", null, (sender, e) =>
                    {
                        ((CustomUO)obj).ScriptText = scripteditor.ScriptText;
                    });
                    dyn1.Width = this.Width - 30;
                    cont2.Rows.Add(new TableRow(dyn1));
                    cont2.Rows.Add(new TableRow(scripteditor));
                }
                else if (Application.Instance.Platform.IsMac || Application.Instance.Platform.IsGtk)
                {
                    var scripteditor = new Eto.Forms.Controls.Scintilla.Shared.ScintillaControl()
                    {
                        ScriptText = ((CustomUO)obj).ScriptText
                    };
                    scripteditor.SetKeywords(1, ((FlowsheetBase.FlowsheetBase)obj.GetFlowsheet()).ScriptKeywordsU);
                    var dyn1 = new DynamicLayout();
                    dyn1.CreateAndAddLabelAndButtonRow("Click to commit script changes", "Update", null, (sender, e) =>
                    {
                        ((CustomUO)obj).ScriptText = scripteditor.ScriptText;
                    });
                    dyn1.Width = this.Width - 30;
                    cont2.Rows.Add(new TableRow(dyn1));
                    cont2.Rows.Add(new TableRow(scripteditor));
                }
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = cont2, Width = this.Width - 30
                })
                {
                    Text = "Python Script", Closable = false
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.HeatExchanger)
            {
                tab2.Text = "General";
                var dyn1 = new ShellAndTubePropertiesView(obj);
                dyn1.Width = this.Width - 30;
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = dyn1, Width = this.Width - 30
                })
                {
                    Text = "Shell and Tube Properties", Closable = false
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn ||
                     obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn)
            {
                tab2.Text = "General";
                var dyn2 = RigorousColumnShared.GetInitialEstimatesEditor((Column)obj);
                dyn2.Width = this.Width - 30;
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = dyn2, Width = this.Width - 30
                })
                {
                    Text = "Initial Estimates", Closable = false
                });
            }

            PageEditor = tab2;

            // dynamics

            if ((obj.SupportsDynamicMode && obj.HasPropertiesForDynamicMode) || obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream)
            {
                if (obj.ExtraPropertiesDescriptions.Count() > 0 || obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream)
                {
                    var tabd = new DocumentPage {
                        Closable = false
                    };
                    tabd.Text = "Dynamics";

                    var contd = UI.Shared.Common.GetDefaultContainer();

                    contd.Width = this.Width - 30;

                    new DynamicPropertiesEditor(obj, contd);

                    tabd.Content = new Scrollable()
                    {
                        Content = contd, Width = this.Width - 30
                    };

                    PageDynamics = tabd;

                    Pages.Add(tabd);
                }
            }

            // results

            var tabr = new DocumentPage {
                Closable = false
            };

            tabr.Text = "Results";

            var container = new TableLayout();

            new DWSIM.UI.Desktop.Editors.Results(obj, container);

            tabr.Content = new Scrollable()
            {
                Content = container, Width = this.Width - 30
            };

            PageResults = tabr;

            Pages.Add(tabr);

            if (obj.GraphicObject is ShapeGraphic)
            {
                var tabx = new DocumentPage {
                    Closable = false
                };
                tabx.Text = "Appearance";
                var editor = new ObjectAppearanceEditorView(obj.GetFlowsheet(), (ShapeGraphic)obj.GraphicObject);
                editor.Width = this.Width - 30;
                tabx.Content = new Scrollable()
                {
                    Content = editor, Width = this.Width - 30
                };

                Pages.Add(tabx);
            }

            if (SelectedPanel >= 0)
            {
                SelectedIndex = SelectedPanel;
            }

            loaded = true;
        }
Exemplo n.º 12
0
        protected virtual void LoadXml(XmlDocument doc)
        {
            XmlNode node = doc.DocumentElement.SelectSingleNode("Name");

            Name = node != null?node.InnerText.Trim() : String.Empty;

            node   = doc.DocumentElement.SelectSingleNode("Author");
            Author = node != null?node.InnerText.Trim() : String.Empty;

            node    = doc.DocumentElement.SelectSingleNode("Version");
            Version = node != null?node.InnerText.Trim() : String.Empty;

            node       = doc.DocumentElement.SelectSingleNode("Compatible");
            Compatible = node != null?node.InnerText.Trim() : String.Empty;

            node = doc.DocumentElement.SelectSingleNode("UpdateTime");
            string udt = node != null?node.InnerText.Trim() : String.Empty;

            DateTime dt;

            DateTime.TryParse(udt, out dt);
            UpdateTime = dt;

            node   = doc.DocumentElement.SelectSingleNode("Enable");
            Enable = node == null ? false : node.InnerText.Trim().ToLower() == "true";

            node        = doc.DocumentElement.SelectSingleNode("IsInstalled");
            IsInstalled = node == null ? false : node.InnerText.Trim().ToLower() == "true";

            node = doc.DocumentElement.SelectSingleNode("Url");
            Url  = node != null?node.InnerText.Trim() : String.Empty;

            node        = doc.DocumentElement.SelectSingleNode("Description");
            Description = node != null?node.InnerText.Trim() : String.Empty;

            node    = doc.DocumentElement.SelectSingleNode("Summary");
            Summary = node != null?node.InnerText.Trim() : String.Empty;

            node = doc.DocumentElement.SelectSingleNode("Pages");
            if (node != null)
            {
                XmlAttribute attr = node.Attributes["defaultPage"];
                Url = attr != null ? attr.Value : String.Empty;

                XmlNodeList nodes = node.SelectNodes("Add");
                Pages.Clear();
                foreach (XmlNode n in nodes)
                {
                    string id       = n.Attributes["ID"] != null ? n.Attributes["ID"].Value : String.Empty;
                    string name     = n.Attributes["Name"] != null ? n.Attributes["Name"].Value : String.Empty;
                    string title    = n.Attributes["Title"] != null ? n.Attributes["Title"].Value : String.Empty;
                    string url      = n.Attributes["Url"] != null ? n.Attributes["Url"].Value : String.Empty;
                    bool   main     = n.Attributes["Main"] != null ? n.Attributes["Main"].Value.ToLower() == "true" ? true : false : false;
                    string entityid = n.Attributes["EntityID"] != null ? n.Attributes["EntityID"].Value : string.Empty;
                    Pages.Add(new UrlItem(id, name, title, url, main, entityid));
                }
            }

            node = doc.DocumentElement.SelectSingleNode("Controls");
            if (node != null)
            {
                Controls = new List <UrlItem>();
                XmlNodeList nodes = node.SelectNodes("Add");

                foreach (XmlNode n in nodes)
                {
                    string name = n.Attributes["Name"] != null ? n.Attributes["Name"].Value : String.Empty;
                    string url  = n.Attributes["Url"] != null ? n.Attributes["Url"].Value : String.Empty;

                    Controls.Add(new UrlItem("", name, "", url, false, ""));
                }
            }

            node = doc.DocumentElement.SelectSingleNode("Deployment");

            if (node != null)
            {
                XmlNodeList nodes = doc.DocumentElement.SelectNodes("Deployment/Install/Item");
                foreach (XmlNode n in nodes)
                {
                    if (!Deployment.Install.Contains(n.InnerText.Trim()))
                    {
                        Deployment.Install.Add(n.InnerText.Trim());
                    }
                }

                nodes = doc.DocumentElement.SelectNodes("//Deployment/Update/Item");
                foreach (XmlNode n in nodes)
                {
                    if (!Deployment.Update.Contains(n.InnerText.Trim()))
                    {
                        Deployment.Update.Add(n.InnerText.Trim());
                    }
                }

                nodes = doc.DocumentElement.SelectNodes("//Deployment/Unstall/Item");
                foreach (XmlNode n in nodes)
                {
                    if (!Deployment.Unstall.Contains(n.InnerText.Trim()))
                    {
                        Deployment.Unstall.Add(n.InnerText.Trim());
                    }
                }

                node = node.SelectSingleNode("Description");
                Deployment.Introduction = node != null?node.InnerText.Trim() : String.Empty;
            }

            node = doc.DocumentElement.SelectSingleNode("Picture");
            if (node != null)
            {
                Thumbnail = node.Attributes["Thumbnail"] != null ? node.Attributes["Thumbnail"].Value.Trim() : String.Empty;
                XmlNodeList nodes = node.SelectNodes("Item");
                foreach (XmlNode n in nodes)
                {
                    Snapshot.Add(n.InnerText.Trim());
                }
                //Snapshot = node.Attributes["Snapshot"] != null ? node.Attributes["Snapshot"].Value.Trim() : String.Empty;
            }

            node      = doc.DocumentElement.SelectSingleNode("Directory");
            Directory = node != null?node.InnerText.Trim() : String.Empty;

            node   = doc.DocumentElement.SelectSingleNode("Others");
            Others = node != null?node.InnerText.Trim() : String.Empty;

            node    = doc.DocumentElement.SelectSingleNode("IsLocal");
            IsLocal = node != null ? (node.InnerText.Trim() == "1") : false;
        }
Exemplo n.º 13
0
 public override void CreatePage()
 {
     Pages.Add(new SkillPage());
     Pages.Add(new EducationPage());
     Pages.Add(new ExperiencePage());
 }
Exemplo n.º 14
0
        public PCL6SpoolFile(BinaryReader fileReader) : base(fileReader)
        {
            PCL6Page newPage = new PCL6Page(fileReader);

            Pages.Add(newPage);
        }
Exemplo n.º 15
0
        public VRCEUiQuickScrollMenu(string name, bool addBack = true)
        {
            // Get required information
            Transform orgControl = VRCEUi.InternalQuickMenu.EmojiMenu;

            if (orgControl == null)
            {
                MVRCLogger.LogError("Could not find Emoji Menu!");
                Success = false;
                return;
            }

            // Duplicate object
            GameObject goControl = GameObject.Instantiate(orgControl.gameObject, VRCEUi.QuickMenu.transform);

            if (goControl == null)
            {
                MVRCLogger.LogError("Could not duplicate Emoji Menu!");
                Success = false;
                return;
            }

            // Create game object
            GameObject goContent = new GameObject("Content");

            // Get positions
            ContentPosition = goContent.GetOrAddComponent <RectTransform>();

            // Set UI properties
            Control        = goControl.transform;
            ContentControl = goContent.transform;

            // Get buttons
            UpButtonObject   = Control.Find("PageUp").GetComponent <Button>();
            DownButtonObject = Control.Find("PageDown").GetComponent <Button>();

            // Setup UpButton
            UpButtonObject.onClick      = new Button.ButtonClickedEvent();
            UpButtonObject.interactable = false;
            UpButtonObject.onClick.AddListener(() =>
            {
                if (CurrentPage < 1)
                {
                    return;
                }

                SetPage(CurrentPage - 1);
            });

            // Setup DownButton
            DownButtonObject.onClick      = new Button.ButtonClickedEvent();
            DownButtonObject.interactable = false;
            DownButtonObject.onClick.AddListener(() =>
            {
                if (CurrentPage >= (Pages.Count - 1))
                {
                    return;
                }

                SetPage(CurrentPage + 1);
            });

            // Set required parts
            goControl.name = name;

            // Setup Content
            RectTransform rtBtn = UpButtonObject.transform.GetComponent <RectTransform>();

            ContentControl.SetParent(Control);
            ContentControl.localScale     = Vector3.one;
            ContentControl.localRotation  = Quaternion.identity;
            ContentControl.localPosition  = Vector3.zero;
            ContentPosition.anchorMin     = new Vector2(0f, 0f);
            ContentPosition.anchorMax     = new Vector2(0f, 0f);
            ContentPosition.pivot         = new Vector2(0f, 1f);
            ContentPosition.sizeDelta     = new Vector2(rtBtn.sizeDelta.x * 3f, (rtBtn.sizeDelta.y - 10f) * 3f);
            ContentPosition.localPosition = new Vector3(-((ContentPosition.sizeDelta.x / 2f) + (rtBtn.sizeDelta.x / 2f)), ContentPosition.sizeDelta.y, 0f);

            // Clear menu
            foreach (Transform button in ContentControl)
            {
                if (button == null)
                {
                    continue;
                }
                GameObject.Destroy(button.gameObject);
            }
            foreach (Transform button in Control)
            {
                if (button == null)
                {
                    continue;
                }
                if (button.name == "Content")
                {
                    continue;
                }
                if (button.name == "BackButton" && addBack)
                {
                    continue;
                }
                if (button.name == "PageUp")
                {
                    continue;
                }
                if (button.name == "PageDown")
                {
                    if (!addBack)
                    {
                        button.GetComponent <RectTransform>().localPosition = orgControl.transform.Find("BackButton").GetComponent <RectTransform>().localPosition;
                    }
                    continue;
                }
                GameObject.Destroy(button.gameObject);
            }

            // Finish
            VRCEUiScrollPage page = new VRCEUiScrollPage(this);

            page.SetActive(true);
            Pages.Add(page);
            Success = true;
        }
Exemplo n.º 16
0
 public PluginBase()
 {
     Pages.Add(new DirectoryPage());
     WaveStreams.Add(new WaveStreamPlugin());
     LAPP.Player.Receiver.EventReceived += Player_EventReceived;
 }
Exemplo n.º 17
0
 public override void CreatePages()
 {
     Pages.Add(new Bibliography());
     Pages.Add(new Summary());
 }
Exemplo n.º 18
0
        private static void Main(string[] args)
        {
#if !DEBUG
            try
            {
#endif

            Application.ApplicationExit += (s, e) => Properties.Settings.Default.Save();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Environment.CurrentDirectory = ApplicationDirectory;

            Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr"); //forces french translations to be used

            //Don't start application if arguments/files were being handled (except --open)
            if (HandleArguments(args))
            {
                return;
            }

            //Check if application is running already
            if (!Mutex.WaitOne(TimeSpan.Zero, true))
            {
                //Send broadcast to show the window of the current instance.
                NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
                return;
            }

            #region Splash Screen Code

            using (var splash = new SplashForm())
            {
                splash.Show();

                splash.SetStatus(Properties.Strings.Splash_Folders);
                splash.statusBar.Value = 20;

                CreateFolders();

                splash.SetStatus(Properties.Strings.Splash_DetectOS);
                _ = OperatingSystemVersions.CurrentVersion;
                splash.statusBar.Value = 40;

                splash.SetStatus(Properties.Strings.Splash_Extensions);
                Loader.LoadExtensions();
                splash.statusBar.Value = 60;

                splash.SetStatus(Properties.Strings.Splash_Backups);
                LoadBackups();
                splash.statusBar.Value = 80;

                splash.SetStatus(Properties.Strings.Splash_Pages);
                InitializePages();
                splash.statusBar.Value = 100;

#if DEBUG
                splash.SetStatus(Properties.Strings.Splash_Debug);
                Pages.Add(new DebugPage());
#endif

                splash.Hide();
            }

            #endregion Splash Screen Code
            using (var main = new MainForm())
            {
                System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.test); //this loads in the startup sound
                player.Play();                                                                             //it plays said sound

                Application.Run(main);
            }

#if !DEBUG
        }

        catch (Exception ex)
        {
            SendCrashReport(ex);
            throw;
        }
#endif
        }
Exemplo n.º 19
0
 public void Add(PageCreated pageCreated)
 {
     Pages.Add(pageCreated);
 }
Exemplo n.º 20
0
 public override void CreatePage()
 {
     Pages.Add(new InstrudutionPage());
     Pages.Add(new SummaryPage());
 }
Exemplo n.º 21
0
        /// <summary>
        /// Implements support for data forms. Data Forms are defined in the following XEPs:
        ///
        /// XEP-0004: Data Forms:
        /// http://xmpp.org/extensions/xep-0004.html
        ///
        /// XEP-0122: Data Forms Validation:
        /// http://xmpp.org/extensions/xep-0122.html
        ///
        /// XEP-0141: Data Forms Layout
        /// http://xmpp.org/extensions/xep-0141.html
        ///
        /// XEP-0221: Data Forms Media Element
        /// http://xmpp.org/extensions/xep-0221.html
        ///
        /// XEP-0331: Data Forms - Color Field Types
        /// http://xmpp.org/extensions/xep-0331.html
        ///
        /// XEP-0336: Data Forms - Dynamic Forms
        /// http://xmpp.org/extensions/xep-0336.html
        ///
        /// XEP-0348: Signing Forms:
        /// http://xmpp.org/extensions/xep-0348.html
        /// </summary>
        /// <param name="Client">XMPP Client.</param>
        /// <param name="X">Data Form definition.</param>
        /// <param name="OnSubmit">Method called when the form is submitted.</param>
        /// <param name="OnCancel">Method called when the form is cancelled.</param>
        /// <param name="From">From where the form came.</param>
        /// <param name="To">To where the form was sent.</param>
        public DataForm(XmppClient Client, XmlElement X, DataFormEventHandler OnSubmit, DataFormEventHandler OnCancel, string From, string To)
        {
            List <string>  Instructions = new List <string>();
            List <Field>   Fields       = new List <Field>();
            List <Field[]> Records      = new List <Field[]>();
            List <Page>    Pages        = null;

            this.client   = Client;
            this.onSubmit = OnSubmit;
            this.onCancel = OnCancel;
            this.from     = From;
            this.to       = To;

            switch (XML.Attribute(X, "type").ToLower())
            {
            case "cancel":
                this.type = FormType.Cancel;
                break;

            case "form":
                this.type = FormType.Form;
                break;

            case "result":
                this.type = FormType.Result;
                break;

            case "submit":
                this.type = FormType.Submit;
                break;

            default:
                this.type = FormType.Undefined;
                break;
            }

            foreach (XmlNode N in X.ChildNodes)
            {
                switch (N.LocalName)
                {
                case "instructions":
                    Instructions.Add(N.InnerText.Trim());
                    break;

                case "title":
                    this.title = N.InnerText.Trim();
                    break;

                case "field":
                    Field Field = this.ParseField((XmlElement)N, out Media Media);
                    Fields.Add(Field);

                    if (Field.PostBack)
                    {
                        this.containsPostBackFields = true;
                    }

                    if (!string.IsNullOrEmpty(Field.Var))
                    {
                        this.fieldsByVar[Field.Var] = Field;
                    }

                    if (Media != null)
                    {
                        Field = new MediaField(this, Guid.NewGuid().ToString(), string.Empty, false,
                                               null, null, string.Empty, new StringDataType(), new BasicValidation(), Media, string.Empty, false, true, false);
                        Fields.Add(Field);
                        this.fieldsByVar[Field.Var] = Field;
                        this.hasMedia = true;
                    }
                    break;

                case "reported":
                    List <Field> Header = new List <Field>();

                    foreach (XmlNode N2 in N.ChildNodes)
                    {
                        if (N2.LocalName == "field")
                        {
                            Field = this.ParseField((XmlElement)N2, out Media);
                            Header.Add(Field);
                        }
                    }

                    this.header = Header.ToArray();
                    break;

                case "item":
                    List <Field> Record = new List <Field>();

                    foreach (XmlNode N2 in N.ChildNodes)
                    {
                        if (N2.LocalName == "field")
                        {
                            Field = this.ParseField((XmlElement)N2, out Media);
                            Record.Add(Field);
                        }
                    }

                    Records.Add(Record.ToArray());
                    break;

                case "page":
                    if (Pages == null)
                    {
                        Pages = new List <Page>();
                    }

                    Pages.Add(new Page(this, (XmlElement)N));
                    break;
                }
            }

            this.instructions = Instructions.ToArray();
            this.fields       = Fields.ToArray();
            this.records      = Records.ToArray();

            if (this.header == null)
            {
                this.header = new Field[0];
            }

            if (this.hasPages = (Pages != null))
            {
                this.pages = Pages.ToArray();
            }
            else if (this.fields.Length > 0)
            {
                this.pages = new Page[] { new Page(this, this.title, this.fields) }
            }
            ;
            else
            {
                this.pages = new Page[] { new Page(this, this.title, new ReportedReference(this)) }
            };

            if (this.hasMedia)
            {
                Dictionary <string, byte[]> Bob = new Dictionary <string, byte[]>(StringComparer.CurrentCultureIgnoreCase);

                foreach (XmlNode N in X.ParentNode.ChildNodes)
                {
                    if (N is XmlElement E && E.LocalName == "data" && E.NamespaceURI == BobClient.Namespace)
                    {
                        string Cid = XML.Attribute(E, "cid");
                        byte[] Bin = Convert.FromBase64String(E.InnerText);

                        Bob["cid:" + Cid] = Bin;
                    }
                }

                foreach (Field F in this.fields)
                {
                    if (F is MediaField MediaField && MediaField.Media != null)
                    {
                        foreach (KeyValuePair <string, Uri> Uri in MediaField.Media.URIs)
                        {
                            switch (Uri.Value.Scheme.ToLower())
                            {
                            case "cid":
                                if (Bob.TryGetValue(Uri.Value.ToString(), out byte[] Bin))
Exemplo n.º 22
0
        /* func */
        /// <summary>
        /// 从目标配置文件读取字体配置
        /// </summary>
        /// <param name="filePath">文件路径</param>
        public void LoadFontFromFile(string filePath)
        {
            if (string.IsNullOrWhiteSpace(filePath))
            {
                MessageBox.Show("路径不能为空白");
                return;
            }
            else if (!File.Exists(filePath))
            {
                MessageBox.Show($"没有找到文件。\n{filePath}");
                return;
            }

            string[] lines         = File.ReadAllLines(filePath);
            string   directoryPath = new FileInfo(filePath).Directory.FullName;

            if (HaveSetValue)
            {
                throw new ArgumentException("Use new instance!");
            }
            else
            {
                HaveSetValue = true;
            }

            HaveError = true;
            int charCounts = 0;

            if (lines.Length < 4)
            {
                MessageBox.Show("字体配置行数过少,停止读入");
                return;
            }

            foreach (string line in lines)
            {
                if (string.IsNullOrWhiteSpace(line))
                {
                    continue;
                }
                int spaceIndex = line.IndexOf(" ");
                if (spaceIndex == -1)
                {
                    continue;
                }
                string label = line.Substring(0, spaceIndex);
                switch (label)
                {
                case "char":
                    BMPFontChar oneChar = new BMPFontChar();
                    oneChar.SetStringValue(line);
                    char @char = (char)oneChar.ID;
                    if (Chars.ContainsKey(@char))
                    {
                        MessageBox.Show($"有相同的 ID 值。\nID={oneChar.ID}, Char={@char}");
                    }
                    else
                    {
                        Chars.Add(@char, oneChar);
                    }
                    break;

                case "info":
                    Info.SetStringValue(line);
                    break;

                case "common":
                    Common.SetStringValue(line);
                    break;

                case "page":
                    BMPFontPage page = new BMPFontPage();
                    page.SetStringValue(line, directoryPath);
                    Pages.Add(page);
                    break;

                case "chars":
                    Match match = CharsCountRegex.Match(line);
                    if (!match.Success ||
                        !int.TryParse(match.Value, out charCounts))
                    {
                        MessageBox.Show($"这一行可能有问题。{line}");
                    }
                    break;

                default:
                    // 意外的字段
                    break;
                }
            }

            if (charCounts != Chars.Count)
            {
                MessageBox.Show($"字符的数量与声明的数量不一致。");
            }
            HaveError = false;
            HaveError = Info.HaveError || Common.HaveError;
            foreach (BMPFontPage bMPFontPage in Pages)
            {
                HaveError |= bMPFontPage.HaveError;
            }
            foreach (BMPFontChar bMPFontChar in Chars.Values)
            {
                HaveError |= bMPFontChar.HaveError;
            }
            if (HaveError)
            {
                MessageBox.Show($"读取字体配置时出现错误,停止读入(155)\n\t{nameof(BMPFontCommon)} : {Common.HaveError}\n\t{nameof(BMPFontInfo)} : {Info.HaveError}");
                return;
            }

            Pages.Sort();
            foreach (BMPFontPage page in Pages)
            {
                page.LoadImage();
            }
            CharMaxWidth = 0;
            foreach (BMPFontChar bmpFontChar in Chars.Values)
            {
                CharMaxWidth = CharMaxWidth < bmpFontChar.Size.x ? bmpFontChar.Size.x : CharMaxWidth;
                bmpFontChar.LoadSprite(this);
            }
            HaveError = false;
            HaveError = Info.HaveError || Common.HaveError;
            foreach (BMPFontPage bMPFontPage in Pages)
            {
                HaveError |= bMPFontPage.HaveError;
            }
            foreach (BMPFontChar bMPFontChar in Chars.Values)
            {
                HaveError |= bMPFontChar.HaveError;
            }
            if (HaveError)
            {
                MessageBox.Show($"加载字体配置时出现错误,停止读入(176)\n\t{nameof(BMPFontCommon)} : {Common.HaveError}\n\t{nameof(BMPFontInfo)} : {Info.HaveError}");
                return;
            }
        }
Exemplo n.º 23
0
 public override void CreatePages()
 {
     Pages.Add(new HomeBlogPage());
     Pages.Add(new MainBlogPage());
     Pages.Add(new AboutUsBlogPage());
 }
Exemplo n.º 24
0
        public virtual void MenuChanged(object sender, MenuChangedEventArgs e)
        {
            if (e.OldMenu != null)
            {
                Util.Helper.Events.Display.RenderedActiveMenu -= DrawTabButton;
                Util.Helper.Events.Display.RenderedActiveMenu -= DrawContent;
                Util.Helper.Events.Display.RenderedActiveMenu -= DrawCalendar;
                this.CalendarBool = null;


                if (e.OldMenu is GameMenu gameMenu)
                {
                    List <IClickableMenu> tabPages = gameMenu.pages;
                }
            }

            if (e.NewMenu is GameMenu newMenu)
            {
                for (int i = 0; i < PageFactory.Count; i++)
                {
                    var page = PageFactory[i];

                    var newPage = page();

                    newPage.pageIndex  = i;
                    newPage.pageNumber = newMenu.pages.Count + i;
                    Pages.Add(newMenu.pages.Count + i, newPage);
                }
                PageFactory.Clear();

                foreach (var page in Pages)
                {
                    if (page.Value.PageButton == null)
                    {
                        page.Value.AddPageButton();
                    }

                    List <IClickableMenu> tabPages = newMenu.pages;


                    tabPages.Add(page.Value);

                    page.Value.xPositionOnScreen = Game1.activeClickableMenu.xPositionOnScreen;
                    page.Value.yPositionOnScreen = Game1.activeClickableMenu.yPositionOnScreen + 10;
                    page.Value.height            = Game1.activeClickableMenu.height;

                    //for (int i = 0; i < Slots.Count; ++i)
                    //{
                    //    var next = Slots[i];
                    //    next.bounds.X = xPositionOnScreen + Game1.tileSize / 4;
                    //    next.bounds.Y = yPositionOnScreen + Game1.tileSize * 5 / 4 + Game1.pixelZoom + i * (height - Game1.tileSize * 2) / 7;
                    //    next.bounds.Width = width - Game1.tileSize / 2;
                    //    next.bounds.Height = (height - Game1.tileSize * 2) / 7 + Game1.pixelZoom;
                    //}
                }

                Util.Helper.Events.Display.RenderedActiveMenu += DrawTabButton;
                Util.Helper.Events.Display.RenderedActiveMenu += DrawContent;
                //Util.Helper.Events.Display.RenderedActiveMenu += DrawCalendar;
            }
            else if (e.NewMenu is Billboard bill)
            {
                Util.Helper.Events.Display.RenderedActiveMenu += DrawCalendar;
            }
        }
Exemplo n.º 25
0
 public void AddPage(Page page)
 {
     page.Id = Pages.Count;
     Pages.Add(page);
 }
Exemplo n.º 26
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     Pages.Add(MakePage());
 }
Exemplo n.º 27
0
 public void Add(Page p)
 {
     Pages.Add(p);
 }
Exemplo n.º 28
0
 public override void CreatePages()
 {
     Pages.Add(new SkillsPage());
 }
Exemplo n.º 29
0
        private void ComputePages()
        {
            Pages.Clear();

            bool leftDotPage  = false;
            bool rightDotPage = false;

            if (LastPage > 15)
            {
                rightDotPage = true;
            }

            // если страниц меньше чем 15(вкл) или текущая страница меньше 8(вкл), то покажем все начальные страницы
            if (LastPage <= 15)
            {
                for (int i = 1; i <= LastPage; i++)
                {
                    Pages.Add(new Page
                    {
                        Value        = i,
                        Caption      = i.ToString(),
                        IsCurrenPage = i == CurrentPage,
                        RouteValues  = Merge(new Dictionary <string, object> {
                            { "controller", ControllerName }, { "action", ActionName }, { "Page", i }
                        }, RouteParams, Params)
                    });
                }
            }
            else if (CurrentPage <= 8)
            {
                for (int i = 1; i <= 15; i++)
                {
                    Pages.Add(new Page
                    {
                        Value        = i,
                        Caption      = i.ToString(),
                        IsCurrenPage = i == CurrentPage,
                        RouteValues  = Merge(new Dictionary <string, object> {
                            { "controller", ControllerName }, { "action", ActionName }, { "Page", i }
                        }, RouteParams, Params)
                    });
                }
            }
            // иначе сдвигаем страницы на разницу текущей страницы от 8
            else

            {
                leftDotPage = true;
                int n = LastPage - 15;   // количество позиций на которые можно сдвинуть влево
                int c = CurrentPage - 8; // количество позиций относительно текущей страницы
                if (c > n)
                {
                    c            = n;
                    rightDotPage = false;
                }

                for (int i = 1 + c, l = c + 15; i <= l; i++)
                {
                    Pages.Add(new Page
                    {
                        Value        = i,
                        Caption      = i.ToString(),
                        IsCurrenPage = i == CurrentPage,
                        RouteValues  = Merge(new Dictionary <string, object> {
                            { "controller", ControllerName }, { "action", ActionName }, { "Page", i }
                        }, RouteParams, Params)
                    });
                }
            }

            // если не нужно показывать первые и последние страницы, то покажем просто точки. Картина будет такая:
            //  ____ ___ ___ ___ ___ ____
            // | .. | 6 | 7 | 8 | 9 | .. |
            //
            if (!ShowLastAndFirstPages)
            {
                for (var i = 0; i < Pages.Count; i++)
                {
                    if (i == 0 && leftDotPage || i == 14 && rightDotPage)
                    {
                        Pages[i].Caption = "..";
                    }
                }
            }
            // если нужно показывать первые и последние страницы, то покажем 1, 2, предпоследнюю и последнюю страницы. То есть картина будет такая:
            // ___ ___ ____ ___ ___ ___ ___ ____ ____ ____
            // | 1 | 2 | .. | 6 | 7 | 8 | 9 | .. | 14 | 15 |
            //
            else
            {
                for (var i = 0; i < Pages.Count; i++)
                {
                    if (i <= 2 && leftDotPage)
                    {
                        if (i == 0)
                        {
                            Pages[i].Caption     = "1";
                            Pages[i].Value       = 1;
                            Pages[i].RouteValues = Merge(new Dictionary <string, object> {
                                { "controller", ControllerName }, { "action", ActionName }, { "Page", 1 }
                            }, RouteParams, Params);
                        }
                        else if (i == 1)
                        {
                            Pages[i].Caption     = "2";
                            Pages[i].Value       = 2;
                            Pages[i].RouteValues = Merge(new Dictionary <string, object> {
                                { "controller", ControllerName }, { "action", ActionName }, { "Page", 2 }
                            }, RouteParams, Params);
                        }
                        else if (i == 2)
                        {
                            Pages[i].Caption = "..";
                        }
                    }
                    else if (i >= 12 && rightDotPage)
                    {
                        if (i == 14)
                        {
                            Pages[i].Caption     = LastPage.ToString();
                            Pages[i].Value       = LastPage;
                            Pages[i].RouteValues = Merge(new Dictionary <string, object> {
                                { "controller", ControllerName }, { "action", ActionName }, { "Page", LastPage }
                            }, RouteParams, Params);
                        }
                        else if (i == 13)
                        {
                            Pages[i].Caption     = (LastPage - 1).ToString();
                            Pages[i].Value       = LastPage - 1;
                            Pages[i].RouteValues = Merge(new Dictionary <string, object> {
                                { "controller", ControllerName }, { "action", ActionName }, { "Page", LastPage - 1 }
                            }, RouteParams, Params);
                        }
                        else if (i == 12)
                        {
                            Pages[i].Caption = "..";
                        }
                    }
                }
            }

            // добавим предыдущую и следующую странцы. Получится картина такая:
            // ____ ___ ___ ____ ___ ___ ___ ___ ____ ____ ____ ____
            // | << | 1 | 2 | .. | 6 | 7 | 8 | 9 | .. | 14 | 15 | >> |
            //
            PrevPage = CurrentPage - 1;
            if (PrevPage <= 0)
            {
                PrevPage = 1;
            }

            Pages.Insert(0, new Page
            {
                Value       = PrevPage,
                Caption     = "&laquo;",
                Disabled    = PrevPage == CurrentPage,
                RouteValues = Merge(new Dictionary <string, object> {
                    { "controller", ControllerName }, { "action", ActionName }, { "Page", PrevPage }
                }, RouteParams, Params)
            });
            NextPage = CurrentPage + 1;
            if (NextPage >= LastPage)
            {
                NextPage = LastPage;
            }
            Pages.Add(new Page
            {
                Value       = NextPage,
                Caption     = "&raquo;",
                Disabled    = NextPage == LastPage,
                RouteValues = Merge(new Dictionary <string, object> {
                    { "controller", ControllerName }, { "action", ActionName }, { "Page", NextPage }
                }, RouteParams, Params)
            });
        }
Exemplo n.º 30
0
 public override void BuildPage()
 {
     Pages.Add(new TargetPosition());
     Pages.Add(new Education());
     Pages.Add(new WorkHistory());
 }