Click here to Skip to main content
15,881,967 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi I have different html pages in my app that i will like to view locally in my app the code below can only view single html page but what i want is To display different
html pages according to date of the month in a webview
This is my code below
xaml
XML
<!--ContentPanel - place additional content here-->
        <grid x:name="ContentPanel" grid.row="1" margin="12,0,12,0" xmlns:x="#unknown">
            <phone:webbrowser horizontalalignment="Left" margin="20,50,0,0" name="webBrowser1" verticalalignment="Top" height="500" width="430" xmlns:phone="#unknown" />
        </grid>
xaml.cs
C#
public partial class MainPage : PhoneApplicationPage
    {
        private List<string> htmls;

        private int CurrentIndex = 0;

        private int TotalCount = 0;
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();

            this.Loaded += MainPage_Loaded;
        }

        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            htmls = new List<string>() { "/Bible/hymnpage1.html", "/Bible/hymnpage2.html", "/Bible/hymnpage3.html", "/Bible/1_1_2016.html" };
            TotalCount = htmls.Count;
            if (TotalCount != 0)

            {
                webBrowser1.Navigate(new Uri(htmls[CurrentIndex], UriKind.Relative));
            }

        }

        private void Previous_Click(object sender, EventArgs e)
        {
            if (CurrentIndex != 0)
            {
                CurrentIndex--;
            }

            webBrowser1.Navigate(new Uri(htmls[CurrentIndex], UriKind.Relative));
        }

        private void Next_Click(object sender, EventArgs e)
        {
            if (CurrentIndex != TotalCount - 1)
            {
                CurrentIndex++;
            }

            webBrowser1.Navigate(new Uri(htmls[CurrentIndex], UriKind.Relative));
        }
Kindly help

What I have tried:

Have tried other developer forums there was no direct solution given
Posted
Updated 6-Mar-16 6:41am
v2

1 solution

The DateTime class stores date informations. It has properties like, Year, Month, Day, Hour, Minute, Seconds. DateTime.Now returns the current date and time. Is there any particular reason for not using it for the selection from your array of html files ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900