Skip to content

Commit

Permalink
Merge pull request #9 from xiaoyaocz/bugfix_livepage
Browse files Browse the repository at this point in the history
修复直播页面无法读取信息的Bug
  • Loading branch information
ThomasWFan authored Nov 22, 2016
2 parents 5da2b0a + 84527aa commit edd7d27
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 61 deletions.
4 changes: 2 additions & 2 deletions bilibili2/BundleArtifacts/x86.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MainPackage=E:\UWP\bilibili2\bilibili2\bin\x86\Release\bilibili2_2.7.8.0_x86.appx
SymbolPackage=E:\UWP\bilibili2\bilibili2\AppPackages\bilibili2_2.7.8.0_Test\bilibili2_2.7.8.0_x86.appxsym
MainPackage=C:\Users\Thoma\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\bin\x86\Debug\bilibili2_2.7.8.0_x86_Debug.appx
SymbolPackage=C:\Users\Thoma\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\AppPackages\bilibili2_2.7.8.0_Debug_Test\bilibili2_2.7.8.0_x86_Debug.appxsym
14 changes: 7 additions & 7 deletions bilibili2/Controls/MyLiveControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@
</HyperlinkButton>
<GridView x:Name="gridview_Hot" Visibility="Collapsed" ItemClick="gridview_Hot_ItemClick" HorizontalAlignment="Center" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource GridItem}" ItemContainerStyle="{StaticResource itemStyle}" SelectionMode="None" IsItemClickEnabled="True">
</GridView>
<HyperlinkButton Visibility="Collapsed" Foreground="{ThemeResource Bili-FontColor}" >
<HyperlinkButton Foreground="{ThemeResource Bili-FontColor}" >
<StackPanel Orientation="Horizontal">
<Border Background="{ThemeResource Bili-ForeColor}" Width="10" Height="24" Margin="5,0"/>
<TextBlock Text="萌宅推荐" FontSize="16" VerticalAlignment="Center" />
<TextBlock Text="手机直播" FontSize="16" VerticalAlignment="Center" />
</StackPanel>
</HyperlinkButton>
<GridView x:Name="gridview_MZ" Visibility="Collapsed" ItemClick="gridview_Hot_ItemClick" HorizontalAlignment="Center" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource GridItem}" ItemContainerStyle="{StaticResource itemStyle}" SelectionMode="None" IsItemClickEnabled="True"></GridView>
<HyperlinkButton Foreground="{ThemeResource Bili-FontColor}" >
<GridView x:Name="gridview_SJ" ItemClick="gridview_Hot_ItemClick" HorizontalAlignment="Center" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource GridItem}" ItemContainerStyle="{StaticResource itemStyle}" SelectionMode="None" IsItemClickEnabled="True"></GridView>
<HyperlinkButton Foreground="{ThemeResource Bili-FontColor}" >
<StackPanel Orientation="Horizontal">
<Border Background="{ThemeResource Bili-ForeColor}" Width="10" Height="24" Margin="5,0"/>
<TextBlock Text="手机直播" FontSize="16" VerticalAlignment="Center" />
<TextBlock Text="手游直播" FontSize="16" VerticalAlignment="Center" />
</StackPanel>
</HyperlinkButton>
<GridView x:Name="gridview_SJ" ItemClick="gridview_Hot_ItemClick" HorizontalAlignment="Center" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource GridItem}" ItemContainerStyle="{StaticResource itemStyle}" SelectionMode="None" IsItemClickEnabled="True"></GridView>
<GridView x:Name="gridview_SY" ItemClick="gridview_Hot_ItemClick" HorizontalAlignment="Center" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource GridItem}" ItemContainerStyle="{StaticResource itemStyle}" SelectionMode="None" IsItemClickEnabled="True"></GridView>
<HyperlinkButton Foreground="{ThemeResource Bili-FontColor}" >
<StackPanel Orientation="Horizontal">
<Border Background="{ThemeResource Bili-ForeColor}" Width="10" Height="24" Margin="5,0"/>
Expand All @@ -99,7 +99,7 @@
<HyperlinkButton Foreground="{ThemeResource Bili-FontColor}" >
<StackPanel Orientation="Horizontal">
<Border Background="{ThemeResource Bili-ForeColor}" Width="10" Height="24" Margin="5,0"/>
<TextBlock Text="单机联网" FontSize="16" VerticalAlignment="Center" />
<TextBlock Text="单机联机" FontSize="16" VerticalAlignment="Center" />
</StackPanel>
</HyperlinkButton>
<GridView x:Name="gridview_DJ" ItemClick="gridview_Hot_ItemClick" HorizontalAlignment="Center" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemTemplate="{StaticResource GridItem}" ItemContainerStyle="{StaticResource itemStyle}" SelectionMode="None" IsItemClickEnabled="True"></GridView>
Expand Down
98 changes: 48 additions & 50 deletions bilibili2/Controls/MyLiveControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public MyLiveControl()
public delegate void PlayHandler(string aid);
public event PlayHandler PlayEvent;
public event PlayHandler ErrorEvent;
public bool isLoaded= false;
public bool isLoaded = false;
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (this.ActualWidth <= 500)
Expand All @@ -39,8 +39,8 @@ private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
gridview_FY.Height = d;
gridview_HH.Height = d;
gridview_JJ.Height = d;
gridview_MZ.Height = d;
//gridview_SH.Height = d;
//gridview_MZ.Height = d;
gridview_SY.Height = d;
gridview_WL.Height = d;
gridview_YZ.Height = d;
gridview_SJ.Height = d;
Expand All @@ -58,8 +58,8 @@ private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
gridview_FY.Height = d;
gridview_HH.Height = d;
gridview_JJ.Height = d;
gridview_MZ.Height = d;
//gridview_SH.Height = d;
//gridview_MZ.Height = d;
gridview_SY.Height = d;
gridview_WL.Height = d;
gridview_YZ.Height = d;
gridview_SJ.Height = d;
Expand All @@ -75,11 +75,11 @@ private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
gridview_FY.Height = d;
gridview_HH.Height = d;
gridview_JJ.Height = d;
gridview_MZ.Height = d;
//gridview_SH.Height = d;
//gridview_MZ.Height = d;
gridview_SY.Height = d;
gridview_WL.Height = d;
gridview_YZ.Height = d;
gridview_SJ .Height= d;
gridview_SJ.Height = d;
gridview_CW.Height = d;
}
}
Expand All @@ -96,13 +96,13 @@ public async void GetLiveInfo()
gridview_FY.Items.Clear();
gridview_HH.Items.Clear();
gridview_JJ.Items.Clear();
gridview_MZ.Items.Clear();
//gridview_SH.Items.Clear();
//gridview_MZ.Items.Clear();
gridview_SY.Items.Clear();
gridview_WL.Items.Clear();
gridview_YZ.Items.Clear();
gridview_CW.Items.Clear();
WebClientClass wc = new WebClientClass();
string url = string.Format("http://live.bilibili.com/AppIndex/home?_device=wp&_ulv=10000&access_key={0}&appkey={1}&build=411005&platform=android&scale=xxhdpi&rnd={2}", ApiHelper.access_key, ApiHelper._appKey,new Random().Next(1,9999));
string url = string.Format("http://live.bilibili.com/AppIndex/home?_device=wp&_ulv=10000&access_key={0}&appkey={1}&build=411005&platform=android&scale=xxhdpi&rnd={2}", ApiHelper.access_key, ApiHelper._appKey, new Random().Next(1, 9999));
url += "&sign=" + ApiHelper.GetSign(url);
string results = await wc.GetResults(new Uri(url));
HomeLiveModel model = JsonConvert.DeserializeObject<HomeLiveModel>(results);
Expand All @@ -116,20 +116,20 @@ public async void GetLiveInfo()
List<HomeLiveModel> livesModel = JsonConvert.DeserializeObject<List<HomeLiveModel>>(item.lives.ToString());
switch (partitionModel.name)
{
case "热门直播":
for (int i = 0; i < 12; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
livesModel[i].src = coverModel.src;
livesModel[i].name = ownerModel.name;
livesModel[i].mid = ownerModel.mid;
livesModel[i].face = ownerModel.face;
gridview_Hot.Items.Add(livesModel[i]);
}
break;
//case "热门直播":
// for (int i = 0; i < livesModel.Count; i++)
// {
// HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
// HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
// livesModel[i].src = coverModel.src;
// livesModel[i].name = ownerModel.name;
// livesModel[i].mid = ownerModel.mid;
// livesModel[i].face = ownerModel.face;
// gridview_Hot.Items.Add(livesModel[i]);
// }
// break;
case "手机直播":
for (int i = 0; i < livesModel.Count - 1; i++)
for (int i = 0; i < livesModel.Count; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
Expand All @@ -141,7 +141,7 @@ public async void GetLiveInfo()
}
break;
case "唱见舞见":
for (int i = 0; i < livesModel.Count - 1; i++)
for (int i = 0; i < livesModel.Count; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
Expand All @@ -152,20 +152,20 @@ public async void GetLiveInfo()
gridview_CW.Items.Add(livesModel[i]);
}
break;
case "萌宅推荐":
for (int i = 0; i < livesModel.Count - 1; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
livesModel[i].src = coverModel.src;
livesModel[i].name = ownerModel.name;
livesModel[i].mid = ownerModel.mid;
livesModel[i].face = ownerModel.face;
gridview_MZ.Items.Add(livesModel[i]);
}
break;
//case "萌宅推荐":
// for (int i = 0; i < livesModel.Count; i++)
// {
// HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
// HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
// livesModel[i].src = coverModel.src;
// livesModel[i].name = ownerModel.name;
// livesModel[i].mid = ownerModel.mid;
// livesModel[i].face = ownerModel.face;
// gridview_MZ.Items.Add(livesModel[i]);
// }
// break;
case "绘画专区":
for (int i = 0; i < livesModel.Count-1; i++)
for (int i = 0; i < livesModel.Count - 1; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
Expand All @@ -177,7 +177,7 @@ public async void GetLiveInfo()
}
break;
case "御宅文化":
for (int i = 0; i < 12; i++)
for (int i = 0; i < livesModel.Count; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
Expand All @@ -188,20 +188,20 @@ public async void GetLiveInfo()
gridview_YZ.Items.Add(livesModel[i]);
}
break;
case "生活娱乐":
for (int i = 0; i < 12; i++)
case "手游直播":
for (int i = 0; i < livesModel.Count; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
livesModel[i].src = coverModel.src;
livesModel[i].name = ownerModel.name;
livesModel[i].mid = ownerModel.mid;
livesModel[i].face = ownerModel.face;
//gridview_SH.Items.Add(livesModel[i]);
gridview_SY.Items.Add(livesModel[i]);
}
break;
case "单机联机":
for (int i = 0; i < 12; i++)
for (int i = 0; i < livesModel.Count; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
Expand All @@ -213,7 +213,7 @@ public async void GetLiveInfo()
}
break;
case "网络游戏":
for (int i = 0; i < 12; i++)
for (int i = 0; i < livesModel.Count; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
Expand All @@ -225,7 +225,7 @@ public async void GetLiveInfo()
}
break;
case "电子竞技":
for (int i = 0; i < 12; i++)
for (int i = 0; i < livesModel.Count; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
Expand All @@ -237,7 +237,7 @@ public async void GetLiveInfo()
}
break;
case "放映厅":
for (int i = 0; i < 12; i++)
for (int i = 0; i < livesModel.Count; i++)
{
HomeLiveModel ownerModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].owner.ToString());
HomeLiveModel coverModel = JsonConvert.DeserializeObject<HomeLiveModel>(livesModel[i].cover.ToString());
Expand All @@ -248,8 +248,6 @@ public async void GetLiveInfo()
gridview_FY.Items.Add(livesModel[i]);
}
break;
default:
break;
}
}
isLoaded = true;
Expand All @@ -259,11 +257,11 @@ public async void GetLiveInfo()
ErrorEvent("读取直播失败" + model.message);
isLoaded = false;
}
}
}
catch (Exception ex)
{
ErrorEvent("读取直播失败" + ex.Message);
isLoaded = false;
isLoaded = false;
}
finally
{
Expand Down
4 changes: 2 additions & 2 deletions bilibili2/bilibili2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>bilibili2_StoreKey.pfx</PackageCertificateKeyFile>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxBundle>Always</AppxBundle>
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<AppxBundlePlatforms>x86</AppxBundlePlatforms>
<PackageCertificateThumbprint>D654141A85F7BAB9F0513747AE2ABE0E1A35EB76</PackageCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
Expand Down

0 comments on commit edd7d27

Please sign in to comment.