C# 如何在windows phone 8的网络视图中根据每月的日期和时间显示不同的html页面:
我的应用程序中有366个html页面,一年中某一天的每个html页面,我想在我的应用程序中本地查看。下面的代码只能查看单个html页面,但我想在网络视图中根据每月的日期显示每天不同的html页面,即如果用户在2016年2月3日打开应用程序,则应用程序应打开develation62.html哪一天是一年中的第62天 下面是我的代码 XAMLC# 如何在windows phone 8的网络视图中根据每月的日期和时间显示不同的html页面:,c#,windows-phone-8,winrt-xaml,C#,Windows Phone 8,Winrt Xaml,我的应用程序中有366个html页面,一年中某一天的每个html页面,我想在我的应用程序中本地查看。下面的代码只能查看单个html页面,但我想在网络视图中根据每月的日期显示每天不同的html页面,即如果用户在2016年2月3日打开应用程序,则应用程序应打开develation62.html哪一天是一年中的第62天 下面是我的代码 XAML XAML.CS public partial class MainPage : PhoneApplicationPage { pr
XAML.CS
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/devotion60.html", "/Bible/devotion61.html", "/Bible/devotion62.html", "/Bible/devotion63.html" };//List of string will contain all the 366 html files path
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));
}
public部分类主页:PhoneApplicationPage
{
私有列表htmls;
私有int CurrentIndex=0;
私有整数TotalCount=0;
//建造师
公共主页()
{
初始化组件();
//本地化ApplicationBar的示例代码
//BuildLocalizedApplicationBar();
this.Loaded+=主页面_Loaded;
}
已加载私有void主页(对象发送方、路由目标)
{
htmls=new List(){“/Bible/develation60.html”、“/Bible/develation61.html”、“/Bible/develation62.html”、“/Bible/develation63.html”};//字符串列表将包含所有366个html文件路径
TotalCount=htmls.Count;
如果(TotalCount!=0)
{
导航(新Uri(htmls[CurrentIndex],UriKind.Relative));
}
}
私有无效上一次单击(对象发送者,事件参数e)
{
如果(CurrentIndex!=0)
{
当前索引--;
}
导航(新Uri(htmls[CurrentIndex],UriKind.Relative));
}
私有无效下一次单击(对象发送者,事件参数e)
{
如果(CurrentIndex!=TotalCount-1)
{
CurrentIndex++;
}
导航(新Uri(htmls[CurrentIndex],UriKind.Relative));
}
在加载的主页面中添加以下代码
CurrentIndex = DateTime.Now.DayOfYear;
那么,你的问题是什么呢?我面临的挑战是如何编写代码来根据每月的日期显示html页面,我已经尝试过编写它,但没有成功
CurrentIndex = DateTime.Now.DayOfYear;