diff --git a/CampusAppWP8/CampusAppWP8/Pages/Dev/QRScanner.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Dev/QRScanner.xaml.cs index c9057d98..1261966f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Dev/QRScanner.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Dev/QRScanner.xaml.cs @@ -226,7 +226,7 @@ namespace CampusAppWP8.Pages.Dev var result = this.barcodeReader.Decode(this.bit); - if (result != null ) + if (result != null) { Dispatcher.BeginInvoke(delegate { @@ -250,19 +250,24 @@ namespace CampusAppWP8.Pages.Dev } else { - if (BTUTagDefaultHandler.CampusMap == Settings.AppSetting.TagDefaultHandler) + string qrContent = result.Text; + switch (Settings.AppSetting.TagDefaultHandler) { - this.GoToCampusMappage(result.Text); - } - else - { - MessageBoxResult msgResult = MessageBoxes.ShowBtuTagInfoOkCancelMessageBox(result.Text); - if (msgResult.Equals(MessageBoxResult.OK)) - { - string urlString = Constants.PathBTUTag_Info; - Uri url = new Uri(urlString as string, UriKind.Relative); - this.NavigationService.Navigate(url); - } + case BTUTagDefaultHandler.CampusMap: + this.GoToCampusMappage(qrContent); + break; + case BTUTagDefaultHandler.DateCreation: + this.GoToAppointment(qrContent); + break; + default: + MessageBoxResult msgResult = MessageBoxes.ShowBtuTagInfoOkCancelMessageBox(result.Text); + if (msgResult.Equals(MessageBoxResult.OK)) + { + string urlString = Constants.PathBTUTag_Info; + Uri url = new Uri(urlString as string, UriKind.Relative); + this.NavigationService.Navigate(url); + } + break; } } }); @@ -285,6 +290,25 @@ namespace CampusAppWP8.Pages.Dev NavigationService.Navigate(url); } + /// Go to appointment. + /// Fiedler, 15.11.2013. + /// The tag content. + private void GoToAppointment(string tagContent) + { + string pid = Wp8StringManager.FilterPlaceIdinQRResultString(tagContent); + string urlStr = Constants.PathTimeTable_AppointmentEdit + "?" + Constants.ParamPID + "=" + pid; + Uri url = new Uri(urlStr, UriKind.Relative); + + if (this.Dispatcher != null) + { + this.Dispatcher.BeginInvoke(new Action(() => NavigationService.Navigate(url))); + } + else + { + NavigationService.Navigate(url); + } + } + /// Capture thread function. /// fiedlchr, 15.10.2013. private void CaptureThreadFunc() diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 972a122b..e444dcfc 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -217,7 +217,7 @@ namespace CampusAppWP8.Pages //this.ContentPanel.Margin = new Thickness(76, -24, 24, 0); // LandscapeRight //this.ContentPanel.Margin = new Thickness(24, -24, 76, 0); // LandscapeLeft //this.AppTitle.Margin = new Thickness(12, 17, 0, 28); - + if (!this.Row3.Children.Contains(this.MailAppButton) && !this.Row3.Children.Contains(this.OpenHoursAppButton) && !this.Row3.Children.Contains(this.LinkAppButton)) @@ -437,25 +437,25 @@ namespace CampusAppWP8.Pages } else { - this.GoToAppointment(nfcContent); - /* removed for testing - if (AppSettings.BTUTagDefaultHandler.CampusMap == Settings.AppSetting.TagDefaultHandler) + switch (Settings.AppSetting.TagDefaultHandler) { - // search for placeId - this.GoToCampusMappage(nfcContent); + case BTUTagDefaultHandler.CampusMap: + this.GoToCampusMappage(nfcContent); + break; + case BTUTagDefaultHandler.DateCreation: + this.GoToAppointment(nfcContent); + break; + default: + if (this.Dispatcher != null) + { + this.Dispatcher.BeginInvoke(new Action(() => this.ShowBtuTagMessageBox())); + } + else + { + this.ShowBtuTagMessageBox(); + } + break; } - else - { - if (this.Dispatcher != null) - { - this.Dispatcher.BeginInvoke(new Action(() => this.ShowBtuTagMessageBox())); - } - else - { - this.ShowBtuTagMessageBox(); - } - } - */ } this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler);