Merge branch 'cf_eventsnews' into pagesdraft
Conflicts: CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
This commit is contained in:
@@ -98,6 +98,7 @@
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
<Compile Include="model\departments\ChairModel.cs" />
|
||||
<Compile Include="model\departments\DepartmentModel.cs" />
|
||||
<Compile Include="model\departments\DepartmentViewModel.cs" />
|
||||
@@ -118,6 +119,14 @@
|
||||
<Compile Include="pages\mensa\MensaFeed.cs" />
|
||||
<Compile Include="pages\mensa\MensaPage.xaml.cs">
|
||||
<DependentUpon>MensaPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
<Compile Include="pages\news\NewsPage.xaml.cs">
|
||||
<DependentUpon>NewsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\news\RSSItem.cs" />
|
||||
<Compile Include="pages\news\RSSNewsTemplate.xaml.cs">
|
||||
<DependentUpon>RSSNewsTemplate.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\StartPage.xaml.cs">
|
||||
<DependentUpon>StartPage.xaml</DependentUpon>
|
||||
@@ -161,6 +170,7 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</DesignData>
|
||||
|
||||
<Page Include="pages\campusmap\CampusMapPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -177,6 +187,16 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
<Page Include="pages\news\NewsPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="pages\news\RSSNewsTemplate.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
|
||||
<Page Include="pages\StartPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -235,7 +255,9 @@
|
||||
<HintPath>..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup />
|
||||
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -276,6 +276,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die zur Übersicht ähnelt.
|
||||
/// </summary>
|
||||
public static string NewsHomeBtn {
|
||||
get {
|
||||
return ResourceManager.GetString("NewsHomeBtn", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Öffnungszeiten ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -176,6 +176,7 @@
|
||||
<data name="TimeTableApp_Title" xml:space="preserve">
|
||||
<value>Stundenplan</value>
|
||||
</data>
|
||||
<<<<<<< HEAD
|
||||
<data name="LectureApp_Course" xml:space="preserve">
|
||||
<value>Studiengang</value>
|
||||
</data>
|
||||
@@ -226,5 +227,8 @@
|
||||
</data>
|
||||
<data name="MensaApp_NotToday" xml:space="preserve">
|
||||
<value>Heute nicht im Angbot</value>
|
||||
</data>
|
||||
<data name="NewsHomeBtn" xml:space="preserve">
|
||||
<value>zur Übersicht</value>
|
||||
</data>
|
||||
</root>
|
||||
47
CampusAppWP8/CampusAppWP8/pages/news/NewsPage.xaml
Normal file
47
CampusAppWP8/CampusAppWP8/pages/news/NewsPage.xaml
Normal file
@@ -0,0 +1,47 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.pages.news.NewsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<!--Pivotsteuerelement-->
|
||||
<phone:Pivot x:Name="NewsPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}">
|
||||
<!--Pivotelement eins-->
|
||||
<phone:PivotItem Name="NewsPivotHome" Header="{Binding Path=LocalizedResources.NewsApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<ListBox x:Name="ButtonPanel" Grid.Row="1">
|
||||
|
||||
<!-- rows
|
||||
<Button Name="NewsRow01AppButton" Content="Test News Title 01" Click="NewsRow01AppButton_Click" Grid.Row="0" BorderBrush="{x:Null}" Background="{x:Null}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" BorderThickness="0" Padding="0">
|
||||
</Button>
|
||||
-->
|
||||
</ListBox>
|
||||
</phone:PivotItem>
|
||||
|
||||
<!--Pivotelement news template
|
||||
<phone:PivotItem Name="NewsPivot01" Header="(timestamp)">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="90"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock x:Name="NewsHeadline01" Text="(headline)" Grid.Row="0" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="42"/>
|
||||
<TextBlock x:Name="NewsText01" Text="(text)" Grid.Row="1" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="24" />
|
||||
<Button Name="NewsHome" Content="zur News Übersicht" Click="NewsHome_Click" Grid.Row="2" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
</phone:PivotItem>
|
||||
-->
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
</phone:PhoneApplicationPage>
|
||||
106
CampusAppWP8/CampusAppWP8/pages/news/NewsPage.xaml.cs
Normal file
106
CampusAppWP8/CampusAppWP8/pages/news/NewsPage.xaml.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
|
||||
namespace CampusAppWP8.pages.news
|
||||
{
|
||||
public partial class NewsPage : PhoneApplicationPage
|
||||
{
|
||||
List<RSSItem> itemList;
|
||||
|
||||
public NewsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
//
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
this.itemList = new List<RSSItem>();
|
||||
this.itemList.Clear();
|
||||
|
||||
WebClient wc = new WebClient();
|
||||
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(WC_DownloadStringCompleted);
|
||||
|
||||
wc.DownloadStringAsync(new Uri("http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php"));
|
||||
}
|
||||
|
||||
private void WC_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
|
||||
{
|
||||
if (e.Error != null)
|
||||
return;
|
||||
|
||||
int i = 0;
|
||||
|
||||
XElement xmlitems = XElement.Parse(e.Result);
|
||||
|
||||
List<XElement> elements = xmlitems.Descendants("item").ToList();
|
||||
|
||||
|
||||
|
||||
foreach (XElement rssItem in elements)
|
||||
{
|
||||
if(i < 12)
|
||||
{
|
||||
RSSItem rss = new RSSItem();
|
||||
|
||||
rss.Title = rssItem.Element("title").Value;
|
||||
rss.Text = rssItem.Element("description").Value;
|
||||
rss.Timestamp = rssItem.Element("pubDate").Value;
|
||||
|
||||
this.itemList.Add(rss);
|
||||
|
||||
|
||||
Button btn = new Button();
|
||||
btn.Name = "NewsRowAppButton" + i;
|
||||
btn.Content = rss.Title;
|
||||
btn.BorderBrush = null;
|
||||
btn.Background = null;
|
||||
btn.VerticalContentAlignment = VerticalAlignment.Stretch;
|
||||
btn.HorizontalContentAlignment = HorizontalAlignment.Stretch;
|
||||
btn.BorderThickness = new Thickness(0);
|
||||
btn.Padding = new Thickness(0);
|
||||
btn.Click += NewsRowAppButton_Click;
|
||||
btn.Tag = i;
|
||||
|
||||
PivotItem newPivItem = new PivotItem();
|
||||
newPivItem.Name = "NewsPivot" + i;
|
||||
newPivItem.Header = rss.Date;
|
||||
|
||||
RSSNewsTemplate pvContent = new RSSNewsTemplate();
|
||||
pvContent.NewsHeadline.Text = rss.Title;
|
||||
pvContent.NewsText.Text = rss.Text;
|
||||
pvContent.NewsHome.Click += NewsHome_Click;
|
||||
|
||||
newPivItem.Content = pvContent;
|
||||
NewsPivot.Items.Add(newPivItem);
|
||||
|
||||
ButtonPanel.Items.Add(btn);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Button Functions
|
||||
private void NewsRowAppButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button btn = (Button)sender;
|
||||
NewsPivot.SelectedIndex = (int)btn.Tag + 1;
|
||||
}
|
||||
|
||||
private void NewsHome_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
NewsPivot.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
91
CampusAppWP8/CampusAppWP8/pages/news/RSSItem.cs
Normal file
91
CampusAppWP8/CampusAppWP8/pages/news/RSSItem.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CampusAppWP8.pages.news
|
||||
{
|
||||
class RSSItem
|
||||
{
|
||||
private string title;
|
||||
private string text;
|
||||
private DateTime timestamp;
|
||||
|
||||
public string Title
|
||||
{
|
||||
get { return this.title; }
|
||||
set { this.title = value; }
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return this.text; }
|
||||
set { this.text = HTMLUnicodeToString(value); }
|
||||
}
|
||||
|
||||
public string Timestamp
|
||||
{
|
||||
get { return this.timestamp.ToString("R"); }
|
||||
set { this.timestamp = DateTime.Parse(value); }
|
||||
}
|
||||
|
||||
public string Date
|
||||
{
|
||||
get { return String.Format("{0:ddd, dd.MM.yyyy}", this.timestamp); }
|
||||
}
|
||||
|
||||
public string Time
|
||||
{
|
||||
get { return String.Format("{0:h:mm} Uhr", this.timestamp); }
|
||||
}
|
||||
|
||||
private string HTMLUnicodeToString(string htmluni)
|
||||
{
|
||||
StringBuilder retValue = new StringBuilder();
|
||||
|
||||
for(int i = 0; i < htmluni.Length; i++)
|
||||
{
|
||||
switch (htmluni[i])
|
||||
{
|
||||
case '&':
|
||||
{
|
||||
int startOff = i + 2;
|
||||
int endOff = htmluni.IndexOf(';', startOff);
|
||||
string sub = htmluni.Substring(startOff, endOff - startOff);
|
||||
int cVal = int.Parse(sub);
|
||||
|
||||
switch (cVal)
|
||||
{
|
||||
case 128:
|
||||
retValue.Append('€');
|
||||
break;
|
||||
|
||||
default:
|
||||
retValue.Append((char)cVal);
|
||||
break;
|
||||
}
|
||||
|
||||
i = endOff;
|
||||
}
|
||||
break;
|
||||
case '<':
|
||||
{
|
||||
i = htmluni.IndexOf('>', i);
|
||||
}
|
||||
break;
|
||||
case '\t':
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
retValue.Append(htmluni[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml
Normal file
28
CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<UserControl
|
||||
x:Class="CampusAppWP8.pages.news.RSSNewsTemplate"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="90"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock x:Name="NewsHeadline" Text="(headline)" Grid.Row="0" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="42"/>
|
||||
<ScrollViewer Grid.Row="1">
|
||||
<TextBlock x:Name="NewsText" Text="(text)" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="24" />
|
||||
</ScrollViewer>
|
||||
<Button Name="NewsHome" Content="{Binding Path=LocalizedResources.NewsHomeBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="2" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
22
CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml.cs
Normal file
22
CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
namespace CampusAppWP8.pages.news
|
||||
{
|
||||
public partial class RSSNewsTemplate : UserControl
|
||||
{
|
||||
public RSSNewsTemplate()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user