From c3a572c6f642b7de675c186e2be2ff3eb366b30d Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 8 Jul 2013 15:29:01 +0200 Subject: [PATCH] add Qurreystring to navbtn #85 --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 2 +- CampusAppWP8/CampusAppWP8/Const.cs | 33 +++++++ CampusAppWP8/CampusAppWP8/Constantes.cs | 14 --- .../Pages/Lecture/ResultPage.xaml | 69 +++++++------- .../Pages/Lecture/ResultPage.xaml.cs | 12 --- .../Utility/Lui/Button/NavigateButton.cs | 44 +++++++-- .../CampusAppWP8/pages/StartPage.xaml | 46 +++++----- .../CampusAppWP8/pages/StartPage.xaml.cs | 91 ------------------- 8 files changed, 129 insertions(+), 182 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Const.cs delete mode 100644 CampusAppWP8/CampusAppWP8/Constantes.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 0f78c338..66a85f19 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -96,7 +96,7 @@ App.xaml - + diff --git a/CampusAppWP8/CampusAppWP8/Const.cs b/CampusAppWP8/CampusAppWP8/Const.cs new file mode 100644 index 00000000..57cfe428 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Const.cs @@ -0,0 +1,33 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8 +{ + using CampusAppWP8.Resources; + + /// + /// Access to Constants.rex + /// + public class Const + { + /// + /// Resource object. + /// + private static Constants constantResources = new Constants(); + + /// + /// Gets the resource object. + /// + public Constants Constants + { + get + { + return constantResources; + } + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Constantes.cs b/CampusAppWP8/CampusAppWP8/Constantes.cs deleted file mode 100644 index 294f83d0..00000000 --- a/CampusAppWP8/CampusAppWP8/Constantes.cs +++ /dev/null @@ -1,14 +0,0 @@ -using CampusAppWP8.Resources; - -namespace CampusAppWP8 -{ - /// - /// Bietet Zugriff auf Zeichenfolgenressourcen. - /// - public class Const - { - private static Constants _localizedResources = new Constants(); - - public Constants Constants { get { return _localizedResources; } } - } -} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml index 2f369ed6..496745b9 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml @@ -6,6 +6,7 @@ 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" + xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -25,39 +26,41 @@ - - - - - - - - - - + + + + + - - - - + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs index 597812ed..a5256d6b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs @@ -94,17 +94,5 @@ namespace CampusAppWP8.Pages.Lecture Uri url = new Uri(Constants.PathLecture_ModulWebPage + "?" + Constants.ParamModelLecture_ModulNumber + "=" + btn.Tag, UriKind.Relative); NavigationService.Navigate(url); } - - /// - /// Method navigate to DetailPage - /// - /// Caller of the function - /// some EventArgs - private void ShowDetailPage(object sender, RoutedEventArgs e) - { - Button btn = (Button)sender; - Uri url = new Uri(Constants.PathLecture_ResultDetailPage + "?" + Constants.ParamModelLecture_ActivityId + "=" + btn.Tag, UriKind.Relative); - NavigationService.Navigate(url); - } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs index 23d8b2c4..5f76143f 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs @@ -10,11 +10,6 @@ namespace CampusAppWP8.Utility.Lui.Button using System; using System.Windows; using System.Windows.Controls; - using System.Windows.Media.Imaging; - using CampusAppWP8.Resources; - using Microsoft.Phone.Tasks; - using System.Windows.Navigation; - using Microsoft.Phone.Controls; /// /// This class create an Button which start the WebBrowser, which an certain url @@ -28,6 +23,16 @@ namespace CampusAppWP8.Utility.Lui.Button /// public static readonly DependencyProperty NavigateProperty = DependencyProperty.Register("Url", typeof(object), typeof(NavigateButton), new PropertyMetadata(false)); + /// + /// Register the EmailProperty + /// + public static readonly DependencyProperty QueryValueProperty = DependencyProperty.Register("QuerryStringValue", typeof(object), typeof(NavigateButton), new PropertyMetadata(false)); + + /// + /// Register the EmailProperty + /// + public static readonly DependencyProperty QueryNameProperty = DependencyProperty.Register("QuerryStringName", typeof(object), typeof(NavigateButton), new PropertyMetadata(false)); + #endregion #region Constructors @@ -38,7 +43,6 @@ namespace CampusAppWP8.Utility.Lui.Button public NavigateButton() : base() { - } #endregion @@ -54,6 +58,24 @@ namespace CampusAppWP8.Utility.Lui.Button set { this.SetValue(NavigateProperty, value); } } + /// + /// Gets or sets the Url + /// + public object QuerryStringName + { + get { return (object)this.GetValue(QueryNameProperty); } + set { this.SetValue(QueryNameProperty, value); } + } + + /// + /// Gets or sets the Url + /// + public object QuerryStringValue + { + get { return (object)this.GetValue(QueryValueProperty); } + set { this.SetValue(QueryValueProperty, value); } + } + #endregion #region Methods @@ -62,11 +84,17 @@ namespace CampusAppWP8.Utility.Lui.Button /// Overrides the OnClick-Method from button /// /// - /// now method navigate to a certainpage + /// now method navigate to a certain page /// protected override void OnClick() { - Uri url = new Uri(this.Url as string, UriKind.Relative); + string urlString = this.Url as string; + + if (this.QuerryStringName != null && this.QuerryStringValue != null) + { + urlString += "?" + this.QuerryStringName + "=" + this.QuerryStringValue; + } + Uri url = new Uri(urlString as string, UriKind.Relative); Page page = App.RootFrame.Content as Page; page.NavigationService.Navigate(url); } diff --git a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml index 1436b53f..2e284353 100644 --- a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml +++ b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml @@ -43,87 +43,87 @@ - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs index ee7a5538..f5cc8301 100644 --- a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs @@ -25,9 +25,6 @@ namespace CampusAppWP8.Pages public StartPage() { this.InitializeComponent(); - - // if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible) - // this.SetIconThemeToDark(); } /// @@ -64,93 +61,5 @@ namespace CampusAppWP8.Pages ContentPanel.Margin = new Thickness(12, 0, 0, 0); } } - - /// - /// start the LectureApp - /// - /// Caller of the function - /// some EventArgs - private void OpenLectureApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathLecture_LecturePage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// start the NewsApp - /// - /// Caller of the function - /// some EventArgs - private void OpenNewsApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathNews_NewsIndexPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// start the EventsApp - /// - /// Caller of the function - /// some EventArgs - private void OpenEventsApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathEvents_EventsIndexPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// start the MensaApp - /// - /// Caller of the function - /// some EventArgs - private void OpenMensaApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathMensa_MensaPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// start the WebmailApp - /// - /// Caller of the function - /// some EventArgs - private void OpenWebMailApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathMail_WebMailPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// Opens the opening hours page. - /// - /// opening hours button - /// event args - private void OpenOpeninghoursApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathOpeninghours_OpeninghoursPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// Opens the Linkpage. - /// - /// link button - /// event args - private void OpenLinkApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathLinks_LinkPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// Opens the StudentCouncilpage. - /// - /// link button - /// event args - private void OpenStudentCouncilApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathStudentCouncil_StudentCouncilPage, UriKind.Relative); - NavigationService.Navigate(url); - } } } \ No newline at end of file