From 5605491ea98d83fd9e2922cfaab6131fba3898be Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Tue, 19 Nov 2013 13:17:24 +0100 Subject: [PATCH 01/26] a --- .../Pages/Campusmap/RoomListPage.xaml | 49 ++++++----- .../Pages/Campusmap/RoomListPage.xaml.cs | 85 +++++++++++++++++-- .../Resources/AppResources.Designer.cs | 18 ++++ .../CampusAppWP8/Resources/AppResources.resx | 6 ++ .../CampusAppWP8/Resources/Constants.resx | 3 + .../Resources/Constants1.Designer.cs | 9 ++ 6 files changed, 143 insertions(+), 27 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml index ac0bb7cd..257cb480 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml @@ -9,6 +9,7 @@ xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" + xmlns:lu="clr-namespace:CampusAppWP8.Utility.Lui" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -22,22 +23,46 @@ + - + + - - + + + - + + + + + + + + + + @@ -46,24 +71,10 @@ - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs index 69fb12ef..3bee41eb 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs @@ -62,6 +62,19 @@ namespace CampusAppWP8.Pages.Campusmap public RoomListPage() { this.InitializeComponent(); + + ApplicationBarIconButton btnZoomIn = new ApplicationBarIconButton(); + btnZoomIn.IconUri = new Uri(Icons.Info, UriKind.Relative); + btnZoomIn.Text = AppResources.ZoomIn; + btnZoomIn.Click += this.BtnZoomIn_Click; + + ApplicationBarIconButton btnZoomOut = new ApplicationBarIconButton(); + btnZoomOut.IconUri = new Uri(Icons.Info, UriKind.Relative); + btnZoomOut.Text = AppResources.ZoomOut; + btnZoomOut.Click += this.BtnZoomOut_Click; + + this.ApplicationBar.Buttons.Add(btnZoomIn); + this.ApplicationBar.Buttons.Add(btnZoomOut); } #endregion @@ -75,8 +88,12 @@ namespace CampusAppWP8.Pages.Campusmap set { - this.selectedLayer = value; - this.LayerTag.Text = value; + if (this.selectedLayer != value) + { + this.selectedLayer = value; + this.LayerTag.Text = value; + this.UpdateRoomList(value); + } } } @@ -380,6 +397,10 @@ namespace CampusAppWP8.Pages.Campusmap Canvas.SetZIndex(this.imgMap, 0); } + /// Raises the system. event. + /// Fiedler, 18.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnMenuItemClicked(object sender, System.EventArgs e) { if (this.SelectedLayer.Equals((sender as ApplicationBarMenuItem).Text) == false) @@ -423,10 +444,9 @@ namespace CampusAppWP8.Pages.Campusmap /// Event handler. Called by ZoomIn for tap events. /// Fiedler, 15.11.2013. /// Source of the event. - /// Gesture event information. - private void ZoomIn_Tap(object sender, System.Windows.Input.GestureEventArgs e) + /// Event information. + private void BtnZoomIn_Click(object sender, EventArgs e) { - //throw new NotImplementedException("TODO"); (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX *= 1.5; (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY *= 1.5; } @@ -434,14 +454,63 @@ namespace CampusAppWP8.Pages.Campusmap /// Event handler. Called by ZoomOut for tap events. /// Fiedler, 15.11.2013. /// Source of the event. - /// Gesture event information. - private void ZoomOut_Tap(object sender, System.Windows.Input.GestureEventArgs e) + /// Event information. + private void BtnZoomOut_Click(object sender, EventArgs e) { - //throw new NotImplementedException("TODO"); (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX /= 1.5; (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY /= 1.5; } + /// Searches for the first room. + /// Fiedler, 18.11.2013. + /// Source of the event. + /// Event information. + private void SearchRoom(object sender, EventArgs e) + { + this.RoomPicker.Open(); + } + + /// Updates the room list described by level. + /// Fiedler, 18.11.2013. + /// The level. + private void UpdateRoomList(string level) + { + CampusBuildingLayerModel layer = this.building.Layers[level]; + this.RoomPicker.Items.Clear(); + + foreach (PlaceModel room in layer.Rooms.Places) + { + if(room.GetInformationsValue(Constants.PisInformationName_Typ).Equals(Constants.PisInformationValue_Entrance) == false) + { + if (room.GetInformationsValue(Constants.PisInformationName_Room).Equals(room.GetInformationsValue(Constants.PisInformationName_Name)) == false) + { + string newStr = room.GetInformationsValue(Constants.PisInformationName_Room) + ", " + room.GetInformationsValue(Constants.PisInformationName_Name); + this.RoomPicker.Items.Add(newStr); + } + else + { + this.RoomPicker.Items.Add(room.GetInformationsValue(Constants.PisInformationName_Room)); + } + } + } + } + #endregion + + /// Event handler. Called by RoomPicker for selection changed events. + /// Fiedler, 18.11.2013. + /// Source of the event. + /// Selection changed event information. + private void RoomPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + MapPoint pos = new MapPoint(); + + pos.X = room.GeoRefPoint.Longitude; + pos.Y = room.GeoRefPoint.Latitude; + MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y))); + MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint; + + MapCanvas.Children.Add(this.buildingMap.AddPin(pos, PinType.SearchPlace)); + } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 1defd00d..46d43bdd 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1553,5 +1553,23 @@ namespace CampusAppWP8.Resources { return ResourceManager.GetString("When", resourceCulture); } } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Zoom + ähnelt. + /// + public static string ZoomIn { + get { + return ResourceManager.GetString("ZoomIn", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Zoom - ähnelt. + /// + public static string ZoomOut { + get { + return ResourceManager.GetString("ZoomOut", resourceCulture); + } + } } } diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 4d494990..37c797e4 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -617,4 +617,10 @@ Wochenplan + + Zoom + + + + Zoom - + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index a7a62d34..514a9671 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -609,4 +609,7 @@ http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1 + + Zugangsbereich + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index ea41e3aa..be6e354f 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -1239,6 +1239,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Zugangsbereich ähnelt. + /// + public static string PisInformationValue_Entrance { + get { + return ResourceManager.GetString("PisInformationValue_Entrance", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die pid ähnelt. /// From 37460f155582045b069c0e5223d9c661eb446dd1 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Fri, 22 Nov 2013 20:57:17 +0100 Subject: [PATCH 02/26] #243 done --- CampusAppWP8/CampusAppWP8/App.xaml | 1 - CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 10 +- .../Pages/Campusmap/RoomListPage.xaml | 81 +++++--- .../Pages/Campusmap/RoomListPage.xaml.cs | 144 +++++++++++--- .../Pages/Openinghours/OpeninghoursPage.xaml | 6 +- .../Resources/AppResources.Designer.cs | 9 + .../CampusAppWP8/Resources/AppResources.resx | 4 + .../CampusAppWP8/Resources/Constants.resx | 1 + .../BoolToVisibilityConverter.cs | 2 +- .../FrameworkElementToRectConverter.cs | 28 +++ .../{ => Converter}/IdToPlaceConverter.cs | 2 +- .../{ => Converter}/MealIdToPriceConverter.cs | 2 +- .../Converter/RoomToStringConverter.cs | 67 +++++++ .../Utility/DoubleNaNConverter.cs | 22 --- .../Utility/Lui/MultiValueTextBlock.xaml | 5 - .../Utility/Lui/MultiValueTextBlock.xaml.cs | 178 ++++++++++++++++-- .../Utility/Lui/Templates/WeekView.xaml | 2 +- .../Utility/Lui/Templates/WeekViewDay.xaml | 4 +- .../Utility/Lui/Templates/WeekViewDay.xaml.cs | 1 + 19 files changed, 468 insertions(+), 101 deletions(-) rename CampusAppWP8/CampusAppWP8/Utility/{ => Converter}/BoolToVisibilityConverter.cs (97%) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Converter/FrameworkElementToRectConverter.cs rename CampusAppWP8/CampusAppWP8/Utility/{ => Converter}/IdToPlaceConverter.cs (99%) rename CampusAppWP8/CampusAppWP8/Utility/{ => Converter}/MealIdToPriceConverter.cs (98%) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Converter/RoomToStringConverter.cs delete mode 100644 CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs diff --git a/CampusAppWP8/CampusAppWP8/App.xaml b/CampusAppWP8/CampusAppWP8/App.xaml index 282eda77..a4aef1d3 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml +++ b/CampusAppWP8/CampusAppWP8/App.xaml @@ -16,7 +16,6 @@ - diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 14b52676..891e313e 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -155,7 +155,9 @@ TimeTableWeek.xaml - + + + @@ -239,9 +241,9 @@ - + - + @@ -266,7 +268,7 @@ WeekViewDay.xaml - + NFC.xaml diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml index 257cb480..04463450 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml @@ -10,6 +10,7 @@ xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" xmlns:lu="clr-namespace:CampusAppWP8.Utility.Lui" + xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -18,6 +19,14 @@ shell:SystemTray.IsVisible="True" x:Name="root"> + + + + + + + + @@ -26,10 +35,13 @@ + + - + + @@ -48,30 +60,53 @@ Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs index 3bee41eb..6bcc3ac9 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs @@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.Campusmap { using System; using System.Collections.Generic; + using System.Collections.ObjectModel; using System.Linq; using System.Windows; using System.Windows.Controls; @@ -51,8 +52,19 @@ namespace CampusAppWP8.Pages.Campusmap /// The offset point. private MapPoint offsetPoint; + /// The selected layer. private string selectedLayer = string.Empty; + /// List of room pickers. + private ObservableCollection roomPickerList = new ObservableCollection(); + /// The view bounds. + private Rect viewBounds = new Rect(); + + /// The marker pin. + private UIElement markerPin = null; + /// The canvas scale. + private double canvasScale = 1.0; + #endregion #region Constructor @@ -79,6 +91,8 @@ namespace CampusAppWP8.Pages.Campusmap #endregion + /// Gets or sets the selected layer. + /// The selected layer. private string SelectedLayer { get @@ -97,6 +111,21 @@ namespace CampusAppWP8.Pages.Campusmap } } + /// Gets or sets a list of room pickers. + /// A List of room pickers. + public ObservableCollection RoomPickerList + { + get + { + return this.roomPickerList; + } + + set + { + this.roomPickerList = value; + } + } + #region Method #region protected @@ -187,7 +216,7 @@ namespace CampusAppWP8.Pages.Campusmap x = room.GeoRefPoint.Longitude; y = room.GeoRefPoint.Latitude; MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y))); - MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint; + MapPoint viewPoint = roompoint + this.offsetPoint; //- this.mappoint MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, PinType.InfoRedPlace, new List { room })); } @@ -337,7 +366,7 @@ namespace CampusAppWP8.Pages.Campusmap x = room.GeoRefPoint.Longitude; y = room.GeoRefPoint.Latitude; MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y))); - MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint; + MapPoint viewPoint = roompoint + this.offsetPoint; // -this.mappoint; PinType type; @@ -392,9 +421,9 @@ namespace CampusAppWP8.Pages.Campusmap this.MapCanvas.DataContext = this.buildingMap; - Canvas.SetLeft(this.imgMap, -1 * this.mappoint.X); - Canvas.SetTop(this.imgMap, -1 * this.mappoint.Y); - Canvas.SetZIndex(this.imgMap, 0); + //Canvas.SetLeft(this.imgMap, -1 * this.mappoint.X); + //Canvas.SetTop(this.imgMap, -1 * this.mappoint.Y); + //Canvas.SetZIndex(this.imgMap, 0); } /// Raises the system. event. @@ -447,8 +476,19 @@ namespace CampusAppWP8.Pages.Campusmap /// Event information. private void BtnZoomIn_Click(object sender, EventArgs e) { - (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX *= 1.5; - (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY *= 1.5; + if (this.canvasScale >= 3) + { + return; + } + else + { + this.canvasScale *= 1.1; + } + + (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX = this.canvasScale; + (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY = this.canvasScale; + + this.ReCalcBounds(); } /// Event handler. Called by ZoomOut for tap events. @@ -457,8 +497,36 @@ namespace CampusAppWP8.Pages.Campusmap /// Event information. private void BtnZoomOut_Click(object sender, EventArgs e) { - (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX /= 1.5; - (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY /= 1.5; + double tempW = (this.MapCanvas.ActualWidth / this.VPC.ActualWidth); + double tempH = (this.MapCanvas.ActualHeight / this.VPC.ActualHeight); + + if (tempW == 1 || tempH == 1) + { + return; + } + else if ((this.MapCanvas.ActualWidth * this.canvasScale * 0.95) < this.VPC.ActualWidth || (this.MapCanvas.ActualHeight * this.canvasScale * 0.95) < this.VPC.ActualHeight) + { + tempW = (this.VPC.ActualWidth / this.MapCanvas.ActualWidth); + tempH = (this.VPC.ActualHeight / this.MapCanvas.ActualHeight); + + if (tempH < tempW) + { + this.canvasScale = tempW; + } + else + { + this.canvasScale = tempH; + } + } + else + { + this.canvasScale *= 0.95; + } + + (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX = this.canvasScale; + (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY = this.canvasScale; + + this.ReCalcBounds(); } /// Searches for the first room. @@ -476,21 +544,13 @@ namespace CampusAppWP8.Pages.Campusmap private void UpdateRoomList(string level) { CampusBuildingLayerModel layer = this.building.Layers[level]; - this.RoomPicker.Items.Clear(); + this.roomPickerList.Clear(); foreach (PlaceModel room in layer.Rooms.Places) { if(room.GetInformationsValue(Constants.PisInformationName_Typ).Equals(Constants.PisInformationValue_Entrance) == false) { - if (room.GetInformationsValue(Constants.PisInformationName_Room).Equals(room.GetInformationsValue(Constants.PisInformationName_Name)) == false) - { - string newStr = room.GetInformationsValue(Constants.PisInformationName_Room) + ", " + room.GetInformationsValue(Constants.PisInformationName_Name); - this.RoomPicker.Items.Add(newStr); - } - else - { - this.RoomPicker.Items.Add(room.GetInformationsValue(Constants.PisInformationName_Room)); - } + this.roomPickerList.Add(room); } } } @@ -503,14 +563,48 @@ namespace CampusAppWP8.Pages.Campusmap /// Selection changed event information. private void RoomPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { - MapPoint pos = new MapPoint(); + if (e.AddedItems != null && e.AddedItems.Count > 0 && e.RemovedItems != null && e.RemovedItems.Count > 0) + { + if (this.markerPin != null) + { + this.MapCanvas.Children.Remove(this.markerPin); + } - pos.X = room.GeoRefPoint.Longitude; - pos.Y = room.GeoRefPoint.Latitude; - MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y))); - MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint; + PlaceModel room = e.AddedItems[0] as PlaceModel; + MapPoint viewPoint + = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(room.GeoRefPoint.Longitude, room.GeoRefPoint.Latitude))) + + this.offsetPoint; - MapCanvas.Children.Add(this.buildingMap.AddPin(pos, PinType.SearchPlace)); + this.markerPin = this.buildingMap.AddPin(viewPoint, PinType.InfoRedPlace); + + this.MapCanvas.Children.Add(this.markerPin); + } + } + + /// Event handler. Called by MapCanvas for size changed events. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Size changed event information. + private void MapCanvas_SizeChanged(object sender, SizeChangedEventArgs e) + { + this.ReCalcBounds(); + this.VPC.SetViewportOrigin(new Point(this.mappoint.X, this.mappoint.Y)); + } + + /// Re calculate bounds. + /// Fiedler, 22.11.2013. + private void ReCalcBounds() + { + this.viewBounds.Width = this.MapCanvas.RenderSize.Width * (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX; + this.viewBounds.Height = this.MapCanvas.RenderSize.Height * (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY; + + Point newPos = new Point(); + newPos.X = this.VPC.Viewport.X + ((this.viewBounds.Width - this.VPC.Bounds.Width) * 0.5); + newPos.Y = this.VPC.Viewport.Y + ((this.viewBounds.Height - this.VPC.Bounds.Height) * 0.5); + + this.VPC.Bounds = this.viewBounds; + + this.VPC.SetViewportOrigin(newPos); } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml index f5e7f4bf..30588de8 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml @@ -9,7 +9,7 @@ xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page" - xmlns:utility="clr-namespace:CampusAppWP8.Utility" + xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -18,8 +18,8 @@ shell:SystemTray.IsVisible="True"> - - + + diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 0006ab52..47c3c85a 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1158,6 +1158,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Räume ähnelt. + /// + public static string Rooms { + get { + return ResourceManager.GetString("Rooms", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Beispielwert für die Laufzeiteigenschaft ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 6201f774..b8452a9c 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -622,10 +622,14 @@ Zoom - + Termin erstellen Veranstaltungstermine + + Räume + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 01a020aa..bcad4e3a 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -611,6 +611,7 @@ Zugangsbereich + isolated diff --git a/CampusAppWP8/CampusAppWP8/Utility/BoolToVisibilityConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/BoolToVisibilityConverter.cs similarity index 97% rename from CampusAppWP8/CampusAppWP8/Utility/BoolToVisibilityConverter.cs rename to CampusAppWP8/CampusAppWP8/Utility/Converter/BoolToVisibilityConverter.cs index c8723978..8c7191a9 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/BoolToVisibilityConverter.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/BoolToVisibilityConverter.cs @@ -6,7 +6,7 @@ // 15.10.2013 // Implements to visibility converter class //----------------------------------------------------------------------- -namespace CampusAppWP8.Utility +namespace CampusAppWP8.Utility.Converter { using System; using System.Windows; diff --git a/CampusAppWP8/CampusAppWP8/Utility/Converter/FrameworkElementToRectConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/FrameworkElementToRectConverter.cs new file mode 100644 index 00000000..c3fd0f16 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/FrameworkElementToRectConverter.cs @@ -0,0 +1,28 @@ + +namespace CampusAppWP8.Utility.Converter +{ + using System; + using System.Windows; + using System.Windows.Data; + + public sealed class FrameworkElementToRectConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) + { + Rect retValue = new Rect(); + + if (value != null) + { + retValue.Height = (value as FrameworkElement).ActualHeight; + retValue.Width = (value as FrameworkElement).ActualWidth; + } + + return retValue; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) + { + return null; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/IdToPlaceConverter.cs similarity index 99% rename from CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs rename to CampusAppWP8/CampusAppWP8/Utility/Converter/IdToPlaceConverter.cs index 07a8dd99..243c1731 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/IdToPlaceConverter.cs @@ -6,7 +6,7 @@ // 13.11.2013 // Implements the identifier to place converter class //----------------------------------------------------------------------- -namespace CampusAppWP8.Utility +namespace CampusAppWP8.Utility.Converter { using System; using System.Windows.Data; diff --git a/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/MealIdToPriceConverter.cs similarity index 98% rename from CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs rename to CampusAppWP8/CampusAppWP8/Utility/Converter/MealIdToPriceConverter.cs index 73caa561..d2e7e4b0 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/MealIdToPriceConverter.cs @@ -6,7 +6,7 @@ // 14.11.2013 // Implements the meal identifier to price converter class //----------------------------------------------------------------------- -namespace CampusAppWP8.Utility +namespace CampusAppWP8.Utility.Converter { using System; using System.Windows.Data; diff --git a/CampusAppWP8/CampusAppWP8/Utility/Converter/RoomToStringConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/RoomToStringConverter.cs new file mode 100644 index 00000000..9cca528a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/RoomToStringConverter.cs @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Fiedler +// 22.11.2013 +// Implements the room to string converter class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Converter +{ + using System; + using System.Collections.Generic; + using System.Windows.Data; + using CampusAppWP8.Resources; + using CampusAppWPortalLib8.Model.GeoDb; + + /// A room to string converter. + /// Fiedler, 22.11.2013. + /// + public sealed class RoomToStringConverter : IValueConverter + { + /// + /// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche. + /// + /// Fiedler, 22.11.2013. + /// + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) + { + string retValue = string.Empty; + + if (value.GetType().Equals(typeof(List))) + { + List list = value as List; + + if (list[0] != null && list[0].GetType().Equals(typeof(PlaceModel)) == true) + { + PlaceModel room = list[0] as PlaceModel; + + string nameStr = room.GetInformationsValue(Constants.PisInformationName_Name); + string roomStr = room.GetInformationsValue(Constants.PisInformationName_Room); + + if (nameStr.Equals(roomStr)) + { + retValue = roomStr; + } + else + { + retValue = roomStr + ", " + nameStr; + } + } + } + + return retValue; + } + + /// + /// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in + /// -Bindungen aufgerufen. + /// + /// Fiedler, 22.11.2013. + /// + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) + { + return null; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs deleted file mode 100644 index dc937c1a..00000000 --- a/CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace CampusAppWP8.Utility -{ - using System; - using System.Windows; - using System.Windows.Data; - - - public sealed class DoubleNaNConverter : IValueConverter - { - - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) - { - return (value is double && value.Equals(double.NaN) == false) ? value : 0.0; - } - - - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) - { - return (value is double && value.Equals(double.NaN) == false) ? value : 0.0; - } - } -} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml index 747b8420..c7087f5b 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml @@ -9,10 +9,5 @@ Foreground="{StaticResource PhoneForegroundBrush}" > - \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs index 4d050d77..ef9e3484 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs @@ -8,6 +8,7 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Utility.Lui { + using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -17,21 +18,47 @@ namespace CampusAppWP8.Utility.Lui /// public partial class MultiValueTextBlock : UserControl { + #region DependencyProperties + /// The value 1 property. - public static readonly DependencyProperty Value_1_Property = DependencyProperty.Register("Value1", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded)); + public static readonly DependencyProperty Value_1_Property = DependencyProperty.Register("Value1", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); /// The value 2 property. - public static readonly DependencyProperty Value_2_Property = DependencyProperty.Register("Value2", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded)); + public static readonly DependencyProperty Value_2_Property = DependencyProperty.Register("Value2", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 3 property. + public static readonly DependencyProperty Value_3_Property = DependencyProperty.Register("Value3", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 4 property. + public static readonly DependencyProperty Value_4_Property = DependencyProperty.Register("Value4", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 5 property. + public static readonly DependencyProperty Value_5_Property = DependencyProperty.Register("Value5", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 6 property. + public static readonly DependencyProperty Value_6_Property = DependencyProperty.Register("Value6", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 7 property. + public static readonly DependencyProperty Value_7_Property = DependencyProperty.Register("Value7", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 8 property. + public static readonly DependencyProperty Value_8_Property = DependencyProperty.Register("Value8", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + + /// The value list property. + public static readonly DependencyProperty Value_List_Property = DependencyProperty.Register("ValueList", typeof(List), typeof(MultiValueTextBlock), new PropertyMetadata(null)); /// The converter property. - public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded)); + public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + + #endregion // DependencyProperties + + #region Constructor /// Initializes a new instance of the MultiValueTextBlock class. /// Fiedler, 14.11.2013. public MultiValueTextBlock() : base() { this.InitializeComponent(); + this.Loaded += this.OnLoaded; } + #endregion // Constructor + + #region Properties + /// Gets or sets the converter. /// The converter. public IValueConverter Converter @@ -77,18 +104,145 @@ namespace CampusAppWP8.Utility.Lui } } - /// Raises the dependency property changed event. - /// Fiedler, 14.11.2013. - /// The DependencyObject to process. - /// Event information to send to registered event handlers. - private static void OnLoaded(DependencyObject d, DependencyPropertyChangedEventArgs e) + /// Gets or sets the value 3. + /// The value 3. + public object Value3 { - MultiValueTextBlock obj = d as MultiValueTextBlock; - - if ((obj.Value1 != null) && (obj.Value2 != null) && (obj.Converter != null)) + get { - obj.TheText.Text = (string)obj.Converter.Convert(obj.Value1, typeof(string), obj.Value2, System.Globalization.CultureInfo.CurrentCulture); + return this.GetValue(Value_3_Property); + } + + set + { + this.SetValue(Value_3_Property, value); } } + + /// Gets or sets the value 4. + /// The value 4. + public object Value4 + { + get + { + return this.GetValue(Value_4_Property); + } + + set + { + this.SetValue(Value_4_Property, value); + } + } + + /// Gets or sets the value 5. + /// The value 5. + public object Value5 + { + get + { + return this.GetValue(Value_5_Property); + } + + set + { + this.SetValue(Value_5_Property, value); + } + } + + /// Gets or sets the value 6. + /// The value 6. + public object Value6 + { + get + { + return this.GetValue(Value_6_Property); + } + + set + { + this.SetValue(Value_6_Property, value); + } + } + + /// Gets or sets the value 7. + /// The value 7. + public object Value7 + { + get + { + return this.GetValue(Value_7_Property); + } + + set + { + this.SetValue(Value_7_Property, value); + } + } + + /// Gets or sets the value 8. + /// The value 8. + public object Value8 + { + get + { + return this.GetValue(Value_8_Property); + } + + set + { + this.SetValue(Value_8_Property, value); + } + } + + /// Gets or sets a list of values. + /// A List of values. + public object ValueList + { + get + { + return this.GetValue(Value_List_Property); + } + + set + { + this.SetValue(Value_List_Property, value); + } + } + + #endregion // Properties + + #region Methods + + /// Raises the routed event. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. + private void OnLoaded(object sender, RoutedEventArgs e) + { + if (this.Converter != null) + { + if (this.ValueList != null) + { + this.TheText.Text = (string)this.Converter.Convert(this.ValueList, typeof(string), null, System.Globalization.CultureInfo.CurrentCulture); + } + else + { + List valList = new List(); + + valList.Add(this.Value1); + valList.Add(this.Value2); + valList.Add(this.Value3); + valList.Add(this.Value4); + valList.Add(this.Value5); + valList.Add(this.Value6); + valList.Add(this.Value7); + valList.Add(this.Value8); + + this.TheText.Text = (string)this.Converter.Convert(valList, typeof(string), null, System.Globalization.CultureInfo.CurrentCulture); + } + } + } + + #endregion // Methods } } diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml index a30baecb..3e102a12 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:weekView="clr-namespace:CampusAppWP8.Utility.Lui.Templates" xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui" - xmlns:conv="clr-namespace:CampusAppWP8.Utility" + xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml index a85ecd37..6cbe6cea 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:utility="clr-namespace:CampusAppWP8.Utility" + xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" @@ -12,7 +12,7 @@ > - + diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml.cs index 8327b81b..75d6c829 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml.cs @@ -24,6 +24,7 @@ namespace CampusAppWP8.Utility.Lui.Templates using System.Windows.Data; using CampusAppWP8.Model.TimeTable; using CampusAppWP8.Utility; + using CampusAppWP8.Utility.Converter; /// A week view day. /// Fiedler, 06.11.2013. From ea717fcef0706d221cafdc5db6564428df709c23 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Fri, 22 Nov 2013 21:24:21 +0100 Subject: [PATCH 03/26] #284 fixed --- .../Pages/TimeTable/TimeTableDay.xaml | 4 +- .../Utility/Converter/DoubleNaNConverter.cs | 41 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Converter/DoubleNaNConverter.cs diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml index 4b8a3da3..2462168c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml @@ -19,7 +19,9 @@ - + + + diff --git a/CampusAppWP8/CampusAppWP8/Utility/Converter/DoubleNaNConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/DoubleNaNConverter.cs new file mode 100644 index 00000000..b95d2ccc --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/DoubleNaNConverter.cs @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Fiedler +// 22.11.2013 +// Implements the double na n converter class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Converter +{ + using System; + using System.Windows; + using System.Windows.Data; + + /// A double na n converter. + /// Fiedler, 22.11.2013. + /// + public sealed class DoubleNaNConverter : IValueConverter + { + /// + /// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche. + /// + /// Fiedler, 22.11.2013. + /// + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) + { + return (value is double && value.Equals(double.NaN) == false) ? value : 0.0; + } + + /// + /// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in + /// -Bindungen aufgerufen. + /// + /// Fiedler, 22.11.2013. + /// + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) + { + return (value is double && value.Equals(double.NaN) == false) ? value : 0.0; + } + } +} From 15892204455cbe5dbb8c51e97135528c69e51ee8 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Fri, 22 Nov 2013 21:54:35 +0100 Subject: [PATCH 04/26] daily commit --- .../Pages/TimeTable/TimeTableWeek.xaml.cs | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs index f259361d..2bbee29b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs @@ -8,6 +8,8 @@ namespace CampusAppWP8.Pages.TimeTable { using System; + using System.Collections; + using System.Collections.Generic; using System.Collections.Specialized; using System.Collections.ObjectModel; using System.Windows; @@ -20,15 +22,24 @@ namespace CampusAppWP8.Pages.TimeTable using CampusAppWP8.Model.TimeTable; using CampusAppWP8.Resources; + /// A time table week. + /// Fiedler, 22.11.2013. + /// public partial class TimeTableWeek : PhoneApplicationPage { + /// The pivot pages. private static readonly int PIVOT_PAGES = 3; + /// The pivot pages half down. private static readonly int PIVOT_PAGES_HALF_DOWN = 1; + /// Zero-based index of the last selected. private int lastSelectedIndex = 0; + /// List of items. private ObservableCollection itemList = new ObservableCollection(); + /// Initializes a new instance of the TimeTableWeek class. + /// Fiedler, 22.11.2013. public TimeTableWeek() { this.InitializeComponent(); @@ -74,6 +85,9 @@ namespace CampusAppWP8.Pages.TimeTable ApplicationBar.Buttons.Add(addBtn); } + /// Wird aufgerufen, wenn eine Seite die aktive Seite in einem Frame wird. + /// Fiedler, 22.11.2013. + /// protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); @@ -84,6 +98,12 @@ namespace CampusAppWP8.Pages.TimeTable } else { + //List backStack = NavigationService.BackStack; + List backStack = new List(NavigationService.BackStack); + JournalEntry entry = backStack[0]; + + Console.Write(entry.ToString()); + this.ThePivot.ItemsSource = this.itemList; this.lastSelectedIndex = PIVOT_PAGES_HALF_DOWN; this.ThePivot.SelectedIndex = PIVOT_PAGES_HALF_DOWN; @@ -92,6 +112,11 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// + /// Wird aufgerufen, wenn eine Seite nicht mehr die aktive Seite in einem Frame ist. + /// + /// Fiedler, 22.11.2013. + /// protected override void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); @@ -99,6 +124,10 @@ namespace CampusAppWP8.Pages.TimeTable TimeTable.Feed.SaveData(); } + /// Gets the first day of week. + /// Fiedler, 22.11.2013. + /// The day in week Date/Time. + /// The first day of week. private DateTime GetFirstDayOfWeek(DateTime dayInWeek) { DateTime retValue = dayInWeek.Date; @@ -111,6 +140,10 @@ namespace CampusAppWP8.Pages.TimeTable return retValue; } + /// Gets week number. + /// Fiedler, 22.11.2013. + /// The date Date/Time. + /// The week number. private int GetWeekNumber(DateTime date) { int retValue = 0; @@ -121,6 +154,10 @@ namespace CampusAppWP8.Pages.TimeTable return retValue; } + /// Gets day of week index. + /// Fiedler, 22.11.2013. + /// The day in week Date/Time. + /// The day of week index. private int GetDayOfWeekIndex(DateTime dayInWeek) { int retValue = -1; @@ -139,6 +176,10 @@ namespace CampusAppWP8.Pages.TimeTable return retValue; } + /// Raises the click day view event. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickDayView(object sender, EventArgs e) { Uri url = new Uri(Constants.PathTimeTable_Day, UriKind.Relative); @@ -146,6 +187,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the click today event. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickToday(object sender, EventArgs e) { DateTime firstDay = this.GetFirstDayOfWeek(DateTime.Now); @@ -183,6 +228,10 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Raises the click properties event. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickProperties(object sender, EventArgs e) { Uri url = new Uri(Constants.PathTimeTable_Properties, UriKind.Relative); @@ -190,6 +239,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the click create event. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickCreate(object sender, EventArgs e) { TimeTable.Feed.Model.Appointments.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged); @@ -199,6 +252,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the selection changed event. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnPivotSelectionChanged(object sender, SelectionChangedEventArgs e) { int delta = this.ThePivot.SelectedIndex - this.lastSelectedIndex; @@ -225,6 +282,9 @@ namespace CampusAppWP8.Pages.TimeTable this.lastSelectedIndex = this.ThePivot.SelectedIndex; } + /// Executes the appointment click action. + /// Fiedler, 22.11.2013. + /// The model. private void OnAppointmentClick(AppointmentModel model) { int index = TimeTable.Feed.Model.Appointments.IndexOf(model); @@ -241,6 +301,10 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Raises the notify collection changed event. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e) { AppointmentModel tempModel = null; @@ -273,6 +337,12 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Check appointments. + /// Fiedler, 22.11.2013. + /// + /// Thrown when a value was unexpectedly null. + /// + /// (Optional) zero-based index of the page. private void CheckAppointments(int pageIndex = -1) { if (TimeTable.Feed == null) From c92e301a7e65937c0997ed8acfe5368ef120d6f7 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 25 Nov 2013 10:53:11 +0100 Subject: [PATCH 05/26] add menu entries --- .../CampusAppWP8/Pages/StartPage.xaml | 7 ++-- .../CampusAppWP8/Properties/WMAppManifest.xml | 4 +-- .../Resources/AppResources.Designer.cs | 33 ++++++++++++------- .../CampusAppWP8/Resources/AppResources.resx | 11 ++++--- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml index 2e3e784e..4e3573d2 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml @@ -308,10 +308,13 @@ - + - + + + + diff --git a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml index dc2c9908..d7ebc0b3 100644 --- a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml +++ b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml @@ -20,8 +20,8 @@ Assets\ApplicationIcon.png BTU CampusApp - Assets\Slides\Slide1.jpg - Assets\Slides\Slide2.jpg + Assets\Slides\Slide2.jpg + Assets\Slides\Slide1.jpg Assets\Slides\Slide3.jpg Assets\Slides\Slide4.jpg Assets\Slides\Slide5.jpg diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 47c3c85a..58cd202d 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1212,15 +1212,6 @@ namespace CampusAppWP8.Resources { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die App-Einstellungen ähnelt. - /// - public static string Setting_ApplAppBarTitle { - get { - return ResourceManager.GetString("Setting_ApplAppBarTitle", resourceCulture); - } - } - /// /// Sucht eine lokalisierte Zeichenfolge, die Nur mit Wlan laden ähnelt. /// @@ -1230,6 +1221,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Allgemeine Einstellungen ähnelt. + /// + public static string Setting_General { + get { + return ResourceManager.GetString("Setting_General", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Über BTU Campus-App ähnelt. /// @@ -1239,6 +1239,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Sonstige Einstellungen ähnelt. + /// + public static string Setting_Other { + get { + return ResourceManager.GetString("Setting_Other", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die BTU-Tag-Standardfunktion ähnelt. /// @@ -1312,11 +1321,11 @@ namespace CampusAppWP8.Resources { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Profileinstellungen ähnelt. + /// Sucht eine lokalisierte Zeichenfolge, die Persönliche Einstellungen ähnelt. /// - public static string Setting_UserProfilAppBarTitle { + public static string Setting_UserInfo { get { - return ResourceManager.GetString("Setting_UserProfilAppBarTitle", resourceCulture); + return ResourceManager.GetString("Setting_UserInfo", resourceCulture); } } diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index b8452a9c..bdca8995 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -293,8 +293,8 @@ Abschluss - - Profileinstellungen + + Persönliche Einstellungen Rolle @@ -332,8 +332,8 @@ Ortung - - App-Einstellungen + + Allgemeine Einstellungen Der aktuelle Campus konnte nicht ermittelt werden. Es wird der im Profil festgelegten Campus verwendet. @@ -632,4 +632,7 @@ Räume + + Sonstige Einstellungen + \ No newline at end of file From ad3c73dcf233edb043f09f051408084c63245659 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 25 Nov 2013 12:34:01 +0100 Subject: [PATCH 06/26] add functionsetting page --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 7 ++ .../Pages/Setting/AppSettingPage.xaml | 114 +++++++++++------- .../Pages/Setting/AppSettingPage.xaml.cs | 13 +- .../Pages/Setting/FunctionSettingPage.xaml | 88 ++++++++++++++ .../Pages/Setting/FunctionSettingPage.xaml.cs | 106 ++++++++++++++++ .../Resources/AppResources.Designer.cs | 27 +++++ .../CampusAppWP8/Resources/AppResources.resx | 9 ++ .../CampusAppWP8/Resources/Constants.resx | 18 +++ .../Resources/Constants1.Designer.cs | 54 +++++++++ 9 files changed, 383 insertions(+), 53 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml create mode 100644 CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 891e313e..7f9fa3ca 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -137,6 +137,9 @@ + + FunctionSettingPage.xaml + Appointment.xaml @@ -484,6 +487,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml index 67797334..4a95b0de 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml @@ -9,6 +9,7 @@ xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" + xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -25,48 +26,79 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs index 3527c4a9..cc241977 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs @@ -8,9 +8,7 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Pages.Setting { - using System; - using System.Windows.Navigation; - using CampusAppWP8.Model.Setting; + using System.Windows.Navigation; using Microsoft.Phone.Controls; /// Class for the AppSettingPage. @@ -18,10 +16,6 @@ namespace CampusAppWP8.Pages.Setting /// public partial class AppSettingPage : PhoneApplicationPage { - #region Member - /// The TagHandler model. - private TagHandlerListPickerItemListModel taghandlerModel; - #endregion #region Constructor /// Initializes a new instance of the class. @@ -31,10 +25,6 @@ namespace CampusAppWP8.Pages.Setting this.InitializeComponent(); this.GeoWatchToggle.IsChecked = Settings.AppSetting.GeoWatchEnable; this.OnlyWiFiToggle.IsChecked = Settings.AppSetting.OnlyWifi; - this.taghandlerModel = new TagHandlerListPickerItemListModel(); - this.TagHandler.ItemsSource = this.taghandlerModel.List; - int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.TagDefaultHandler.ToString()); - this.TagHandler.SelectedIndex = tagselIndex; } #endregion @@ -50,7 +40,6 @@ namespace CampusAppWP8.Pages.Setting { Settings.AppSetting.GeoWatchEnable = GeoWatchToggle.IsChecked.Value; Settings.AppSetting.OnlyWifi = OnlyWiFiToggle.IsChecked.Value; - Settings.AppSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml new file mode 100644 index 00000000..76b584f7 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs new file mode 100644 index 00000000..98cedb3f --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs @@ -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 CampusAppWP8.Resources; +using CampusAppWP8.Model.Setting; + +namespace CampusAppWP8.Pages.Setting +{ + public partial class FunctionSettingPage : PhoneApplicationPage + { + + #region Member + /// The TagHandler model. + private TagHandlerListPickerItemListModel taghandlerModel; + #endregion + + #region Constructor + + public FunctionSettingPage() + { + InitializeComponent(); + this.taghandlerModel = new TagHandlerListPickerItemListModel(); + this.TagHandler.ItemsSource = this.taghandlerModel.List; + int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.TagDefaultHandler.ToString()); + this.TagHandler.SelectedIndex = tagselIndex; + } + + #endregion + + #region Methods + + #region protected + + /// Override the OnNavigatedTo method. + /// Stubbfel, 15.10.2013. + /// + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + string functionIndex; + + if (NavigationMode.New == e.NavigationMode && NavigationContext.QueryString.TryGetValue(Constants.Param_FunctionSetting_Index, out functionIndex)) + { + this.SetSelecetPivotItem(functionIndex); + } + else + { + string oldIndex = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_FunctionSettingPageIndex); + this.SetSelecetPivotItem(oldIndex); + } + } + + /// Override the OnNavigatedFrom method. + /// Stubbfel, 15.10.2013. + /// + protected override void OnNavigatedFrom(NavigationEventArgs e) + { + Settings.AppSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); + if (NavigationMode.Back == e.NavigationMode) + { + App.SaveToIsolatedStorage(Constants.IsolatedStorage_FunctionSettingPageIndex, null); + } + else + { + FrameworkElement uiElement = this.SettingFunctionPivot.SelectedItem as FrameworkElement; + if (uiElement != null && uiElement.Tag != null) + { + App.SaveToIsolatedStorage(Constants.IsolatedStorage_FunctionSettingPageIndex, uiElement.Tag.ToString()); + } + } + } + + #endregion + + #region private + + private void SetSelecetPivotItem(string itemTag) + { + if (itemTag != null) + { + foreach (FrameworkElement pivotItem in this.SettingFunctionPivot.Items) + { + if (pivotItem.Tag != null && itemTag.Equals(pivotItem.Tag.ToString())) + { + this.SettingFunctionPivot.SetValue(Pivot.SelectedItemProperty, pivotItem); + + return; + } + } + } + this.SettingFunctionPivot.SelectedIndex = 0; + + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 58cd202d..815f21df 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1221,6 +1221,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Funktionseinstellungen ähnelt. + /// + public static string Setting_Function { + get { + return ResourceManager.GetString("Setting_Function", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Allgemeine Einstellungen ähnelt. /// @@ -1230,6 +1239,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Ortung & Netzwerk ähnelt. + /// + public static string Setting_GeneralNetwork { + get { + return ResourceManager.GetString("Setting_GeneralNetwork", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Über BTU Campus-App ähnelt. /// @@ -1248,6 +1266,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die BTU-Tag ähnelt. + /// + public static string Setting_Tag { + get { + return ResourceManager.GetString("Setting_Tag", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die BTU-Tag-Standardfunktion ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index bdca8995..ab6e45d6 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -632,7 +632,16 @@ Räume + + Funktionseinstellungen + + + Ortung & Netzwerk + Sonstige Einstellungen + + BTU-Tag + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index bcad4e3a..bf2c4707 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -624,4 +624,22 @@ /Pages/Setting/Impressum.xaml + + Mensafunction + + + Tagfunction + + + TimeTablefunction + + + FunctionSettingPageIndex + + + FunctionSettingIndex + + + /Pages/Setting/FunctionSettingPage.xaml + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index 17e874ae..e40dccbf 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -438,6 +438,33 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Mensafunction ähnelt. + /// + public static string FunctionSetting_Mensa { + get { + return ResourceManager.GetString("FunctionSetting_Mensa", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Tagfunction ähnelt. + /// + public static string FunctionSetting_Tag { + get { + return ResourceManager.GetString("FunctionSetting_Tag", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die TimeTablefunction ähnelt. + /// + public static string FunctionSetting_TimeTable { + get { + return ResourceManager.GetString("FunctionSetting_TimeTable", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die CurrentPositionPoint ähnelt. /// @@ -492,6 +519,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die FunctionSettingPageIndex ähnelt. + /// + public static string IsolatedStorage_FunctionSettingPageIndex { + get { + return ResourceManager.GetString("IsolatedStorage_FunctionSettingPageIndex", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die LectureAppointment ähnelt. /// @@ -645,6 +681,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die FunctionSettingIndex ähnelt. + /// + public static string Param_FunctionSetting_Index { + get { + return ResourceManager.GetString("Param_FunctionSetting_Index", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die BuildingId ähnelt. /// @@ -1050,6 +1095,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Setting/FunctionSettingPage.xaml ähnelt. + /// + public static string PathSetting_Function { + get { + return ResourceManager.GetString("PathSetting_Function", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Setting/Impressum.xaml ähnelt. /// From e6bd2c3df292b86f6a94a8be1aca529d0002124c Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 25 Nov 2013 13:30:53 +0100 Subject: [PATCH 07/26] add mensasetting --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 1 + .../CampusAppWP8/Model/Setting/AppSettings.cs | 20 ++++++++++++++ .../Pages/Setting/AppSettingPage.xaml | 2 +- .../Pages/Setting/AppSettingPage.xaml.cs | 26 +++++++++++++++++++ .../Pages/Setting/FunctionSettingPage.xaml | 4 ++- .../Pages/Setting/FunctionSettingPage.xaml.cs | 4 +++ .../Pages/Setting/MensaSetting.cs | 24 +++++++++++++++++ .../Resources/AppResources.Designer.cs | 9 +++++++ .../CampusAppWP8/Resources/AppResources.resx | 3 +++ .../CampusAppWP8/Resources/Constants.resx | 6 +++++ .../Resources/Constants1.Designer.cs | 18 +++++++++++++ CampusAppWP8/CampusAppWP8/Settings.cs | 5 ++++ 12 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 7f9fa3ca..95ef43d0 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -140,6 +140,7 @@ FunctionSettingPage.xaml + Appointment.xaml diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs index 4b062399..a6edb8a2 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs @@ -8,14 +8,34 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Model.Setting { + using CampusAppWP8.Pages.Setting; using CampusAppWP8.Resources; /// Model for settings of the app. /// Stubbfel, 15.10.2013. public class AppSettings { + #region member + private static MensaSetting mensaSetting = new MensaSetting(); + #endregion #region Property + public MensaSetting MensaSetting + { + get + { + return AppSettings.mensaSetting; + } + + set + { + if (value != AppSettings.mensaSetting) + { + AppSettings.mensaSetting = value; + } + } + } + /// Gets or sets a value indicating whether the GeoWatch-Flag. /// true if geo watch enable, false if not. public bool GeoWatchEnable diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml index 4a95b0de..b0a5ca68 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml @@ -28,7 +28,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs index cc241977..ce8e6b74 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs @@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.Setting { using System.Windows.Navigation; using Microsoft.Phone.Controls; + using CampusAppWP8.Resources; /// Class for the AppSettingPage. /// Stubbfel, 15.10.2013. @@ -31,6 +32,25 @@ namespace CampusAppWP8.Pages.Setting #region Method + /// Override the OnNavigatedTo method. + /// Stubbfel, 15.10.2013. + /// + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + string functionIndex; + + if (NavigationMode.New != e.NavigationMode && NavigationContext.QueryString.TryGetValue(Constants.Param_FunctionSetting_Index, out functionIndex)) + { + int oldIndex = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_GeneralSettingPageIndex); + this.GeneralSettingPivot.SelectedIndex = oldIndex; + + + + } + } + /// Override the OnNavigatedFrom method. /// Stubbfel, 15.10.2013. /// @@ -40,7 +60,13 @@ namespace CampusAppWP8.Pages.Setting { Settings.AppSetting.GeoWatchEnable = GeoWatchToggle.IsChecked.Value; Settings.AppSetting.OnlyWifi = OnlyWiFiToggle.IsChecked.Value; + App.SaveToIsolatedStorage(Constants.IsolatedStorage_GeneralSettingPageIndex, 0); } + else + { + App.SaveToIsolatedStorage(Constants.IsolatedStorage_FunctionSettingPageIndex, this.GeneralSettingPivot.SelectedIndex); + } + } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml index 76b584f7..703441f0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml @@ -43,7 +43,9 @@ - + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs index 98cedb3f..a04c770a 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs @@ -29,6 +29,8 @@ namespace CampusAppWP8.Pages.Setting this.TagHandler.ItemsSource = this.taghandlerModel.List; int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.TagDefaultHandler.ToString()); this.TagHandler.SelectedIndex = tagselIndex; + + this.AtomMensaToggle.IsChecked = Settings.AppSetting.MensaSetting.AtomMensaSelection; } #endregion @@ -63,6 +65,8 @@ namespace CampusAppWP8.Pages.Setting protected override void OnNavigatedFrom(NavigationEventArgs e) { Settings.AppSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); + Settings.AppSetting.MensaSetting.AtomMensaSelection = this.AtomMensaToggle.IsChecked.Value; + if (NavigationMode.Back == e.NavigationMode) { App.SaveToIsolatedStorage(Constants.IsolatedStorage_FunctionSettingPageIndex, null); diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs new file mode 100644 index 00000000..7dc25dac --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs @@ -0,0 +1,24 @@ +using CampusAppWP8.Resources; + +namespace CampusAppWP8.Pages.Setting +{ + public class MensaSetting + { + #region Property + + public bool AtomMensaSelection + { + get + { + return App.LoadFromAppState(Constants.AppSetting_MensaSetting_AtomMensaSelection); + } + + set + { + App.SaveToAppState(Constants.AppSetting_MensaSetting_AtomMensaSelection, value); + } + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 815f21df..b90c5f67 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1221,6 +1221,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die autom. Mensaauswahl ähnelt. + /// + public static string Setting_AtomMensaSelection { + get { + return ResourceManager.GetString("Setting_AtomMensaSelection", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Funktionseinstellungen ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index ab6e45d6..28f3bd7b 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -632,6 +632,9 @@ Räume + + autom. Mensaauswahl + Funktionseinstellungen diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index bf2c4707..44fe75b6 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -624,6 +624,9 @@ /Pages/Setting/Impressum.xaml + + AtomMensaSelection + Mensafunction @@ -636,6 +639,9 @@ FunctionSettingPageIndex + + GeneralSettingPageIndex + FunctionSettingIndex diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index e40dccbf..fb4eb158 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -150,6 +150,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die AtomMensaSelection ähnelt. + /// + public static string AppSetting_MensaSetting_AtomMensaSelection { + get { + return ResourceManager.GetString("AppSetting_MensaSetting_AtomMensaSelection", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die OnlyWifi ähnelt. /// @@ -528,6 +537,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die GeneralSettingPageIndex ähnelt. + /// + public static string IsolatedStorage_GeneralSettingPageIndex { + get { + return ResourceManager.GetString("IsolatedStorage_GeneralSettingPageIndex", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die LectureAppointment ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Settings.cs b/CampusAppWP8/CampusAppWP8/Settings.cs index a02b99fb..06754711 100644 --- a/CampusAppWP8/CampusAppWP8/Settings.cs +++ b/CampusAppWP8/CampusAppWP8/Settings.cs @@ -69,6 +69,11 @@ namespace CampusAppWP8 } } + #endregion + + #region method + + #endregion } } From edefc17879f0fa1e93bf9ca012cb24c4f5181471 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Mon, 25 Nov 2013 14:14:03 +0100 Subject: [PATCH 08/26] #285 done --- .../Pages/TimeTable/TimeTableDay.xaml.cs | 63 ++++++++++++++++++- .../Pages/TimeTable/TimeTableWeek.xaml.cs | 15 +++-- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs index b7efc4e2..9d175186 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs @@ -22,15 +22,24 @@ namespace CampusAppWP8.Pages.TimeTable using CampusAppWP8.Model.TimeTable; using CampusAppWP8.Resources; + /// A time table day. + /// Fiedler, 25.11.2013. + /// public partial class TimeTableDay : PhoneApplicationPage { + /// The pivot item pages. private static readonly int PIVOT_ITEM_PAGES = 5; + /// The pivot item pages half down. private static readonly int PIVOT_ITEM_PAGES_HALF_DOWN = 2; + /// List of items. private ObservableCollection itemList = new ObservableCollection(); + /// Zero-based index of the last selected. private int lastSelectedIndex = 0; - + + /// Initializes a new instance of the TimeTableDay class. + /// Fiedler, 25.11.2013. public TimeTableDay() { this.InitializeComponent(); @@ -73,6 +82,9 @@ namespace CampusAppWP8.Pages.TimeTable ApplicationBar.Buttons.Add(addBtn); } + /// Wird aufgerufen, wenn eine Seite die aktive Seite in einem Frame wird. + /// Fiedler, 25.11.2013. + /// protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); @@ -91,6 +103,29 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// + /// Wird aufgerufen, wenn eine Seite nicht mehr die aktive Seite in einem Frame ist. + /// + /// Fiedler, 25.11.2013. + /// + protected override void OnNavigatedFrom(NavigationEventArgs e) + { + base.OnNavigatedFrom(e); + + List backStack = new List(NavigationService.BackStack); + + if (backStack.Count > 0 + && backStack[0].Source.OriginalString.Contains(Constants.PathTimeTable_Day) + && e.Uri.OriginalString.Contains(Constants.PathTimeTable_Week)) + { + NavigationService.RemoveBackEntry(); + } + } + + /// Event pivot selection changed. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Selection changed event information. private void EventPivotSelectionChanged(object sender, SelectionChangedEventArgs e) { int indexToChange = 0; @@ -122,6 +157,9 @@ namespace CampusAppWP8.Pages.TimeTable this.lastSelectedIndex = this.ThePivot.SelectedIndex; } + /// Executes the appointment click action. + /// Fiedler, 25.11.2013. + /// The model. private void OnAppointmentClick(AppointmentModel model) { int index = TimeTable.Feed.Model.Appointments.IndexOf(model); @@ -138,6 +176,10 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Raises the click week event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickWeek(object sender, EventArgs e) { Uri url = new Uri(Constants.PathTimeTable_Week, UriKind.Relative); @@ -145,6 +187,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the click to day event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickToDay(object sender, EventArgs e) { int index = -1; @@ -179,6 +225,10 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Raises the click properties event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickProperties(object sender, EventArgs e) { Uri url = new Uri(Constants.PathTimeTable_Properties, UriKind.Relative); @@ -186,6 +236,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the click add event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnClickAdd(object sender, EventArgs e) { TimeTable.Feed.Model.Appointments.CollectionChanged += this.OnListChanged; @@ -195,6 +249,10 @@ namespace CampusAppWP8.Pages.TimeTable page.NavigationService.Navigate(url); } + /// Raises the notify collection changed event. + /// Fiedler, 25.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) @@ -236,6 +294,9 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Check appointments. + /// Fiedler, 25.11.2013. + /// (Optional) zero-based index of the. private void CheckAppointments(int index = -1) { if (index < 0) diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs index 2bbee29b..5b0f6c4c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs @@ -98,12 +98,6 @@ namespace CampusAppWP8.Pages.TimeTable } else { - //List backStack = NavigationService.BackStack; - List backStack = new List(NavigationService.BackStack); - JournalEntry entry = backStack[0]; - - Console.Write(entry.ToString()); - this.ThePivot.ItemsSource = this.itemList; this.lastSelectedIndex = PIVOT_PAGES_HALF_DOWN; this.ThePivot.SelectedIndex = PIVOT_PAGES_HALF_DOWN; @@ -121,6 +115,15 @@ namespace CampusAppWP8.Pages.TimeTable { base.OnNavigatedFrom(e); + List backStack = new List(NavigationService.BackStack); + + if (backStack.Count > 0 + && backStack[0].Source.OriginalString.Contains(Constants.PathTimeTable_Week) + && e.Uri.OriginalString.Contains(Constants.PathTimeTable_Day)) + { + NavigationService.RemoveBackEntry(); + } + TimeTable.Feed.SaveData(); } From 7e0a7b25ef598c27a5fe9b90443dc1fbf18d326d Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 25 Nov 2013 14:37:07 +0100 Subject: [PATCH 09/26] add functionsetting,tagsetting, timetamlbe setting --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 4 + .../CampusAppWP8/Model/Setting/AppSettings.cs | 54 +++++++---- .../Model/Setting/BTUTagSetting.cs | 42 +++++++++ .../Model/Setting/FunctionSettings.cs | 93 +++++++++++++++++++ .../CampusAppWP8/Model/Setting/ISetting.cs | 18 ++++ .../Model/Setting/TimeTableSetting.cs | 32 +++++++ .../Model/Setting/UserProfilModel.cs | 46 ++++++++- .../Pages/BTUTag/BTUTagInfo.xaml.cs | 4 +- .../CampusAppWP8/Pages/Dev/QRScanner.xaml.cs | 2 +- .../Pages/Setting/AppSettingPage.xaml.cs | 3 - .../Pages/Setting/FunctionSettingPage.xaml.cs | 54 ++++++----- .../Pages/Setting/MensaSetting.cs | 30 +++++- .../CampusAppWP8/Pages/StartPage.xaml.cs | 11 +-- CampusAppWP8/CampusAppWP8/Settings.cs | 41 ++++---- .../Utility/Lui/Tiles/TileCreator.cs | 2 +- 15 files changed, 357 insertions(+), 79 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/BTUTagSetting.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/ISetting.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/TimeTableSetting.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 95ef43d0..4f651921 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -133,7 +133,11 @@ + + + + diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs index a6edb8a2..7cf9b100 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs @@ -13,25 +13,34 @@ namespace CampusAppWP8.Model.Setting /// Model for settings of the app. /// Stubbfel, 15.10.2013. - public class AppSettings + public class AppSettings : ISetting { #region member - private static MensaSetting mensaSetting = new MensaSetting(); + + /// The mensa setting. + private static FunctionSettings functionSetting = new FunctionSettings(); + + /// The tag setting. + private static BTUTagSetting tagSetting = new BTUTagSetting(); + #endregion + #region Property - public MensaSetting MensaSetting + /// Gets or sets the tag setting. + /// The tag setting. + public FunctionSettings FunctionSettings { get { - return AppSettings.mensaSetting; + return AppSettings.functionSetting; } - set + set { - if (value != AppSettings.mensaSetting) + if (AppSettings.functionSetting != value) { - AppSettings.mensaSetting = value; + AppSettings.functionSetting = value; } } } @@ -141,21 +150,32 @@ namespace CampusAppWP8.Model.Setting } } - /// Gets or sets the tag default handler. - /// The tag default handler. - public BTUTagDefaultHandler TagDefaultHandler + + + #endregion + + #region method + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + public void SetSettingToDefault() { - get + // set Deploynumber + int appDeploy; + bool parseResult = int.TryParse(Constants.DeploymentNumber, out appDeploy); + if (parseResult) { - return App.LoadFromAppState(Constants.AppSetting_BTUTagDefaultHandler); + this.DeploymentNumber = appDeploy; } - set - { - App.SaveToAppState(Constants.AppSetting_BTUTagDefaultHandler, value); - } + this.DevMode = false; + this.GeoWatchEnable = false; + this.InitApp = false; + this.OnlyWifi = false; + this.UniNetwork = false; + this.WifiEnable = false; + this.FunctionSettings.SetSettingToDefault(); } - #endregion } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/BTUTagSetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/BTUTagSetting.cs new file mode 100644 index 00000000..387434ee --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/BTUTagSetting.cs @@ -0,0 +1,42 @@ +using CampusAppWP8.Resources; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Model.Setting +{ + public class BTUTagSetting : ISetting + { + + #region property + + /// Gets or sets the tag default handler. + /// The tag default handler. + public BTUTagDefaultHandler TagDefaultHandler + { + get + { + return App.LoadFromAppState(Constants.AppSetting_BTUTagDefaultHandler); + } + + set + { + App.SaveToAppState(Constants.AppSetting_BTUTagDefaultHandler, value); + } + } + + #endregion + + #region method + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + public void SetSettingToDefault() + { + this.TagDefaultHandler = BTUTagDefaultHandler.InfoPage; + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs new file mode 100644 index 00000000..ad1c533b --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs @@ -0,0 +1,93 @@ +using CampusAppWP8.Pages.Setting; +using CampusAppWP8.Resources; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Model.Setting +{ + public class FunctionSettings : ISetting + { + #region member + + /// The mensa setting. + private static MensaSetting mensaSetting = new MensaSetting(); + + /// The tag setting. + private static BTUTagSetting tagSetting = new BTUTagSetting(); + + /// The time table setting. + private static TimeTableSetting timeTableSetting = new TimeTableSetting(); + + #endregion + + #region Property + + /// Gets or sets the time table setting. + /// The time table setting. + public static TimeTableSetting TimeTableSetting + { + get + { + return FunctionSettings.timeTableSetting; + } + + set + { + FunctionSettings.timeTableSetting = value; + } + } + + + /// Gets or sets the tag setting. + /// The tag setting. + public BTUTagSetting TagSetting + { + get + { + return FunctionSettings.tagSetting; + } + + set + { + if (FunctionSettings.tagSetting != value) + { + FunctionSettings.tagSetting = value; + } + } + } + + /// Gets or sets the mensa setting. + /// The mensa setting. + public MensaSetting MensaSetting + { + get + { + return FunctionSettings.mensaSetting; + } + + set + { + if (value != FunctionSettings.mensaSetting) + { + FunctionSettings.mensaSetting = value; + } + } + } + + #endregion + + #region method + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + public void SetSettingToDefault() + { + this.TagSetting.SetSettingToDefault(); + this.MensaSetting.SetSettingToDefault(); + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/ISetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/ISetting.cs new file mode 100644 index 00000000..58c05f03 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/ISetting.cs @@ -0,0 +1,18 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Declares the ISetting interface +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.Setting +{ + /// Interface for setting. + /// Stubbfel, 25.11.2013. + public interface ISetting + { + /// Sets setting to default. + void SetSettingToDefault(); + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/TimeTableSetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/TimeTableSetting.cs new file mode 100644 index 00000000..d9a38a38 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/TimeTableSetting.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements the time table setting class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.Setting +{ + /// A time table setting. + /// Stubbfel, 25.11.2013. + /// + public class TimeTableSetting : ISetting + { + + #region Property + + + #endregion + + #region method + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + /// + public void SetSettingToDefault() + { + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs index 2951d780..d0667b9e 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs @@ -8,14 +8,14 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Model.Setting { + using System; using System.Xml.Serialization; using CampusAppWP8.Resources; using CampusAppWPortalLib8.Model.Settings; /// Model for the profile of an user. /// Stubbfel, 15.10.2013. - [XmlRoot("root")] - public class UserProfilModel + public class UserProfilModel : ISetting { #region Members @@ -116,6 +116,24 @@ namespace CampusAppWP8.Model.Setting #region Methods + #region public + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + public void SetSettingToDefault() + { + // set Deploynumber + this.Course = 0; + this.DefaultCampus = Campus.CB_MAIN; + this.Degree = DegreeType.BACHELOR; + this.Role = RoleType.STUDENT; + this.Semester = this.CalcCurrentSemester(); + } + + #endregion + + #region private + /// Methods check if a value could be a valid semester. /// Stubbfel, 15.10.2013. /// value which has to be checked. @@ -144,6 +162,30 @@ namespace CampusAppWP8.Model.Setting return true; } + /// Calculates the current semester. + /// Stubbfel, 25.11.2013. + /// The calculated current semester. + private int CalcCurrentSemester() + { + DateTime now = DateTime.Now; + int result = 0; + + result = now.Year * 10; + + if (now.Month < 10) + { + result += 1; + } + else + { + result += 2; + } + + return result; + } + + #endregion + #endregion } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/BTUTag/BTUTagInfo.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/BTUTag/BTUTagInfo.xaml.cs index 5efc6e82..b396ab71 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/BTUTag/BTUTagInfo.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/BTUTag/BTUTagInfo.xaml.cs @@ -33,7 +33,7 @@ namespace CampusAppWP8.Pages.BTTTag InitializeComponent(); this.taghandlerModel = new TagHandlerListPickerItemListModel(); this.TagHandler.ItemsSource = this.taghandlerModel.List; - int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.TagDefaultHandler.ToString()); + int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler.ToString()); this.TagHandler.SelectedIndex = tagselIndex; } @@ -48,7 +48,7 @@ namespace CampusAppWP8.Pages.BTTTag { if (NavigationMode.Back == e.NavigationMode) { - Settings.AppSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); + Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Dev/QRScanner.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Dev/QRScanner.xaml.cs index 1261966f..be7014cf 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Dev/QRScanner.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Dev/QRScanner.xaml.cs @@ -251,7 +251,7 @@ namespace CampusAppWP8.Pages.Dev else { string qrContent = result.Text; - switch (Settings.AppSetting.TagDefaultHandler) + switch (Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler) { case BTUTagDefaultHandler.CampusMap: this.GoToCampusMappage(qrContent); diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs index ce8e6b74..8915c4a8 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs @@ -45,9 +45,6 @@ namespace CampusAppWP8.Pages.Setting { int oldIndex = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_GeneralSettingPageIndex); this.GeneralSettingPivot.SelectedIndex = oldIndex; - - - } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs index a04c770a..c4fa9c1f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs @@ -1,20 +1,25 @@ -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 CampusAppWP8.Resources; -using CampusAppWP8.Model.Setting; - +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements the function setting page.xaml class +//----------------------------------------------------------------------- namespace CampusAppWP8.Pages.Setting { + using System; + using System.Windows; + using System.Windows.Navigation; + using CampusAppWP8.Model.Setting; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// A function setting page. + /// Stubbfel, 25.11.2013. + /// public partial class FunctionSettingPage : PhoneApplicationPage { - #region Member /// The TagHandler model. private TagHandlerListPickerItemListModel taghandlerModel; @@ -22,15 +27,17 @@ namespace CampusAppWP8.Pages.Setting #region Constructor + /// Initializes a new instance of the FunctionSettingPage class. + /// Stubbfel, 25.11.2013. public FunctionSettingPage() { - InitializeComponent(); + this.InitializeComponent(); this.taghandlerModel = new TagHandlerListPickerItemListModel(); this.TagHandler.ItemsSource = this.taghandlerModel.List; - int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.TagDefaultHandler.ToString()); + int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler.ToString()); this.TagHandler.SelectedIndex = tagselIndex; - this.AtomMensaToggle.IsChecked = Settings.AppSetting.MensaSetting.AtomMensaSelection; + this.AtomMensaToggle.IsChecked = Settings.AppSetting.FunctionSettings.MensaSetting.AtomMensaSelection; } #endregion @@ -50,12 +57,12 @@ namespace CampusAppWP8.Pages.Setting if (NavigationMode.New == e.NavigationMode && NavigationContext.QueryString.TryGetValue(Constants.Param_FunctionSetting_Index, out functionIndex)) { - this.SetSelecetPivotItem(functionIndex); + this.SetSelectedPivotItem(functionIndex); } else { string oldIndex = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_FunctionSettingPageIndex); - this.SetSelecetPivotItem(oldIndex); + this.SetSelectedPivotItem(oldIndex); } } @@ -64,8 +71,8 @@ namespace CampusAppWP8.Pages.Setting /// protected override void OnNavigatedFrom(NavigationEventArgs e) { - Settings.AppSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); - Settings.AppSetting.MensaSetting.AtomMensaSelection = this.AtomMensaToggle.IsChecked.Value; + Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); + Settings.AppSetting.FunctionSettings.MensaSetting.AtomMensaSelection = this.AtomMensaToggle.IsChecked.Value; if (NavigationMode.Back == e.NavigationMode) { @@ -85,7 +92,10 @@ namespace CampusAppWP8.Pages.Setting #region private - private void SetSelecetPivotItem(string itemTag) + /// Sets selected pivot item. + /// Stubbfel, 25.11.2013. + /// The item tag. + private void SetSelectedPivotItem(string itemTag) { if (itemTag != null) { @@ -99,8 +109,8 @@ namespace CampusAppWP8.Pages.Setting } } } - this.SettingFunctionPivot.SelectedIndex = 0; + this.SettingFunctionPivot.SelectedIndex = 0; } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs index 7dc25dac..12fa0106 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs @@ -1,11 +1,24 @@ -using CampusAppWP8.Resources; - +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements the mensa setting class +//----------------------------------------------------------------------- namespace CampusAppWP8.Pages.Setting { - public class MensaSetting + using CampusAppWP8.Model.Setting; + using CampusAppWP8.Resources; + + /// A mensa setting. + /// Stubbfel, 25.11.2013. + public class MensaSetting : ISetting { #region Property + /// Gets or sets a value indicating whether the atom mensa selection. + /// true if atom mensa selection, false if not. public bool AtomMensaSelection { get @@ -20,5 +33,16 @@ namespace CampusAppWP8.Pages.Setting } #endregion + + #region method + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + public void SetSettingToDefault() + { + // set Deploynumber + this.AtomMensaSelection = true; + } + #endregion } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 2b55eb1e..f4650dce 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -56,22 +56,17 @@ namespace CampusAppWP8.Pages TimeTable.TimeTable.InitFeed(); - if (!Settings.AppSetting.InitApp) { this.InitPlaceFile(); this.initCourseList = new CourseFeed(); this.initCourseList.OnLoaded += new CourseFeed.OnIO(this.StoreCourseFeed); this.initCourseList.LoadData(); + + Settings.SetSettingToDefault(); this.ShowOptIns(); Settings.AppSetting.InitApp = true; - int appDeploy; - bool parseResult = int.TryParse(Constants.DeploymentNumber, out appDeploy); - if (parseResult) - { - Settings.AppSetting.DeploymentNumber = appDeploy; - } } } @@ -275,7 +270,7 @@ namespace CampusAppWP8.Pages } else { - switch (Settings.AppSetting.TagDefaultHandler) + switch (Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler) { case BTUTagDefaultHandler.CampusMap: this.GoToCampusMappage(nfcContent); diff --git a/CampusAppWP8/CampusAppWP8/Settings.cs b/CampusAppWP8/CampusAppWP8/Settings.cs index 06754711..0f485ff6 100644 --- a/CampusAppWP8/CampusAppWP8/Settings.cs +++ b/CampusAppWP8/CampusAppWP8/Settings.cs @@ -1,39 +1,34 @@ //----------------------------------------------------------------------- // -// Company copyright tag. +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. // -// stubbfel -// 23.07.2013 -//---------------------------------------------------------------------- - +// Stubbfel +// 25.11.2013 +// Implements the settings class +//----------------------------------------------------------------------- namespace CampusAppWP8 { using CampusAppWP8.Model.Setting; - /// - /// Class handle all setting (files) - /// + /// Class handle all setting (files) + /// Stubbfel, 25.11.2013. + /// public static class Settings { #region Member - /// - /// reference of the user-profile-file - /// + /// reference of the user-profile-file. private static UserProfilModel userProfil = new UserProfilModel(); - /// - /// reference of the appSettings - /// + /// reference of the appSettings. private static AppSettings appSetting = new AppSettings(); #endregion #region Property - /// - /// Gets or sets the user-profile-file - /// + /// Gets or sets the user-profile-file. + /// The user profile. public static UserProfilModel UserProfil { get @@ -50,9 +45,8 @@ namespace CampusAppWP8 } } - /// - /// Gets or sets the AppSetting - /// + /// Gets or sets the AppSetting. + /// The application setting. public static AppSettings AppSetting { get @@ -73,6 +67,13 @@ namespace CampusAppWP8 #region method + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + public static void SetSettingToDefault() + { + Settings.AppSetting.SetSettingToDefault(); + Settings.UserProfil.SetSettingToDefault(); + } #endregion } diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs index d2ccdae3..5690eceb 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs @@ -169,7 +169,7 @@ namespace CampusAppWP8.Utility.Lui.Tiles { string path; string name = "NFC -> "; - switch (Settings.AppSetting.TagDefaultHandler) + switch (Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler) { case BTUTagDefaultHandler.CampusMap: path = Constants.PathCampusmap_Campusmap; From 4b022cf099ac8f6541e0613e8105a1b0c45263c8 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Mon, 25 Nov 2013 14:50:35 +0100 Subject: [PATCH 10/26] #286 done --- .../Pages/Campusmap/RoomListPage.xaml | 17 +++++++++++------ .../Pages/TimeTable/AppointmentEdit.xaml | 10 +++++++++- .../Utility/Lui/MultiValueTextBlock.xaml | 5 +++-- .../Utility/Lui/MultiValueTextBlock.xaml.cs | 18 ++++++++++++++++++ 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml index 04463450..052cbad9 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml @@ -22,9 +22,7 @@ - - - + @@ -71,10 +69,17 @@ Grid.Row="2" SelectionChanged="RoomPicker_SelectionChanged" ItemsSource="{Binding RoomPickerList, ElementName=root, Mode=OneWay}" - FullModeItemTemplate="{StaticResource RoomPickerItemTemplate}" FullModeHeader="{Binding Path=LocalizedResources.Rooms, Source={StaticResource LocalizedStrings}}" - Opacity="0"/> - + Opacity="0"> + + + + + + + + + - + + + + + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml index c7087f5b..953e0365 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml @@ -7,7 +7,8 @@ FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" + x:Name="root" > - - + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs index ef9e3484..bc77cc27 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs @@ -43,6 +43,9 @@ namespace CampusAppWP8.Utility.Lui /// The converter property. public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The text style property. + public static readonly DependencyProperty TextStyleProperty = DependencyProperty.Register("TextStyle", typeof(Style), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + #endregion // DependencyProperties #region Constructor @@ -59,6 +62,21 @@ namespace CampusAppWP8.Utility.Lui #region Properties + /// Gets or sets the text style. + /// The text style. + public Style TextStyle + { + get + { + return (Style)this.GetValue(TextStyleProperty); + } + + set + { + this.SetValue(TextStyleProperty, value); + } + } + /// Gets or sets the converter. /// The converter. public IValueConverter Converter From f721d8547c1108046332c31f6a039c037b6f850b Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 25 Nov 2013 15:30:27 +0100 Subject: [PATCH 11/26] add Locating, Network setting model --- CampusAppWP8/CampusAppWP8/App.xaml.cs | 12 +- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 2 + .../CampusAppWP8/Model/Setting/AppSettings.cs | 121 +++++++----------- .../Model/Setting/BTUTagSetting.cs | 22 ++-- .../Model/Setting/FunctionSettings.cs | 23 ++-- .../Model/Setting/LocatingSetting.cs | 48 +++++++ .../Model/Setting/NetworkSetting.cs | 89 +++++++++++++ .../Pages/Campusmap/CampusMapPage.xaml.cs | 19 +-- .../Pages/Mensa/MensaPage.xaml.cs | 9 +- .../Pages/Setting/AppSettingPage.xaml.cs | 11 +- .../CampusAppWP8/Pages/StartPage.xaml.cs | 4 +- .../CampusAppWP8/Utility/Utilities.cs | 7 +- 12 files changed, 244 insertions(+), 123 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/LocatingSetting.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/NetworkSetting.cs diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs index 3b4121ce..5bb47375 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs @@ -159,17 +159,17 @@ namespace CampusAppWP8 this.UserSettingsLoaded(); - Settings.AppSetting.UniNetwork = Utilities.IsUniNetworkAvailable(); - if (!Settings.AppSetting.UniNetwork) + Settings.AppSetting.NetworkSetting.UniNetwork = Utilities.IsUniNetworkAvailable(); + if (!Settings.AppSetting.NetworkSetting.UniNetwork) { - Settings.AppSetting.WifiEnable = Utilities.IsWifiAvailable(); + Settings.AppSetting.NetworkSetting.WifiEnable = Utilities.IsWifiAvailable(); } else { - Settings.AppSetting.WifiEnable = true; + Settings.AppSetting.NetworkSetting.WifiEnable = true; } - - if (Settings.AppSetting.GeoWatchEnable) + + if (Settings.AppSetting.LocatingSetting.GeoWatchEnable) { Thread thread = new Thread(new ThreadStart(this.PositionThread)); thread.Start(); diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 4f651921..56429e69 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -136,6 +136,8 @@ + + diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs index 7cf9b100..e4f482f8 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs @@ -20,23 +20,62 @@ namespace CampusAppWP8.Model.Setting /// The mensa setting. private static FunctionSettings functionSetting = new FunctionSettings(); - /// The tag setting. - private static BTUTagSetting tagSetting = new BTUTagSetting(); + /// The network setting. + private static NetworkSetting networkSetting = new NetworkSetting(); + + /// The locating setting. + private static LocatingSetting locatingSetting = new LocatingSetting(); #endregion #region Property - /// Gets or sets the tag setting. - /// The tag setting. + /// Gets or sets the locating setting. + /// The locating setting. + public LocatingSetting LocatingSetting + { + get + { + return AppSettings.locatingSetting; + } + + set + { + if (AppSettings.locatingSetting != value) + { + AppSettings.locatingSetting = value; + } + } + } + + /// Gets or sets the network setting. + /// The network setting. + public NetworkSetting NetworkSetting + { + get + { + return AppSettings.networkSetting; + } + + set + { + if (AppSettings.networkSetting != value) + { + AppSettings.networkSetting = value; + } + } + } + + /// Gets or sets the function settings. + /// The function settings. public FunctionSettings FunctionSettings { get { - return AppSettings.functionSetting; + return AppSettings.functionSetting; } - set + set { if (AppSettings.functionSetting != value) { @@ -45,21 +84,6 @@ namespace CampusAppWP8.Model.Setting } } - /// Gets or sets a value indicating whether the GeoWatch-Flag. - /// true if geo watch enable, false if not. - public bool GeoWatchEnable - { - get - { - return App.LoadFromAppState(Constants.AppSetting_GeoWatchEnable); - } - - set - { - App.SaveToAppState(Constants.AppSetting_GeoWatchEnable, value); - } - } - /// Gets or sets a value indicating whether the InitializationApp-Flag. /// true if initialise application, false if not. public bool InitApp @@ -90,51 +114,6 @@ namespace CampusAppWP8.Model.Setting } } - /// Gets or sets a value indicating whether the uni network. - /// true if uni network, false if not. - public bool UniNetwork - { - get - { - return App.LoadFromAppState(Constants.AppSetting_UniNet); - } - - set - { - App.SaveToAppState(Constants.AppSetting_UniNet, value); - } - } - - /// Gets or sets a value indicating whether this object is WiFi enable. - /// true if WiFi enable, false if not. - public bool WifiEnable - { - get - { - return App.LoadFromAppState(Constants.AppSetting_WifiEnable); - } - - set - { - App.SaveToAppState(Constants.AppSetting_WifiEnable, value); - } - } - - /// Gets or sets a value indicating whether the only WiFi. - /// true if only wifi, false if not. - public bool OnlyWifi - { - get - { - return App.LoadFromAppState(Constants.AppSetting_OnlyWifi); - } - - set - { - App.SaveToAppState(Constants.AppSetting_OnlyWifi, value); - } - } - /// Gets or sets the DeploymentNumber of the app. /// The deployment number. public int DeploymentNumber @@ -150,8 +129,6 @@ namespace CampusAppWP8.Model.Setting } } - - #endregion #region method @@ -169,12 +146,10 @@ namespace CampusAppWP8.Model.Setting } this.DevMode = false; - this.GeoWatchEnable = false; this.InitApp = false; - this.OnlyWifi = false; - this.UniNetwork = false; - this.WifiEnable = false; - this.FunctionSettings.SetSettingToDefault(); + this.FunctionSettings.SetSettingToDefault(); + this.NetworkSetting.SetSettingToDefault(); + this.LocatingSetting.SetSettingToDefault(); } #endregion } diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/BTUTagSetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/BTUTagSetting.cs index 387434ee..ee3c3f5f 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/BTUTagSetting.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/BTUTagSetting.cs @@ -1,15 +1,20 @@ -using CampusAppWP8.Resources; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements the btu tag setting class +//----------------------------------------------------------------------- namespace CampusAppWP8.Model.Setting { + using CampusAppWP8.Resources; + + /// A btu tag setting. + /// Stubbfel, 25.11.2013. + /// public class BTUTagSetting : ISetting { - #region property /// Gets or sets the tag default handler. @@ -33,6 +38,7 @@ namespace CampusAppWP8.Model.Setting /// Sets setting to default. /// Stubbfel, 25.11.2013. + /// public void SetSettingToDefault() { this.TagDefaultHandler = BTUTagDefaultHandler.InfoPage; diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs index ad1c533b..d4bc884a 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs @@ -1,13 +1,18 @@ -using CampusAppWP8.Pages.Setting; -using CampusAppWP8.Resources; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements the function settings class +//----------------------------------------------------------------------- namespace CampusAppWP8.Model.Setting { + using CampusAppWP8.Pages.Setting; + + /// A function settings. + /// Stubbfel, 25.11.2013. + /// public class FunctionSettings : ISetting { #region member @@ -40,7 +45,6 @@ namespace CampusAppWP8.Model.Setting } } - /// Gets or sets the tag setting. /// The tag setting. public BTUTagSetting TagSetting @@ -83,6 +87,7 @@ namespace CampusAppWP8.Model.Setting /// Sets setting to default. /// Stubbfel, 25.11.2013. + /// public void SetSettingToDefault() { this.TagSetting.SetSettingToDefault(); diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/LocatingSetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/LocatingSetting.cs new file mode 100644 index 00000000..1fd3bb80 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/LocatingSetting.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements the locating setting class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.Setting +{ + using CampusAppWP8.Resources; + + /// A locating setting. + /// Stubbfel, 25.11.2013. + /// + public class LocatingSetting : ISetting + { + #region property + + /// Gets or sets a value indicating whether the GeoWatch-Flag. + /// true if geo watch enable, false if not. + public bool GeoWatchEnable + { + get + { + return App.LoadFromAppState(Constants.AppSetting_GeoWatchEnable); + } + + set + { + App.SaveToAppState(Constants.AppSetting_GeoWatchEnable, value); + } + } + + #endregion + + #region method + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + /// + public void SetSettingToDefault() + { + this.GeoWatchEnable = false; + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/NetworkSetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/NetworkSetting.cs new file mode 100644 index 00000000..f8e52d56 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/NetworkSetting.cs @@ -0,0 +1,89 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements the network setting class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.Setting +{ + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + + /// A network setting. + /// Stubbfel, 25.11.2013. + /// + public class NetworkSetting : ISetting + { + #region property + + /// Gets or sets a value indicating whether the uni network. + /// true if uni network, false if not. + public bool UniNetwork + { + get + { + return App.LoadFromAppState(Constants.AppSetting_UniNet); + } + + set + { + App.SaveToAppState(Constants.AppSetting_UniNet, value); + } + } + + /// Gets or sets a value indicating whether this object is WiFi enable. + /// true if WiFi enable, false if not. + public bool WifiEnable + { + get + { + return App.LoadFromAppState(Constants.AppSetting_WifiEnable); + } + + set + { + App.SaveToAppState(Constants.AppSetting_WifiEnable, value); + } + } + + /// Gets or sets a value indicating whether the only WiFi. + /// true if only wifi, false if not. + public bool OnlyWifi + { + get + { + return App.LoadFromAppState(Constants.AppSetting_OnlyWifi); + } + + set + { + App.SaveToAppState(Constants.AppSetting_OnlyWifi, value); + } + } + + #endregion + + #region method + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + /// + public void SetSettingToDefault() + { + this.OnlyWifi = false; + + this.UniNetwork = Utilities.IsUniNetworkAvailable(); + if (!this.UniNetwork) + { + this.WifiEnable = Utilities.IsWifiAvailable(); + } + else + { + this.WifiEnable = true; + } + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs index 1cab6f8f..84c996c0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs @@ -175,7 +175,7 @@ namespace CampusAppWP8.Pages.Campusmap } } - if (device != null) + if (this.device != null) { this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler); } @@ -186,7 +186,7 @@ namespace CampusAppWP8.Pages.Campusmap /// protected override void OnNavigatedFrom(NavigationEventArgs e) { - if (device != null) + if (this.device != null) { this.device.StopSubscribingForMessage(this.ndefId); } @@ -495,10 +495,11 @@ namespace CampusAppWP8.Pages.Campusmap /// the message of the device. private void NDEFHandler(ProximityDevice sender, ProximityMessage message) { - if (device == null) + if (this.device == null) { return; } + // create ndefMessage this.device.StopSubscribingForMessage(message.SubscriptionId); var ndefMessage = message.Data; @@ -558,7 +559,7 @@ namespace CampusAppWP8.Pages.Campusmap { this.DefHeader.ProgressVisibility = Visibility.Collapsed; } - + this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler); } @@ -603,7 +604,7 @@ namespace CampusAppWP8.Pages.Campusmap /// The places. /// The type. /// (Optional) the scroll. - private void AddPins(List places,PinType type, bool scroll = true) + private void AddPins(List places, PinType type, bool scroll = true) { foreach (PlaceModel place in places) { @@ -687,7 +688,7 @@ namespace CampusAppWP8.Pages.Campusmap /// (Optional) the scroll. private void ShowCurrentPosition(bool scroll = true) { - if (Settings.AppSetting.GeoWatchEnable) + if (Settings.AppSetting.LocatingSetting.GeoWatchEnable) { Utilities.DetermineAndStoreCurrentPositionForce(); if (this.Dispatcher != null) @@ -720,7 +721,7 @@ namespace CampusAppWP8.Pages.Campusmap GeoMapPoint currentPosition = App.LoadFromAppState(Constants.GeoWatch_CurrentPositionPoint); if (currentPosition == null || currentPosition.Latitude == 0 || currentPosition.Longitude == 0) { - if (Settings.AppSetting.GeoWatchEnable) + if (Settings.AppSetting.LocatingSetting.GeoWatchEnable) { MessageBoxes.ShowMainModelInfoMessageBox(AppResources.MsgBox_NoLocation); } @@ -730,7 +731,7 @@ namespace CampusAppWP8.Pages.Campusmap else { this.ClearMap(new List() { MapPinModel.CurrentPositionPlacePinString }); - this.SetPinToPosition(currentPosition.Latitude,currentPosition.Longitude, PinType.CurrentPosition, scroll); + this.SetPinToPosition(currentPosition.Latitude, currentPosition.Longitude, PinType.CurrentPosition, scroll); } } @@ -850,7 +851,7 @@ namespace CampusAppWP8.Pages.Campusmap { this.SearchByText(sender, e); this.MapScroller.Focus(); - } + } } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs index e837fc79..a6770bd0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs @@ -49,7 +49,7 @@ namespace CampusAppWP8.Pages.Mensa private bool forceLoad = false; /// Identifier for the location. - public int locationID = -1; + private int locationID = -1; #endregion @@ -231,7 +231,7 @@ namespace CampusAppWP8.Pages.Mensa /// Stubbfel, 15.10.2013. private void InitializeFeed() { - if (Settings.AppSetting.GeoWatchEnable) + if (Settings.AppSetting.LocatingSetting.GeoWatchEnable) { Thread thread = new Thread(new ThreadStart(this.DeterminCurrentCampusAndLoadFeed)); thread.Start(); @@ -445,7 +445,6 @@ namespace CampusAppWP8.Pages.Mensa copyText = Wp8StringManager.AddNewLine(copyText); } - Clipboard.SetText(copyText); } @@ -455,7 +454,6 @@ namespace CampusAppWP8.Pages.Mensa /// Event information. private void CopyWeek(object sender, EventArgs e) { - if (this.MensaPivot == null || this.feed == null || this.feed.Model == null) { return; @@ -471,6 +469,7 @@ namespace CampusAppWP8.Pages.Mensa { startDate = menu.Date; } + endDate = menu.Date; copyText += menu.Day + " (" + menu.Date + "):"; @@ -481,8 +480,8 @@ namespace CampusAppWP8.Pages.Mensa copyText += meal.MealName + ": " + meal.MealDesc; copyText = Wp8StringManager.AddNewLine(copyText); } - copyText = Wp8StringManager.AddNewLine(copyText); + copyText = Wp8StringManager.AddNewLine(copyText); } string headline = AppResources.MensaApp_Weekplan + " (" + startDate + " - " + endDate + ") - " + AppResources.Setting_UserCampus + " " + this.feed.Title + " :"; diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs index 8915c4a8..246694da 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs @@ -9,8 +9,8 @@ namespace CampusAppWP8.Pages.Setting { using System.Windows.Navigation; - using Microsoft.Phone.Controls; using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; /// Class for the AppSettingPage. /// Stubbfel, 15.10.2013. @@ -24,8 +24,8 @@ namespace CampusAppWP8.Pages.Setting public AppSettingPage() { this.InitializeComponent(); - this.GeoWatchToggle.IsChecked = Settings.AppSetting.GeoWatchEnable; - this.OnlyWiFiToggle.IsChecked = Settings.AppSetting.OnlyWifi; + this.GeoWatchToggle.IsChecked = Settings.AppSetting.LocatingSetting.GeoWatchEnable; + this.OnlyWiFiToggle.IsChecked = Settings.AppSetting.NetworkSetting.OnlyWifi; } #endregion @@ -55,15 +55,14 @@ namespace CampusAppWP8.Pages.Setting { if (NavigationMode.Back == e.NavigationMode) { - Settings.AppSetting.GeoWatchEnable = GeoWatchToggle.IsChecked.Value; - Settings.AppSetting.OnlyWifi = OnlyWiFiToggle.IsChecked.Value; + Settings.AppSetting.LocatingSetting.GeoWatchEnable = GeoWatchToggle.IsChecked.Value; + Settings.AppSetting.NetworkSetting.OnlyWifi = OnlyWiFiToggle.IsChecked.Value; App.SaveToIsolatedStorage(Constants.IsolatedStorage_GeneralSettingPageIndex, 0); } else { App.SaveToIsolatedStorage(Constants.IsolatedStorage_FunctionSettingPageIndex, this.GeneralSettingPivot.SelectedIndex); } - } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index f4650dce..0961501c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -144,13 +144,13 @@ namespace CampusAppWP8.Pages if (result == MessageBoxResult.OK) { - Settings.AppSetting.GeoWatchEnable = true; + Settings.AppSetting.LocatingSetting.GeoWatchEnable = true; Thread thread = new Thread(new ThreadStart(this.PositionThread)); thread.Start(); } else { - Settings.AppSetting.GeoWatchEnable = false; + Settings.AppSetting.LocatingSetting.GeoWatchEnable = false; } } diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs index f1df31c3..837224a2 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -230,7 +230,7 @@ namespace CampusAppWP8.Utility /// the position of the phone. public static GeoPosition DetermineCurrentPosition(GeoPositionAccuracy accuracy = GeoPositionAccuracy.High) { - if (!Settings.AppSetting.GeoWatchEnable) + if (!Settings.AppSetting.LocatingSetting.GeoWatchEnable) { return null; } @@ -351,7 +351,7 @@ namespace CampusAppWP8.Utility /// The load modus< t> public static ForceType GetLoadModus() { - if (Settings.AppSetting.OnlyWifi && !Settings.AppSetting.WifiEnable) + if (Settings.AppSetting.NetworkSetting.OnlyWifi && !Settings.AppSetting.NetworkSetting.WifiEnable) { return ForceType.FORCE_FILE; } @@ -381,8 +381,6 @@ namespace CampusAppWP8.Utility public static Campus DetermineCampus(GeoPositionAccuracy accuracy = GeoPositionAccuracy.Default) { Campus result = Campus.UserSettingCampus; - - Utilities.DetermineAndStoreCurrentPosition(accuracy); MapPoint currentPoint = App.LoadFromAppState("CurrentGeoPoint"); @@ -390,7 +388,6 @@ namespace CampusAppWP8.Utility { if (accuracy.Equals(GeoPositionAccuracy.High)) { - return result; } else From 3a7be7d7549031afff8aadc7bbf25ea66e79ab0b Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 25 Nov 2013 16:06:46 +0100 Subject: [PATCH 12/26] add settingstypes --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 1 + .../Model/Setting/FunctionSettings.cs | 2 +- .../Model/Setting/SettingsTypes.cs | 48 +++++++++++ .../CampusAppWP8/Pages/StartPage.xaml.cs | 1 + .../Resources/AppResources.Designer.cs | 4 +- .../CampusAppWP8/Resources/AppResources.resx | 4 +- .../CampusAppWP8/Resources/Constants.resx | 29 ++++++- .../Resources/Constants1.Designer.cs | 83 ++++++++++++++++++- CampusAppWP8/CampusAppWP8/Settings.cs | 46 +++++++++- .../CampusAppWP8/Utility/Utilities.cs | 1 - 10 files changed, 210 insertions(+), 9 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/SettingsTypes.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 56429e69..6b914ab1 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -138,6 +138,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs index d4bc884a..3d494455 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs @@ -32,7 +32,7 @@ namespace CampusAppWP8.Model.Setting /// Gets or sets the time table setting. /// The time table setting. - public static TimeTableSetting TimeTableSetting + public TimeTableSetting TimeTableSetting { get { diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/SettingsTypes.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/SettingsTypes.cs new file mode 100644 index 00000000..4aafc392 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/SettingsTypes.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements the settings types class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.Setting +{ + /// Values that represent SettingType. + /// Stubbfel, 25.11.2013. + public enum SettingType + { + /// An enum constant representing the setting option. + Setting, + + /// An enum constant representing the appsetting option. + Appsetting, + + /// An enum constant representing the user setting option. + UserSetting, + + /// An enum constant representing the appsetting functionsetting option. + Appsetting_Functionsetting, + + /// An enum constant representing the appsetting networksetting option. + Appsetting_Networksetting, + + /// An enum constant representing the appsetting locatingsetting option. + Appsetting_Locatingsetting, + + /// + /// An enum constant representing the appsetting functionsetting mensasetting option. + /// + Appsetting_Functionsetting_Mensasetting, + + /// + /// An enum constant representing the appsetting functionsetting tagsetting option. + /// + Appsetting_Functionsetting_Tagsetting, + + /// + /// An enum constant representing the appsetting functionsetting time tablesetting option. + /// + Appsetting_Functionsetting_TimeTablesetting + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 0961501c..79081ac9 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -68,6 +68,7 @@ namespace CampusAppWP8.Pages Settings.AppSetting.InitApp = true; } + Settings.SetSettingToDefault("APPSETTING"); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index b90c5f67..933f65e5 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1222,7 +1222,7 @@ namespace CampusAppWP8.Resources { } /// - /// Sucht eine lokalisierte Zeichenfolge, die autom. Mensaauswahl ähnelt. + /// Sucht eine lokalisierte Zeichenfolge, die autom. Mensa-Auswahl ähnelt. /// public static string Setting_AtomMensaSelection { get { @@ -1249,7 +1249,7 @@ namespace CampusAppWP8.Resources { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Ortung & Netzwerk ähnelt. + /// Sucht eine lokalisierte Zeichenfolge, die Ort. & Netzw. ähnelt. /// public static string Setting_GeneralNetwork { get { diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 28f3bd7b..371bc0db 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -633,13 +633,13 @@ Räume - autom. Mensaauswahl + autom. Mensa-Auswahl Funktionseinstellungen - Ortung & Netzwerk + Ort. & Netzw. Sonstige Einstellungen diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 44fe75b6..7d604fab 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -274,7 +274,7 @@ 767 - 20131 + 20132 20121 @@ -648,4 +648,31 @@ /Pages/Setting/FunctionSettingPage.xaml + + UserSetting + + + AppSetting + + + Appsetting_Locatingsetting + + + Appsetting_Networksetting + + + Appsetting_Functionsetting + + + Appsetting_Functionsetting_Mensasetting + + + Appsetting_Functionsetting_Tagsetting + + + Appsetting_Functionsetting_TimeTablesetting + + + Setting + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index fb4eb158..f54a77c0 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -1383,6 +1383,69 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die AppSetting ähnelt. + /// + public static string Setting_AppSetting_Enum { + get { + return ResourceManager.GetString("Setting_AppSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Locatingsetting ähnelt. + /// + public static string Setting_AppSetting_LocatingSetting_Enum { + get { + return ResourceManager.GetString("Setting_AppSetting_LocatingSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Networksetting ähnelt. + /// + public static string Setting_AppSetting_NetworkSetting_Enum { + get { + return ResourceManager.GetString("Setting_AppSetting_NetworkSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting ähnelt. + /// + public static string Setting_ApSetting_FunctionSetting_Enum { + get { + return ResourceManager.GetString("Setting_ApSetting_FunctionSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_Mensasetting ähnelt. + /// + public static string Setting_ApSetting_FunctionSetting_MensaSetting_Enum { + get { + return ResourceManager.GetString("Setting_ApSetting_FunctionSetting_MensaSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_Tagsetting ähnelt. + /// + public static string Setting_ApSetting_FunctionSetting_TagSetting_Enum { + get { + return ResourceManager.GetString("Setting_ApSetting_FunctionSetting_TagSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_TimeTablesetting ähnelt. + /// + public static string Setting_ApSetting_FunctionSetting_TimeTableSetting_Enum { + get { + return ResourceManager.GetString("Setting_ApSetting_FunctionSetting_TimeTableSetting_Enum", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die 767 ähnelt. /// @@ -1393,7 +1456,7 @@ namespace CampusAppWP8.Resources { } /// - /// Sucht eine lokalisierte Zeichenfolge, die 20131 ähnelt. + /// Sucht eine lokalisierte Zeichenfolge, die 20132 ähnelt. /// public static string Setting_DefaultSemester { get { @@ -1401,6 +1464,24 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Setting ähnelt. + /// + public static string Setting_Enum { + get { + return ResourceManager.GetString("Setting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die UserSetting ähnelt. + /// + public static string Settingt_UserSetting_Enum { + get { + return ResourceManager.GetString("Settingt_UserSetting_Enum", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die 1 ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Settings.cs b/CampusAppWP8/CampusAppWP8/Settings.cs index 0f485ff6..2f4dac9a 100644 --- a/CampusAppWP8/CampusAppWP8/Settings.cs +++ b/CampusAppWP8/CampusAppWP8/Settings.cs @@ -8,7 +8,9 @@ //----------------------------------------------------------------------- namespace CampusAppWP8 { + using System; using CampusAppWP8.Model.Setting; + using CampusAppWP8.Resources; /// Class handle all setting (files) /// Stubbfel, 25.11.2013. @@ -69,12 +71,54 @@ namespace CampusAppWP8 /// Sets setting to default. /// Stubbfel, 25.11.2013. - public static void SetSettingToDefault() + public static void SetSettingToDefault() { Settings.AppSetting.SetSettingToDefault(); Settings.UserProfil.SetSettingToDefault(); } + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + /// The setting key. + public static void SetSettingToDefault(string settingKey) + { + SettingType type = (SettingType)Enum.Parse(typeof(SettingType), settingKey); + + switch (type) + { + case SettingType.Appsetting: + AppSetting.SetSettingToDefault(); + break; + case SettingType.UserSetting: + UserProfil.SetSettingToDefault(); + break; + case SettingType.Appsetting_Functionsetting: + AppSetting.FunctionSettings.SetSettingToDefault(); + break; + case SettingType.Appsetting_Locatingsetting: + AppSetting.LocatingSetting.SetSettingToDefault(); + break; + case SettingType.Appsetting_Networksetting: + AppSetting.NetworkSetting.SetSettingToDefault(); + break; + case SettingType.Appsetting_Functionsetting_Mensasetting: + AppSetting.FunctionSettings.MensaSetting.SetSettingToDefault(); + break; + case SettingType.Appsetting_Functionsetting_Tagsetting: + AppSetting.FunctionSettings.TagSetting.SetSettingToDefault(); + break; + case SettingType.Appsetting_Functionsetting_TimeTablesetting: + AppSetting.FunctionSettings.TimeTableSetting.SetSettingToDefault(); + break; + case SettingType.Setting: + Settings.SetSettingToDefault(); + break; + default: + Settings.SetSettingToDefault(); + break; + } + } + #endregion } } diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs index 837224a2..70a4f339 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -445,7 +445,6 @@ namespace CampusAppWP8.Utility obj.SelectedIndex = -1; } } - #endregion } } \ No newline at end of file From 8e5d7617482523e07435a306902889e927bf1864 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 25 Nov 2013 16:34:51 +0100 Subject: [PATCH 13/26] add todefault button and refreshpage interface --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 4 +- .../Model/Setting/FunctionSettings.cs | 1 - .../{Pages => Model}/Setting/MensaSetting.cs | 3 +- .../Pages/Setting/IRefreshingPage.cs | 18 +++++ .../Utility/Lui/Button/ToDefaultButton.cs | 79 +++++++++++++++++++ 5 files changed, 101 insertions(+), 4 deletions(-) rename CampusAppWP8/CampusAppWP8/{Pages => Model}/Setting/MensaSetting.cs (95%) create mode 100644 CampusAppWP8/CampusAppWP8/Pages/Setting/IRefreshingPage.cs create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToDefaultButton.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 6b914ab1..284780aa 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -147,7 +147,8 @@ FunctionSettingPage.xaml - + + Appointment.xaml @@ -259,6 +260,7 @@ + DefaultHeader.xaml diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs index 3d494455..21585799 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/FunctionSettings.cs @@ -8,7 +8,6 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Model.Setting { - using CampusAppWP8.Pages.Setting; /// A function settings. /// Stubbfel, 25.11.2013. diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs similarity index 95% rename from CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs rename to CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs index 12fa0106..8092d939 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/MensaSetting.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs @@ -6,9 +6,8 @@ // 25.11.2013 // Implements the mensa setting class //----------------------------------------------------------------------- -namespace CampusAppWP8.Pages.Setting +namespace CampusAppWP8.Model.Setting { - using CampusAppWP8.Model.Setting; using CampusAppWP8.Resources; /// A mensa setting. diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/IRefreshingPage.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/IRefreshingPage.cs new file mode 100644 index 00000000..717f4aa2 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/IRefreshingPage.cs @@ -0,0 +1,18 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Declares the IRefreshingPage interface +//----------------------------------------------------------------------- +namespace CampusAppWP8.Pages.Setting +{ + /// Interface for refreshing page. + /// Stubbfel, 25.11.2013. + public interface IRefreshingPage + { + /// Refresh page. + void RefreshPage(); + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToDefaultButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToDefaultButton.cs new file mode 100644 index 00000000..b858e467 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToDefaultButton.cs @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 25.11.2013 +// Implements to default button class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media.Imaging; + using CampusAppWP8.Resources; + using CampusAppWP8.Pages.Setting; + + /// Add person button. + /// Stubbfel, 12.09.2013. + /// + public class ToDefaultButton : System.Windows.Controls.Button + { + #region Member + + /// The person identifier property. + public static readonly DependencyProperty SettingTypeProperty = DependencyProperty.Register("SettingType", typeof(object), typeof(ToDefaultButton), new PropertyMetadata(false)); + + /// The icon. + private static BitmapImage icon = new BitmapImage(new Uri(Icons.Link, UriKind.Relative)); + + #endregion + + #region Constructor + + /// Initializes a new instance of the ToDefaultButton class. + /// Stubbfel, 25.11.2013. + public ToDefaultButton() + : base() + { + this.Content = new Image + { + Source = icon + }; + } + + #endregion + + #region Property + + /// Gets or sets the type of the setting. + /// The type of the setting. + public object SettingType + { + get { return (object)this.GetValue(SettingTypeProperty); } + set { this.SetValue(SettingTypeProperty, value); } + } + + /// + /// Löst das -Ereignis + /// aus. + /// + /// Stubbfel, 25.11.2013. + /// + protected override void OnClick() + { + if (this.SettingType != null) + { + Settings.SetSettingToDefault(this.SettingType.ToString()); + Page page = App.RootFrame.Content as Page; + if (page.GetType().IsAssignableFrom(typeof(IRefreshingPage))) + { + ((IRefreshingPage)page).RefreshPage(); + } + } + } + + #endregion + } +} From 41780b5c35b2f6fd40f9d8f6eb04186684d1da0a Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 25 Nov 2013 18:43:36 +0100 Subject: [PATCH 14/26] finish #282 --- CampusAppWP8/CampusAppWP8/App.xaml | 1 + CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 5 + .../Model/Setting/MensaSetting.cs | 38 +++++ .../Pages/Setting/AppSettingPage.xaml | 97 ++++++++---- .../Pages/Setting/AppSettingPage.xaml.cs | 53 ++++++- .../Pages/Setting/FunctionSettingPage.xaml | 148 ++++++++++++++---- .../Pages/Setting/FunctionSettingPage.xaml.cs | 82 ++++++++-- .../Pages/Setting/UserProfil.xaml | 6 + .../Pages/Setting/UserProfil.xaml.cs | 10 ++ .../CampusAppWP8/Pages/StartPage.xaml.cs | 2 - .../Resources/AppResources.Designer.cs | 47 +++++- .../CampusAppWP8/Resources/AppResources.resx | 17 +- .../CampusAppWP8/Resources/Constants.resx | 11 +- .../Resources/Constants1.Designer.cs | 81 +++++----- CampusAppWP8/CampusAppWP8/Settings.cs | 6 + CampusAppWP8/CampusAppWP8/Styles/Labels.xaml | 13 ++ .../Lui/Button/ResetSettingButtonAppBar.cs | 43 +++++ .../Utility/Lui/Button/ToDefaultButton.cs | 5 +- .../Utility/CampusListPickerItemListModel.cs | 13 +- .../Resources/AppResources.Designer.cs | 9 ++ .../Resources/AppResources.resx | 3 + 21 files changed, 564 insertions(+), 126 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Styles/Labels.xaml create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ResetSettingButtonAppBar.cs diff --git a/CampusAppWP8/CampusAppWP8/App.xaml b/CampusAppWP8/CampusAppWP8/App.xaml index a4aef1d3..1d6fd99b 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml +++ b/CampusAppWP8/CampusAppWP8/App.xaml @@ -12,6 +12,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 284780aa..0fbc7b96 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -260,6 +260,7 @@ + DefaultHeader.xaml @@ -541,6 +542,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs index 8092d939..7bd45f60 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs @@ -9,6 +9,7 @@ namespace CampusAppWP8.Model.Setting { using CampusAppWP8.Resources; +using CampusAppWPortalLib8.Model.Settings; /// A mensa setting. /// Stubbfel, 25.11.2013. @@ -31,6 +32,42 @@ namespace CampusAppWP8.Model.Setting } } + /// Gets or sets the default mensa. + /// The default mensa. + public Campus DefaultMensa + { + get + { + return App.LoadFromAppState(Constants.Setting_Mensa_DefaultCampus); + } + + set + { + App.SaveToAppState(Constants.Setting_Mensa_DefaultCampus, value); + } + } + + /// Gets or sets the selected mensa. + /// The selected mensa. + public Campus SelectedMensa + { + get + { + Campus mensa = App.LoadFromAppState(Constants.Setting_Mensa_DefaultCampus); + if (mensa == Campus.UserSettingCampus) + { + mensa = Settings.UserProfil.DefaultCampus; + } + return mensa; + } + + set + { + App.SaveToAppState(Constants.Setting_Mensa_DefaultCampus, value); + } + } + + #endregion #region method @@ -41,6 +78,7 @@ namespace CampusAppWP8.Model.Setting { // set Deploynumber this.AtomMensaSelection = true; + this.DefaultMensa = Campus.UserSettingCampus; } #endregion } diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml index b0a5ca68..6762f89b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml @@ -39,13 +39,11 @@ - + - - - + @@ -53,52 +51,91 @@ + + + + + + + + - + - - - - - - - + + + + + + + + + + + + - - - - - + + + + - - - - - + + + + - - - - + + + + + + + + + + + + + - + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs index 246694da..cd6422bf 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs @@ -8,6 +8,7 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Pages.Setting { + using System; using System.Windows.Navigation; using CampusAppWP8.Resources; using Microsoft.Phone.Controls; @@ -15,7 +16,7 @@ namespace CampusAppWP8.Pages.Setting /// Class for the AppSettingPage. /// Stubbfel, 15.10.2013. /// - public partial class AppSettingPage : PhoneApplicationPage + public partial class AppSettingPage : PhoneApplicationPage, IRefreshingPage { #region Constructor @@ -24,14 +25,25 @@ namespace CampusAppWP8.Pages.Setting public AppSettingPage() { this.InitializeComponent(); - this.GeoWatchToggle.IsChecked = Settings.AppSetting.LocatingSetting.GeoWatchEnable; - this.OnlyWiFiToggle.IsChecked = Settings.AppSetting.NetworkSetting.OnlyWifi; + this.LoadSettings(); } #endregion #region Method + #region public + + /// Refresh page. + /// Stubbfel, 25.11.2013. + /// + public void RefreshPage() + { + this.LoadSettings(); + } + #endregion + + #region protected /// Override the OnNavigatedTo method. /// Stubbfel, 15.10.2013. /// @@ -40,7 +52,6 @@ namespace CampusAppWP8.Pages.Setting base.OnNavigatedTo(e); string functionIndex; - if (NavigationMode.New != e.NavigationMode && NavigationContext.QueryString.TryGetValue(Constants.Param_FunctionSetting_Index, out functionIndex)) { int oldIndex = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_GeneralSettingPageIndex); @@ -55,8 +66,7 @@ namespace CampusAppWP8.Pages.Setting { if (NavigationMode.Back == e.NavigationMode) { - Settings.AppSetting.LocatingSetting.GeoWatchEnable = GeoWatchToggle.IsChecked.Value; - Settings.AppSetting.NetworkSetting.OnlyWifi = OnlyWiFiToggle.IsChecked.Value; + this.SaveSettings(); App.SaveToIsolatedStorage(Constants.IsolatedStorage_GeneralSettingPageIndex, 0); } else @@ -66,5 +76,36 @@ namespace CampusAppWP8.Pages.Setting } #endregion + + #region private + /// Loads the settings. + /// Stubbfel, 25.11.2013. + private void LoadSettings() + { + this.GeoWatchToggle.IsChecked = Settings.AppSetting.LocatingSetting.GeoWatchEnable; + this.OnlyWiFiToggle.IsChecked = Settings.AppSetting.NetworkSetting.OnlyWifi; + } + + /// Saves the settings. + /// Stubbfel, 25.11.2013. + private void SaveSettings() + { + Settings.AppSetting.LocatingSetting.GeoWatchEnable = GeoWatchToggle.IsChecked.Value; + Settings.AppSetting.NetworkSetting.OnlyWifi = OnlyWiFiToggle.IsChecked.Value; + } + + /// Event handler. Called by ResetSettingButtonAppBar for click events. + /// Stubbfel, 25.11.2013. + /// Source of the event. + /// Event information. + private void ResetSettingButtonAppBar_Click(object sender, EventArgs e) + { + Settings.AppSetting.SetSettingToDefault(); + this.LoadSettings(); + } + + #endregion + + #endregion } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml index 703441f0..964d3ef6 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml @@ -30,7 +30,7 @@ Name="DefHeader" HeaderName="{Binding Path=LocalizedResources.Setting_Function, Source={StaticResource LocalizedStrings}}"/> - + @@ -38,53 +38,137 @@ - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs index c4fa9c1f..b1956ad7 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/FunctionSettingPage.xaml.cs @@ -14,15 +14,19 @@ namespace CampusAppWP8.Pages.Setting using CampusAppWP8.Model.Setting; using CampusAppWP8.Resources; using Microsoft.Phone.Controls; + using CampusAppWPortalLib8.Model.Utility; /// A function setting page. /// Stubbfel, 25.11.2013. /// - public partial class FunctionSettingPage : PhoneApplicationPage + public partial class FunctionSettingPage : PhoneApplicationPage, IRefreshingPage { #region Member /// The TagHandler model. private TagHandlerListPickerItemListModel taghandlerModel; + + /// List of campus. + private CampusListPickerItemListModel campusList; #endregion #region Constructor @@ -32,18 +36,24 @@ namespace CampusAppWP8.Pages.Setting public FunctionSettingPage() { this.InitializeComponent(); - this.taghandlerModel = new TagHandlerListPickerItemListModel(); - this.TagHandler.ItemsSource = this.taghandlerModel.List; - int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler.ToString()); - this.TagHandler.SelectedIndex = tagselIndex; - - this.AtomMensaToggle.IsChecked = Settings.AppSetting.FunctionSettings.MensaSetting.AtomMensaSelection; + this.LoadSettings(); } #endregion #region Methods + #region public + + /// Refresh page. + /// Stubbfel, 25.11.2013. + /// + public void RefreshPage() + { + this.LoadSettings(); + } + #endregion + #region protected /// Override the OnNavigatedTo method. @@ -71,8 +81,8 @@ namespace CampusAppWP8.Pages.Setting /// protected override void OnNavigatedFrom(NavigationEventArgs e) { - Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); - Settings.AppSetting.FunctionSettings.MensaSetting.AtomMensaSelection = this.AtomMensaToggle.IsChecked.Value; + base.OnNavigatedFrom(e); + this.SaveSettings(); if (NavigationMode.Back == e.NavigationMode) { @@ -113,6 +123,60 @@ namespace CampusAppWP8.Pages.Setting this.SettingFunctionPivot.SelectedIndex = 0; } + /// Loads the settings. + /// Stubbfel, 25.11.2013. + private void LoadSettings() + { + if (this.taghandlerModel == null) + { + this.taghandlerModel = new TagHandlerListPickerItemListModel(); + this.TagHandler.ItemsSource = this.taghandlerModel.List; + } + + int tagselIndex = this.taghandlerModel.GetIndexOrDefault(Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler.ToString()); + this.TagHandler.SelectedIndex = tagselIndex; + + this.AtomMensaToggle.IsChecked = Settings.AppSetting.FunctionSettings.MensaSetting.AtomMensaSelection; + + if (this.campusList == null) + { + this.campusList = new CampusListPickerItemListModel(true); + this.Mensa.ItemsSource = campusList.List; + } + this.Mensa.SelectedIndex = campusList.GetIndexOrDefault(((int)Settings.AppSetting.FunctionSettings.MensaSetting.DefaultMensa).ToString()); + + } + + /// Saves the settings. + /// Stubbfel, 25.11.2013. + private void SaveSettings() + { + Settings.AppSetting.FunctionSettings.TagSetting.TagDefaultHandler = (CampusAppWP8.Model.Setting.BTUTagDefaultHandler)Enum.Parse(typeof(CampusAppWP8.Model.Setting.BTUTagDefaultHandler), ((CampusAppWPortalLib8.Model.Utility.ListPickerItemModel)this.TagHandler.SelectedItem).Value); + Settings.AppSetting.FunctionSettings.MensaSetting.AtomMensaSelection = this.AtomMensaToggle.IsChecked.Value; + Settings.AppSetting.FunctionSettings.MensaSetting.DefaultMensa = (CampusAppWPortalLib8.Model.Settings.Campus)Enum.Parse(typeof(CampusAppWPortalLib8.Model.Settings.Campus), ((ListPickerItemModel)this.Mensa.SelectedItem).Value); + } + + + /// + /// Event handler. Called by SettingFunctionPivot for selection changed events. + /// + /// Stubbfel, 25.11.2013. + /// Source of the event. + /// Selection changed event information. + private void SettingFunctionPivot_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) + { + this.SaveSettings(); + } + + /// Event handler. Called by ResetSettingButtonAppBar for click events. + /// Stubbfel, 25.11.2013. + /// Source of the event. + /// Event information. + private void ResetSettingButtonAppBar_Click(object sender, EventArgs e) + { + Settings.AppSetting.FunctionSettings.SetSettingToDefault(); + this.LoadSettings(); + } #endregion #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml index f92c9a07..5c6dcc7f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml @@ -8,6 +8,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" + xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -154,4 +155,9 @@ + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs index 95dcd530..ef77dba2 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs @@ -115,6 +115,16 @@ namespace CampusAppWP8.Pages.Setting } } + /// Event handler. Called by ResetSettingButtonAppBar for click events. + /// Stubbfel, 25.11.2013. + /// Source of the event. + /// Event information. + private void ResetSettingButtonAppBar_Click(object sender, EventArgs e) + { + Settings.UserProfil.SetSettingToDefault(); + this.LoadListPicker(); + } + #endregion #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 79081ac9..8f103089 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -66,9 +66,7 @@ namespace CampusAppWP8.Pages Settings.SetSettingToDefault(); this.ShowOptIns(); Settings.AppSetting.InitApp = true; - } - Settings.SetSettingToDefault("APPSETTING"); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 933f65e5..034721f2 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1131,6 +1131,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die zurück-setzen ähnelt. + /// + public static string ResetBtn { + get { + return ResourceManager.GetString("ResetBtn", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die LeftToRight ähnelt. /// @@ -1230,6 +1239,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Darstellung ähnelt. + /// + public static string Setting_Display_Short { + get { + return ResourceManager.GetString("Setting_Display_Short", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Funktionseinstellungen ähnelt. /// @@ -1239,6 +1257,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Funktionen ähnelt. + /// + public static string Setting_Function_Short { + get { + return ResourceManager.GetString("Setting_Function_Short", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Allgemeine Einstellungen ähnelt. /// @@ -1249,7 +1276,7 @@ namespace CampusAppWP8.Resources { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Ort. & Netzw. ähnelt. + /// Sucht eine lokalisierte Zeichenfolge, die Ort. & Netz ähnelt. /// public static string Setting_GeneralNetwork { get { @@ -1266,6 +1293,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Mensa ähnelt. + /// + public static string Setting_Mensa { + get { + return ResourceManager.GetString("Setting_Mensa", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Sonstige Einstellungen ähnelt. /// @@ -1383,6 +1419,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Einstellung zurücksetzen ähnelt. + /// + public static string SettingToDefault { + get { + return ResourceManager.GetString("SettingToDefault", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die klein ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 371bc0db..711c1ded 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -639,7 +639,7 @@ Funktionseinstellungen - Ort. & Netzw. + Ort. & Netz Sonstige Einstellungen @@ -647,4 +647,19 @@ BTU-Tag + + zurück-setzen + + + Einstellung zurücksetzen + + + Darstellung + + + Funktionen + + + Mensa + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 7d604fab..5f02e256 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -660,19 +660,22 @@ Appsetting_Networksetting - + Appsetting_Functionsetting - + Appsetting_Functionsetting_Mensasetting - + Appsetting_Functionsetting_Tagsetting - + Appsetting_Functionsetting_TimeTablesetting Setting + + MensaDefaultCampus + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index f54a77c0..4b3fe01c 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -1392,6 +1392,42 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting ähnelt. + /// + public static string Setting_AppSetting_FunctionSetting_Enum { + get { + return ResourceManager.GetString("Setting_AppSetting_FunctionSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_Mensasetting ähnelt. + /// + public static string Setting_AppSetting_FunctionSetting_MensaSetting_Enum { + get { + return ResourceManager.GetString("Setting_AppSetting_FunctionSetting_MensaSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_Tagsetting ähnelt. + /// + public static string Setting_AppSetting_FunctionSetting_TagSetting_Enum { + get { + return ResourceManager.GetString("Setting_AppSetting_FunctionSetting_TagSetting_Enum", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_TimeTablesetting ähnelt. + /// + public static string Setting_AppSetting_FunctionSetting_TimeTableSetting_Enum { + get { + return ResourceManager.GetString("Setting_AppSetting_FunctionSetting_TimeTableSetting_Enum", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Locatingsetting ähnelt. /// @@ -1410,42 +1446,6 @@ namespace CampusAppWP8.Resources { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting ähnelt. - /// - public static string Setting_ApSetting_FunctionSetting_Enum { - get { - return ResourceManager.GetString("Setting_ApSetting_FunctionSetting_Enum", resourceCulture); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_Mensasetting ähnelt. - /// - public static string Setting_ApSetting_FunctionSetting_MensaSetting_Enum { - get { - return ResourceManager.GetString("Setting_ApSetting_FunctionSetting_MensaSetting_Enum", resourceCulture); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_Tagsetting ähnelt. - /// - public static string Setting_ApSetting_FunctionSetting_TagSetting_Enum { - get { - return ResourceManager.GetString("Setting_ApSetting_FunctionSetting_TagSetting_Enum", resourceCulture); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die Appsetting_Functionsetting_TimeTablesetting ähnelt. - /// - public static string Setting_ApSetting_FunctionSetting_TimeTableSetting_Enum { - get { - return ResourceManager.GetString("Setting_ApSetting_FunctionSetting_TimeTableSetting_Enum", resourceCulture); - } - } - /// /// Sucht eine lokalisierte Zeichenfolge, die 767 ähnelt. /// @@ -1473,6 +1473,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die MensaDefaultCampus ähnelt. + /// + public static string Setting_Mensa_DefaultCampus { + get { + return ResourceManager.GetString("Setting_Mensa_DefaultCampus", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die UserSetting ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Settings.cs b/CampusAppWP8/CampusAppWP8/Settings.cs index 2f4dac9a..1731e7b2 100644 --- a/CampusAppWP8/CampusAppWP8/Settings.cs +++ b/CampusAppWP8/CampusAppWP8/Settings.cs @@ -96,9 +96,15 @@ namespace CampusAppWP8 AppSetting.FunctionSettings.SetSettingToDefault(); break; case SettingType.Appsetting_Locatingsetting: + + // spezial case AppSetting.LocatingSetting.SetSettingToDefault(); + AppSetting.NetworkSetting.SetSettingToDefault(); break; case SettingType.Appsetting_Networksetting: + + // spezial case + AppSetting.LocatingSetting.SetSettingToDefault(); AppSetting.NetworkSetting.SetSettingToDefault(); break; case SettingType.Appsetting_Functionsetting_Mensasetting: diff --git a/CampusAppWP8/CampusAppWP8/Styles/Labels.xaml b/CampusAppWP8/CampusAppWP8/Styles/Labels.xaml new file mode 100644 index 00000000..99c12003 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Styles/Labels.xaml @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ResetSettingButtonAppBar.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ResetSettingButtonAppBar.cs new file mode 100644 index 00000000..1e31b756 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ResetSettingButtonAppBar.cs @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 15.10.2013 +// Implements the update button application bar class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System; + using CampusAppWP8.Resources; + using Microsoft.Phone.Shell; + + /// This class create an Button which start the Email-Client. + /// Stubbfel, 15.10.2013. + /// + public class ResetSettingButtonAppBar : ApplicationBarIconButton + { + #region Members + + /// IconUri of the Button. + private static Uri iconUri = new Uri(Icons.Link, UriKind.Relative); + + /// Text of the Button. + private static string text = AppResources.ResetBtn; + + #endregion + + #region Constructors + + /// Initializes a new instance of the class. + /// Stubbfel, 15.10.2013. + public ResetSettingButtonAppBar() + : base() + { + this.IconUri = ResetSettingButtonAppBar.iconUri; + this.Text = ResetSettingButtonAppBar.text; + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToDefaultButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToDefaultButton.cs index b858e467..f75ad7eb 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToDefaultButton.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToDefaultButton.cs @@ -12,8 +12,9 @@ namespace CampusAppWP8.Utility.Lui.Button using System.Windows; using System.Windows.Controls; using System.Windows.Media.Imaging; - using CampusAppWP8.Resources; using CampusAppWP8.Pages.Setting; + using CampusAppWP8.Resources; + /// Add person button. /// Stubbfel, 12.09.2013. @@ -67,7 +68,7 @@ namespace CampusAppWP8.Utility.Lui.Button { Settings.SetSettingToDefault(this.SettingType.ToString()); Page page = App.RootFrame.Content as Page; - if (page.GetType().IsAssignableFrom(typeof(IRefreshingPage))) + if (typeof(IRefreshingPage).IsInstanceOfType(page)) { ((IRefreshingPage)page).RefreshPage(); } diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs index 87d175ac..810cd1be 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs @@ -21,10 +21,11 @@ namespace CampusAppWPortalLib8.Model.Utility /// Initializes a new instance of the class. /// /// Stubbfel, 15.10.2013. - public CampusListPickerItemListModel() + /// (Optional) the user settings. + public CampusListPickerItemListModel(bool userSettings = false) : base() { - this.LoadList(); + this.LoadList(userSettings); } #endregion @@ -33,9 +34,15 @@ namespace CampusAppWPortalLib8.Model.Utility /// Overrides the LoadList-Method /// Stubbfel, 15.10.2013. + /// (Optional) the user settings. /// - protected override void LoadList() + protected void LoadList(bool userSettings = false) { + if (userSettings) + { + this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.UserSettingCampus).ToString(), AppResources.Campus_UserSetting); + } + this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.CB_MAIN).ToString(), AppResources.Campus_CBMain)); this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.CB_NORTH).ToString(), AppResources.Campus_CBNorth)); this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.CB_SOUTH).ToString(), AppResources.Campus_CBSouth)); diff --git a/CampusAppWP8/CampusAppWPortalLib8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWPortalLib8/Resources/AppResources.Designer.cs index c607563d..be12509b 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Resources/AppResources.Designer.cs @@ -97,6 +97,15 @@ namespace CampusAppWPortalLib8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die wie in Profileinstellungen ähnelt. + /// + public static string Campus_UserSetting { + get { + return ResourceManager.GetString("Campus_UserSetting", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Bachelor ähnelt. /// diff --git a/CampusAppWP8/CampusAppWPortalLib8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWPortalLib8/Resources/AppResources.resx index 475cb1d9..80d424b6 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWPortalLib8/Resources/AppResources.resx @@ -129,6 +129,9 @@ Senftenberg + + wie in Profileinstellungen + Bachelor From 0ebe01dfe6a422feefa56a43e6850f2ce02c25d4 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 26 Nov 2013 09:55:55 +0100 Subject: [PATCH 15/26] finish #292 --- CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs | 5 ++++- CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs index 7bd45f60..80c9ff1f 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/MensaSetting.cs @@ -47,7 +47,10 @@ using CampusAppWPortalLib8.Model.Settings; } } - /// Gets or sets the selected mensa. + /// + /// Gets or sets the selected mensa. That means if the Campus is UserSettingCampus then + /// return the Campus from user profil. + /// /// The selected mensa. public Campus SelectedMensa { diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs index a6770bd0..9b1fa2e1 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs @@ -190,7 +190,7 @@ namespace CampusAppWP8.Pages.Mensa { if (mensaCampus == Campus.UserSettingCampus) { - this.InitializeFeed(Settings.UserProfil.DefaultCampus); + this.InitializeFeed(Settings.AppSetting.FunctionSettings.MensaSetting.SelectedMensa); } else { @@ -231,14 +231,14 @@ namespace CampusAppWP8.Pages.Mensa /// Stubbfel, 15.10.2013. private void InitializeFeed() { - if (Settings.AppSetting.LocatingSetting.GeoWatchEnable) + if (Settings.AppSetting.LocatingSetting.GeoWatchEnable && Settings.AppSetting.FunctionSettings.MensaSetting.AtomMensaSelection) { Thread thread = new Thread(new ThreadStart(this.DeterminCurrentCampusAndLoadFeed)); thread.Start(); } else { - this.InitializeFeed(Settings.UserProfil.DefaultCampus); + this.InitializeFeed(Settings.AppSetting.FunctionSettings.MensaSetting.SelectedMensa); } } From abd348860829f3479f26ff2e23a4c88ddfb4dd84 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 26 Nov 2013 11:25:10 +0100 Subject: [PATCH 16/26] adddisplaysetting and unicolor --- CampusAppWP8/CampusAppWP8/App.xaml | 1 + CampusAppWP8/CampusAppWP8/App.xaml.cs | 14 ++++ CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 5 ++ .../CampusAppWP8/Model/Setting/AppSettings.cs | 21 ++++++ .../Model/Setting/DisplaySetting.cs | 64 +++++++++++++++++++ .../CampusAppWP8/Pages/StartPage.xaml.cs | 7 +- .../CampusAppWP8/Resources/Constants.resx | 6 ++ .../Resources/Constants1.Designer.cs | 18 ++++++ .../CampusAppWP8/Styles/UniColors.xaml | 12 ++++ .../CampusAppWP8/Utility/Utilities.cs | 25 ++++++++ 10 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Setting/DisplaySetting.cs create mode 100644 CampusAppWP8/CampusAppWP8/Styles/UniColors.xaml diff --git a/CampusAppWP8/CampusAppWP8/App.xaml b/CampusAppWP8/CampusAppWP8/App.xaml index 1d6fd99b..443e964d 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml +++ b/CampusAppWP8/CampusAppWP8/App.xaml @@ -13,6 +13,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs index 5bb47375..b5ddfcdb 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs @@ -10,6 +10,7 @@ using System.IO.IsolatedStorage; using System.Threading; using System.Windows; using System.Windows.Markup; +using System.Windows.Media; using System.Windows.Navigation; @@ -157,6 +158,19 @@ namespace CampusAppWP8 Settings.AppSetting.InitApp = false; } + Color appColor = ((SolidColorBrush)App.Current.Resources["PhoneAccentBrush"]).Color; + if (!Settings.AppSetting.DisplaySetting.PhoneAccentColor.Equals(appColor)) + { + if (Settings.AppSetting.DisplaySetting.AppAccentColor.Equals(Settings.AppSetting.DisplaySetting.PhoneAccentColor)) + { + Settings.AppSetting.DisplaySetting.AppAccentColor = appColor; + } + Settings.AppSetting.DisplaySetting.PhoneAccentColor = appColor; + } + + appColor = Settings.AppSetting.DisplaySetting.AppAccentColor; + Utilities.SwitchAccentColor(appColor); + this.UserSettingsLoaded(); Settings.AppSetting.NetworkSetting.UniNetwork = Utilities.IsUniNetworkAvailable(); diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 0fbc7b96..4e7abe58 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -134,6 +134,7 @@ + @@ -542,6 +543,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs index e4f482f8..1224cdcb 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs @@ -26,10 +26,30 @@ namespace CampusAppWP8.Model.Setting /// The locating setting. private static LocatingSetting locatingSetting = new LocatingSetting(); + private static DisplaySetting displaySetting = new DisplaySetting(); + #endregion #region Property + /// Gets or sets the display setting. + /// The display setting. + public DisplaySetting DisplaySetting + { + get + { + return AppSettings.displaySetting; + } + + set + { + if (AppSettings.displaySetting != value) + { + AppSettings.displaySetting = value; + } + } + } + /// Gets or sets the locating setting. /// The locating setting. public LocatingSetting LocatingSetting @@ -150,6 +170,7 @@ namespace CampusAppWP8.Model.Setting this.FunctionSettings.SetSettingToDefault(); this.NetworkSetting.SetSettingToDefault(); this.LocatingSetting.SetSettingToDefault(); + this.DisplaySetting.SetSettingToDefault(); } #endregion } diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/DisplaySetting.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/DisplaySetting.cs new file mode 100644 index 00000000..3416267f --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Setting/DisplaySetting.cs @@ -0,0 +1,64 @@ +using CampusAppWP8.Resources; +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 26.11.2013 +// Implements the display setting class +//----------------------------------------------------------------------- +using System.Windows.Media; + +namespace CampusAppWP8.Model.Setting +{ + /// A display setting. + /// Stubbfel, 26.11.2013. + /// + public class DisplaySetting : ISetting + { + #region property + + /// Gets or sets the color of the application accent. + /// The color of the application accent. + public Color AppAccentColor + { + get + { + return App.LoadFromAppState(Constants.Setting_AppAccentColor); + } + + set + { + App.SaveToAppState(Constants.Setting_AppAccentColor, value); + } + } + + /// Gets or sets the color of the phone accent. + /// The color of the phone accent. + public Color PhoneAccentColor + { + get + { + return App.LoadFromAppState(Constants.Setting_PhoneAccentColor); + } + + set + { + App.SaveToAppState(Constants.Setting_PhoneAccentColor, value); + } + } + + #endregion + + #region method + + /// Sets setting to default. + /// Stubbfel, 25.11.2013. + /// + public void SetSettingToDefault() + { + this.AppAccentColor = this.PhoneAccentColor; + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 8f103089..ed3ee63b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -27,6 +27,7 @@ namespace CampusAppWP8.Pages using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using Windows.Networking.Proximity; + using System.Windows.Media; /// Class for the StartPage. /// Stubbfel, 15.10.2013. @@ -75,7 +76,7 @@ namespace CampusAppWP8.Pages #region protected - /// Methods overrides the OnNavigatedTo-Method. + /// Methods overrides the OnNavigatedTo-Method. /// Stubbfel, 15.10.2013. /// protected override void OnNavigatedTo(NavigationEventArgs e) @@ -84,7 +85,7 @@ namespace CampusAppWP8.Pages if (device != null) { this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler); - } + } } /// Methods overrides the OnNavigatedFrom-Method. @@ -123,7 +124,7 @@ namespace CampusAppWP8.Pages /// Stubbfel, 15.10.2013. /// Caller of the function. /// some EventArgs. - private void NFCButton_Click(object sender,RoutedEventArgs e) + private void NFCButton_Click(object sender, RoutedEventArgs e) { MessageBoxes.ShowMainModelInfoMessageBox(AppResources.ScarNfc_Search); } diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 5f02e256..f72cd6ad 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -678,4 +678,10 @@ MensaDefaultCampus + + AppAccentColor + + + PhoneAccentColor + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index 4b3fe01c..95ec9c9d 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -1383,6 +1383,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die AppAccentColor ähnelt. + /// + public static string Setting_AppAccentColor { + get { + return ResourceManager.GetString("Setting_AppAccentColor", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die AppSetting ähnelt. /// @@ -1482,6 +1491,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die PhoneAccentColor ähnelt. + /// + public static string Setting_PhoneAccentColor { + get { + return ResourceManager.GetString("Setting_PhoneAccentColor", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die UserSetting ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Styles/UniColors.xaml b/CampusAppWP8/CampusAppWP8/Styles/UniColors.xaml new file mode 100644 index 00000000..448b75f6 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Styles/UniColors.xaml @@ -0,0 +1,12 @@ + + + #d20078 + #0050a0 + #009bd2 + #a5c300 + #ff9900 + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs index 70a4f339..9bdecc35 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -445,6 +445,31 @@ namespace CampusAppWP8.Utility obj.SelectedIndex = -1; } } + + /// Switch color. + /// Stubbfel, 26.11.2013. + /// The ressource key. + /// The new color. + public static void SwitchColor(string ressourceKey, Color newColor) + { + SolidColorBrush oldColor = App.Current.Resources[ressourceKey] as SolidColorBrush; + + if (oldColor == null || oldColor.Color.Equals(newColor)) + { + return; + } + App.Current.Resources.Remove(ressourceKey); + App.Current.Resources.Add(ressourceKey, newColor); + ((SolidColorBrush)App.Current.Resources[ressourceKey]).Color = newColor; + } + + /// Switch accent color. + /// Stubbfel, 26.11.2013. + /// The new color. + public static void SwitchAccentColor(Color newColor) + { + Utilities.SwitchColor("PhoneAccentBrush", newColor); + } #endregion } } \ No newline at end of file From a2f1a7082de89e7efd20ee5603dd5d813f79e6a9 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Tue, 26 Nov 2013 15:24:25 +0100 Subject: [PATCH 17/26] add listpicker --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 2 + .../AppAccentColorListPickerItemListModel.cs | 85 +++++++++++ .../Model/Utility/ColorListPickerItemModel.cs | 34 +++++ .../Pages/Setting/AppSettingPage.xaml | 24 +++- .../Pages/Setting/AppSettingPage.xaml.cs | 27 ++++ .../Resources/AppResources.Designer.cs | 18 +++ .../CampusAppWP8/Resources/AppResources.resx | 6 + .../CampusAppWP8/Styles/UniColors.xaml | 16 ++- .../CampusAppWP8/Utility/Utilities.cs | 6 +- .../CampusAppWPortalLib8.csproj | 2 + .../Model/Mensa/PriceModel.cs | 4 + .../Utility/CampusListPickerItemListModel.cs | 2 +- .../Model/Utility/ListPickerItemListModel.cs | 110 +------------- .../ListPickerItemListTemplateModel.cs | 135 ++++++++++++++++++ .../Model/Utility/ListPickerItemModel.cs | 18 +-- .../Utility/ListPickerItemTemplateModel.cs | 48 +++++++ 16 files changed, 403 insertions(+), 134 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/AppAccentColorListPickerItemListModel.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/ColorListPickerItemModel.cs create mode 100644 CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemListTemplateModel.cs create mode 100644 CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemTemplateModel.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 4e7abe58..201e7c1d 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -145,6 +145,8 @@ + + FunctionSettingPage.xaml diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/AppAccentColorListPickerItemListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/AppAccentColorListPickerItemListModel.cs new file mode 100644 index 00000000..0abc5a61 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/AppAccentColorListPickerItemListModel.cs @@ -0,0 +1,85 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 26.11.2013 +// Implements the application accent color list picker item list model class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + + using CampusAppWPortalLib8.Resources; + using System.Windows.Media; + + /// A data Model for the application accent color list picker item list. + /// Stubbfel, 26.11.2013. + /// + public class AppAccentColorListPickerItemListModel : CampusAppWPortalLib8.Model.Utility.ListPickerItemListTemplateModel + { + #region member + + /// The faculty 1 color. + private static readonly SolidColorBrush faculty1Color = (SolidColorBrush)App.Current.Resources["FacultyBrush1"]; + + /// The faculty 2 color. + private static readonly SolidColorBrush faculty2Color = (SolidColorBrush)App.Current.Resources["FacultyBrush2"]; + + /// The faculty 3 color. + private static readonly SolidColorBrush faculty3Color = (SolidColorBrush)App.Current.Resources["FacultyBrush3"]; + + /// The faculty 4 color. + private static readonly SolidColorBrush faculty4Color = (SolidColorBrush)App.Current.Resources["FacultyBrush4"]; + + /// The faculty 5 color. + private static readonly SolidColorBrush faculty5Color = (SolidColorBrush)App.Current.Resources["FacultyBrush5"]; + + /// The faculty. + private readonly string faculty = AppResources.Faculty; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the AppAccentColorListPickerItemListModel class. + /// + /// Stubbfel, 26.11.2013. + public AppAccentColorListPickerItemListModel() + : base() + { + this.LoadList(); + } + + #endregion + + #region Method + + public override int GetIndexOrDefault(SolidColorBrush value) + { + int index = 0; + foreach (ColorListPickerItemModel brush in this.List) + { + if (brush.Value.Color.Equals(value.Color)) { + break; + } + index++; + } + return index; + } + + /// Loads the list. + /// Stubbfel, 26.11.2013. + protected override void LoadList() + { + this.AddItem(new ColorListPickerItemModel(new SolidColorBrush(Settings.AppSetting.DisplaySetting.PhoneAccentColor), CampusAppWP8.Resources.AppResources.AccentColor)); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty1Color, this.faculty + " 1")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty2Color, this.faculty + " 2")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty3Color, faculty + " 3")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty4Color, faculty + " 4")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty5Color, faculty + " 5")); + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/ColorListPickerItemModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/ColorListPickerItemModel.cs new file mode 100644 index 00000000..21e6587b --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/ColorListPickerItemModel.cs @@ -0,0 +1,34 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 26.11.2013 +// Implements the color list picker item model class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.Utility +{ + using System.Windows.Media; + + /// A data Model for the color list picker item. + /// Stubbfel, 26.11.2013. + /// + public class ColorListPickerItemModel : CampusAppWPortalLib8.Model.Utility.ListPickerItemTemplateModel + { + /// Initializes a new instance of the ColorListPickerItemModel class. + /// Stubbfel, 26.11.2013. + public ColorListPickerItemModel() + : base() + { + } + + /// Initializes a new instance of the ColorListPickerItemModel class. + /// Stubbfel, 26.11.2013. + /// The value. + /// The text. + public ColorListPickerItemModel(SolidColorBrush value, string text) + : base(value, text) + { + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml index 6762f89b..8cf1bb9d 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml @@ -69,7 +69,29 @@ - + + + + + + + + + + + + + + + + + + + + + + Class for the AppSettingPage. /// Stubbfel, 15.10.2013. /// public partial class AppSettingPage : PhoneApplicationPage, IRefreshingPage { + + #region member + + /// List of colors of the application accents. + private readonly AppAccentColorListPickerItemListModel appAccentColors = new AppAccentColorListPickerItemListModel(); + + #endregion + #region Constructor /// Initializes a new instance of the class. @@ -25,6 +36,7 @@ namespace CampusAppWP8.Pages.Setting public AppSettingPage() { this.InitializeComponent(); + this.AccentColorPicker.ItemsSource = this.appAccentColors.List; this.LoadSettings(); } @@ -84,6 +96,7 @@ namespace CampusAppWP8.Pages.Setting { this.GeoWatchToggle.IsChecked = Settings.AppSetting.LocatingSetting.GeoWatchEnable; this.OnlyWiFiToggle.IsChecked = Settings.AppSetting.NetworkSetting.OnlyWifi; + this.AccentColorPicker.SelectedIndex = this.appAccentColors.GetIndexOrDefault(new SolidColorBrush(Settings.AppSetting.DisplaySetting.AppAccentColor)); } /// Saves the settings. @@ -104,6 +117,20 @@ namespace CampusAppWP8.Pages.Setting this.LoadSettings(); } + /// + /// Event handler. Called by AccentColorPicker for selection changed events. + /// + /// Stubbfel, 26.11.2013. + /// Source of the event. + /// Selection changed event information. + private void AccentColorPicker_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) + { + int selectedIndex = this.AccentColorPicker.SelectedIndex; + Color newColor = this.appAccentColors.List[selectedIndex].Value.Color; + Utilities.SwitchAccentColor(newColor); + Settings.AppSetting.DisplaySetting.AppAccentColor = newColor; + } + #endregion #endregion diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 034721f2..f339bccb 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -60,6 +60,24 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Akzentfarbe ähnelt. + /// + public static string AccentColor { + get { + return ResourceManager.GetString("AccentColor", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Akzentfarbe-Auswahl ähnelt. + /// + public static string AccentColorPicker { + get { + return ResourceManager.GetString("AccentColorPicker", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Hinzufügen ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 711c1ded..eb852176 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -662,4 +662,10 @@ Mensa + + Akzentfarbe + + + Akzentfarbe-Auswahl + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Styles/UniColors.xaml b/CampusAppWP8/CampusAppWP8/Styles/UniColors.xaml index 448b75f6..24581267 100644 --- a/CampusAppWP8/CampusAppWP8/Styles/UniColors.xaml +++ b/CampusAppWP8/CampusAppWP8/Styles/UniColors.xaml @@ -3,10 +3,14 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib"> - #d20078 - #0050a0 - #009bd2 - #a5c300 - #ff9900 - + #d20078 + #0050a0 + #009bd2 + #a5c300 + #ff9900 + #d20078 + #0050a0 + #009bd2 + #a5c300 + #ff9900 \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs index 9bdecc35..01d58121 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -459,8 +459,7 @@ namespace CampusAppWP8.Utility return; } App.Current.Resources.Remove(ressourceKey); - App.Current.Resources.Add(ressourceKey, newColor); - ((SolidColorBrush)App.Current.Resources[ressourceKey]).Color = newColor; + App.Current.Resources.Add(ressourceKey, newColor); } /// Switch accent color. @@ -468,7 +467,8 @@ namespace CampusAppWP8.Utility /// The new color. public static void SwitchAccentColor(Color newColor) { - Utilities.SwitchColor("PhoneAccentBrush", newColor); + Utilities.SwitchColor("PhoneAccentColor", newColor); + ((SolidColorBrush)App.Current.Resources["PhoneAccentBrush"]).Color = newColor; } #endregion } diff --git a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj index addae01f..5e642a15 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj +++ b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj @@ -91,7 +91,9 @@ + + diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs index 5630e72a..9350c817 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs @@ -70,6 +70,10 @@ namespace CampusAppWPortalLib8.Model.Mensa /// The canteen. public PriceCanteenModel GetCanteen(Campus campus) { + if (campus == Campus.CB_NORTH) + { + return this.GetCanteen((int)Campus.CB_MAIN - 1); + } return this.GetCanteen((int)campus - 1); } } diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs index 810cd1be..86907d6b 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs @@ -40,7 +40,7 @@ namespace CampusAppWPortalLib8.Model.Utility { if (userSettings) { - this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.UserSettingCampus).ToString(), AppResources.Campus_UserSetting); + this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.UserSettingCampus).ToString(), AppResources.Campus_UserSetting)); } this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.CB_MAIN).ToString(), AppResources.Campus_CBMain)); diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemListModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemListModel.cs index 8373f3a3..cfa96f3e 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemListModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemListModel.cs @@ -12,15 +12,8 @@ namespace CampusAppWPortalLib8.Model.Utility /// Class for a List of ListPickerItems. /// Stubbfel, 15.10.2013. - public class ListPickerItemListModel + public class ListPickerItemListModel : ListPickerItemListTemplateModel { - #region Members - - /// reference of the itemList. - private List list; - - #endregion - #region Constructor /// @@ -28,109 +21,10 @@ namespace CampusAppWPortalLib8.Model.Utility /// /// Stubbfel, 15.10.2013. public ListPickerItemListModel() + : base() { - this.list = new List(); } #endregion - - #region Property - - /// Gets or sets the ItemList. - /// The list. - public List List - { - get - { - return this.list; - } - - set - { - if (value != this.list) - { - this.list = value; - } - } - } - - #endregion - - #region Method - - #region public - - /// Method return a the Index of an item which has a certain value. - /// Stubbfel, 15.10.2013. - /// a certain value. - /// return index of value or default(0) - public virtual int GetIndexOrDefault(string value) - { - int index = 0; - int i = 0; - foreach (ListPickerItemModel item in this.list) - { - if (item.Value.Equals(value)) - { - index = i; - break; - } - - i++; - } - - return index; - } - - /// add an new item to the list. - /// Stubbfel, 15.10.2013. - /// value of the item. - /// text of the item. - public void AddItem(string value, string text) - { - this.AddItem(new ListPickerItemModel(value, text)); - } - - /// add an new item to the list. - /// Stubbfel, 15.10.2013. - /// new item of the list. - public void AddItem(ListPickerItemModel item) - { - this.list.Add(item); - } - - /// remove an item. - /// Stubbfel, 15.10.2013. - /// value of the item. - /// text of the item. - /// true if removing was successful, otherwise false. - public bool RemoveItem(string value, string text) - { - return this.RemoveItem(new ListPickerItemModel(value, text)); - } - - /// remove an item. - /// Stubbfel, 15.10.2013. - /// item which has to be remove. - /// true if removing was successful, otherwise false. - public bool RemoveItem(ListPickerItemModel item) - { - return this.list.Remove(item); - } - - #endregion - - #region protected - - /// Method load an default list. - /// load an empty list. - protected virtual void LoadList() - { - return; - } - - #endregion - - #endregion } } diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemListTemplateModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemListTemplateModel.cs new file mode 100644 index 00000000..ba1742a1 --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemListTemplateModel.cs @@ -0,0 +1,135 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 26.11.2013 +// Implements the list picker item list template model class +//----------------------------------------------------------------------- +namespace CampusAppWPortalLib8.Model.Utility +{ + using System.Collections.Generic; + + /// A data Model for the list picker item list template. + /// Stubbfel, 26.11.2013. + /// Generic type parameter. + public class ListPickerItemListTemplateModel + { + #region Members + + /// reference of the itemList. + private List> list; + + #endregion + + #region Constructor + + /// Initializes a new instance of the ListPickerItemListTemplateModel class. + /// Stubbfel, 26.11.2013. + public ListPickerItemListTemplateModel() + { + this.list = new List>(); + } + + #endregion + + #region Property + + /// Gets or sets the ItemList. + /// The list. + public List> List + { + get + { + return this.list; + } + + set + { + if (value != this.list) + { + this.list = value; + } + } + } + + #endregion + + #region Method + + #region public + + /// Method return a the Index of an item which has a certain value. + /// Stubbfel, 15.10.2013. + /// a certain value. + /// return index of value or default(0) + public virtual int GetIndexOrDefault(T value) + { + int index = 0; + int i = 0; + foreach (ListPickerItemTemplateModel item in this.list) + { + if (item.Value.Equals(value)) + { + index = i; + break; + } + + i++; + } + + return index; + } + + /// add an new item to the list. + /// Stubbfel, 15.10.2013. + /// value of the item. + /// text of the item. + public void AddItem(T value, string text) + { + this.AddItem(new ListPickerItemTemplateModel(value, text)); + } + + /// add an new item to the list. + /// Stubbfel, 15.10.2013. + /// new item of the list. + public void AddItem(ListPickerItemTemplateModel item) + { + this.list.Add(item); + } + + /// remove an item. + /// Stubbfel, 15.10.2013. + /// value of the item. + /// text of the item. + /// true if removing was successful, otherwise false. + public bool RemoveItem(T value, string text) + { + return this.RemoveItem(new ListPickerItemTemplateModel(value, text)); + } + + /// remove an item. + /// Stubbfel, 15.10.2013. + /// item which has to be remove. + /// true if removing was successful, otherwise false. + public bool RemoveItem(ListPickerItemTemplateModel item) + { + return this.list.Remove(item); + } + + #endregion + + #region protected + + /// Method load an default list. + /// load an empty list. + protected virtual void LoadList() + { + return; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemModel.cs index 0984aa42..bc8a6d17 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemModel.cs @@ -10,7 +10,7 @@ namespace CampusAppWPortalLib8.Model.Utility { /// Model for the ListPickerItems. /// Stubbfel, 15.10.2013. - public class ListPickerItemModel + public class ListPickerItemModel : ListPickerItemTemplateModel { #region Constructor @@ -19,6 +19,7 @@ namespace CampusAppWPortalLib8.Model.Utility /// /// Stubbfel, 15.10.2013. public ListPickerItemModel() + : base() { } @@ -29,23 +30,10 @@ namespace CampusAppWPortalLib8.Model.Utility /// string for the value property of an item. /// string for the text property of an item. public ListPickerItemModel(string value, string text) + : base(value, text) { - this.Value = value; - this.Text = text; } #endregion - - #region Property - - /// Gets or sets the Value of an Item. - /// The value. - public string Value { get; set; } - - /// Gets or sets the Text (caption) of an Item. - /// The text. - public string Text { get; set; } - - #endregion } } diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemTemplateModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemTemplateModel.cs new file mode 100644 index 00000000..1ac959bd --- /dev/null +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/ListPickerItemTemplateModel.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 26.11.2013 +// Implements the list picker item template model class +//----------------------------------------------------------------------- +namespace CampusAppWPortalLib8.Model.Utility +{ + /// A data Model for the list picker item template. + /// Stubbfel, 26.11.2013. + /// Generic type parameter. + public class ListPickerItemTemplateModel + { + #region Constructor + + /// Initializes a new instance of the ListPickerItemTemplateModel class. + /// Stubbfel, 26.11.2013. + public ListPickerItemTemplateModel() + { + } + + /// Initializes a new instance of the ListPickerItemTemplateModel class. + /// Stubbfel, 26.11.2013. + /// The value. + /// The text. + public ListPickerItemTemplateModel(V value, string text) + { + this.Value = value; + this.Text = text; + } + + #endregion + + #region Property + + /// Gets or sets the Value of an Item. + /// The value. + public V Value { get; set; } + + /// Gets or sets the Text (caption) of an Item. + /// The text. + public string Text { get; set; } + + #endregion + } +} From 11016d033f123c81135528a14125685d4c61663f Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Tue, 26 Nov 2013 16:21:30 +0100 Subject: [PATCH 18/26] temp commit --- CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml | 2 +- .../CampusAppWP8/Pages/StartPage.xaml.cs | 17 +++++++++++++++++ .../Pages/TimeTable/TimeTableDay.xaml | 7 ++++--- .../Pages/TimeTable/TimeTableDay.xaml.cs | 10 ++++++++++ .../Pages/TimeTable/TimeTableWeek.xaml | 4 ++-- .../Pages/TimeTable/TimeTableWeek.xaml.cs | 10 ++++++++++ .../Utility/Lui/Button/NavigateButton.cs | 17 ++++++++++++++++- .../Utility/CampusListPickerItemListModel.cs | 2 +- 8 files changed, 61 insertions(+), 8 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml index 4e3573d2..22532320 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml @@ -29,7 +29,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 8f103089..0d93b06d 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -347,6 +347,23 @@ namespace CampusAppWP8.Pages #endregion + private void TimeTable_Click(object sender, RoutedEventArgs e) + { + if(this.Orientation.Equals(PageOrientation.Landscape) + || this.Orientation.Equals(PageOrientation.LandscapeLeft) + || this.Orientation.Equals(PageOrientation.LandscapeRight)) + { + this.TimeTableAppButton.Url = Constants.PathTimeTable_Week; + } + else + if(this.Orientation.Equals(PageOrientation.Portrait) + || this.Orientation.Equals(PageOrientation.PortraitDown) + || this.Orientation.Equals(PageOrientation.PortraitUp)) + { + this.TimeTableAppButton.Url = Constants.PathTimeTable_Day; + } + } + #endregion } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml index 2462168c..827aa3c0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml @@ -11,15 +11,16 @@ FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" - SupportedOrientations="Portrait" Orientation="Portrait" - shell:SystemTray.IsVisible="True"> + SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" + shell:SystemTray.IsVisible="True" + OrientationChanged="PhoneApplicationPage_OrientationChanged"> - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs index 9d175186..0b1998ba 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs @@ -329,5 +329,15 @@ namespace CampusAppWP8.Pages.TimeTable } } } + + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + if(e.Orientation.Equals(PageOrientation.Landscape) + || e.Orientation.Equals(PageOrientation.LandscapeLeft) + || e.Orientation.Equals(PageOrientation.LandscapeRight)) + { + NavigationService.Navigate(new Uri(Constants.PathTimeTable_Week, UriKind.Relative)); + } + } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml index 9a39756a..f72c89ba 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml @@ -11,10 +11,10 @@ FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" - SupportedOrientations="Landscape" Orientation="Landscape" + SupportedOrientations="PortraitOrLandscape" Orientation="Landscape" mc:Ignorable="d" shell:SystemTray.IsVisible="True" - > + OrientationChanged="PhoneApplicationPage_OrientationChanged"> diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs index 5b0f6c4c..4dfe2080 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs @@ -391,5 +391,15 @@ namespace CampusAppWP8.Pages.TimeTable } } } + + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + if (e.Orientation.Equals(PageOrientation.Portrait) + || e.Orientation.Equals(PageOrientation.PortraitDown) + || e.Orientation.Equals(PageOrientation.PortraitUp)) + { + NavigationService.Navigate(new Uri(Constants.PathTimeTable_Day, UriKind.Relative)); + } + } } } \ 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 9a03e8a9..5eec4a12 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs @@ -76,7 +76,22 @@ namespace CampusAppWP8.Utility.Lui.Button /// protected override void OnClick() { - string urlString = this.Url as string; + base.OnClick(); + + string urlString = string.Empty; + + if (this.Url is string) + { + urlString = this.Url as string; + } + else if (this.Url is Uri) + { + urlString = ((Uri)this.Url).OriginalString; + } + else + { + throw new NotSupportedException("Url has a unsupported type"); + } if (this.QuerryStringName != null && this.QuerryStringValue != null) { diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs index 810cd1be..86907d6b 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/CampusListPickerItemListModel.cs @@ -40,7 +40,7 @@ namespace CampusAppWPortalLib8.Model.Utility { if (userSettings) { - this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.UserSettingCampus).ToString(), AppResources.Campus_UserSetting); + this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.UserSettingCampus).ToString(), AppResources.Campus_UserSetting)); } this.AddItem(new ListPickerItemModel(((int)CampusAppWPortalLib8.Model.Settings.Campus.CB_MAIN).ToString(), AppResources.Campus_CBMain)); From e571e3e2e1dc8df38cbe2c77f86ffffebd24fe60 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Tue, 26 Nov 2013 19:06:59 +0100 Subject: [PATCH 19/26] daily commit --- .../CampusAppWP8/Pages/Events/EventPage.xaml | 10 +- .../CampusAppWP8/Pages/News/NewsPage.xaml | 10 +- .../CampusAppWP8/Pages/StartPage.xaml.cs | 22 +++-- .../Pages/TimeTable/TimeTableDay.xaml.cs | 8 ++ .../Pages/TimeTable/TimeTableWeek.xaml | 3 +- .../Pages/TimeTable/TimeTableWeek.xaml.cs | 10 +- .../Pages/TimeTable/WeekViewPageItem.cs | 18 ++++ .../CampusAppWP8/Resources/Constants.resx | 3 + .../Resources/Constants1.Designer.cs | 9 ++ .../Utility/Lui/Templates/WeekView.xaml | 17 ++-- .../Utility/Lui/Templates/WeekView.xaml.cs | 20 +++- .../Utility/Lui/Templates/WeekViewDay.xaml | 3 +- .../Utility/Lui/Templates/WeekViewDay.xaml.cs | 92 +++++++++++++++++-- 13 files changed, 193 insertions(+), 32 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml index 48d690c0..1d7123bb 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml @@ -8,12 +8,18 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page" + xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" shell:SystemTray.IsVisible="True"> + + + + + @@ -40,7 +46,7 @@ - + @@ -52,7 +58,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml index 5e8423ff..627f2710 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml @@ -8,12 +8,18 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header" xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page" + xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" shell:SystemTray.IsVisible="True"> + + + + + @@ -39,7 +45,7 @@ - + @@ -51,7 +57,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 0d93b06d..5cbdb32b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -345,25 +345,29 @@ namespace CampusAppWP8.Pages } } - #endregion - + /// Event handler. Called by TimeTable for click events. + /// Fiedler, 26.11.2013. + /// Caller of the function. + /// Routed event information. private void TimeTable_Click(object sender, RoutedEventArgs e) { - if(this.Orientation.Equals(PageOrientation.Landscape) + if (this.Orientation.Equals(PageOrientation.Landscape) || this.Orientation.Equals(PageOrientation.LandscapeLeft) || this.Orientation.Equals(PageOrientation.LandscapeRight)) { this.TimeTableAppButton.Url = Constants.PathTimeTable_Week; } else - if(this.Orientation.Equals(PageOrientation.Portrait) - || this.Orientation.Equals(PageOrientation.PortraitDown) - || this.Orientation.Equals(PageOrientation.PortraitUp)) - { - this.TimeTableAppButton.Url = Constants.PathTimeTable_Day; - } + if (this.Orientation.Equals(PageOrientation.Portrait) + || this.Orientation.Equals(PageOrientation.PortraitDown) + || this.Orientation.Equals(PageOrientation.PortraitUp)) + { + this.TimeTableAppButton.Url = Constants.PathTimeTable_Day; + } } #endregion + + #endregion } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs index 0b1998ba..1f24fea3 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableDay.xaml.cs @@ -95,6 +95,14 @@ namespace CampusAppWP8.Pages.TimeTable } else { + string dayStr = string.Empty; + + if (NavigationContext.QueryString.TryGetValue(Constants.ParamDay, out dayStr)) + { + + + } + this.ThePivot.ItemsSource = this.itemList; this.lastSelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN; this.ThePivot.SelectedIndex = PIVOT_ITEM_PAGES_HALF_DOWN; diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml index f72c89ba..07e8188d 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml @@ -34,7 +34,8 @@ Appointments="{Binding Path=AppointmentList, Mode=OneWay}" WeekNumber="{Binding Path=WeekNr, Mode=OneWay}" Days="5" - ToDayColoring="True"/> + ToDayColoring="True" + SelectedDay="{Binding Path=SelectedDay, Mode=TwoWay}"/> diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs index 4dfe2080..6a7e8cb0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/TimeTableWeek.xaml.cs @@ -398,7 +398,15 @@ namespace CampusAppWP8.Pages.TimeTable || e.Orientation.Equals(PageOrientation.PortraitDown) || e.Orientation.Equals(PageOrientation.PortraitUp)) { - NavigationService.Navigate(new Uri(Constants.PathTimeTable_Day, UriKind.Relative)); + string url = Constants.PathTimeTable_Day; + + if ((this.ThePivot.SelectedItem as WeekViewPageItem).SelectedDay.Date.Equals(DateTime.MinValue.Date) == false) + { + url += "?" + Constants.ParamDay + "=" + (this.ThePivot.SelectedItem as WeekViewPageItem).SelectedDay.ToLongDateString(); + } + + Uri newUri = new Uri(url , UriKind.Relative); + NavigationService.Navigate(newUri); } } } diff --git a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs index a5564e04..727bdced 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/TimeTable/WeekViewPageItem.cs @@ -34,6 +34,9 @@ namespace CampusAppWP8.Pages.TimeTable /// List of appointments. private ObservableCollection appointmentList = null; + /// The selected day. + private DateTime selectedDay = DateTime.MinValue; + /// Tritt ein, wenn sich ein Eigenschaftswert ändert. public event PropertyChangedEventHandler PropertyChanged; @@ -149,6 +152,21 @@ namespace CampusAppWP8.Pages.TimeTable } } + /// Gets or sets the selected day. + /// The selected day. + public DateTime SelectedDay + { + get + { + return this.selectedDay; + } + + set + { + this.selectedDay = value; + } + } + /// Notifies a property changed. /// Fiedler, 06.11.2013. /// The information. diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 5f02e256..7d33c11c 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -678,4 +678,7 @@ MensaDefaultCampus + + paramday + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index 4b3fe01c..c8de4712 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -717,6 +717,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die paramday ähnelt. + /// + public static string ParamDay { + get { + return ResourceManager.GetString("ParamDay", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml index 3e102a12..255064d7 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml @@ -10,7 +10,8 @@ FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" - x:Name="root"> + x:Name="root" + > @@ -178,31 +179,31 @@ - + - + - + - + - + - + - + diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs index 0dbeb5e8..b54f1324 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml.cs @@ -37,10 +37,15 @@ namespace CampusAppWP8.Utility.Lui.Templates /// The week number property. public static readonly DependencyProperty WeekNumberProperty = DependencyProperty.Register("WeekNumber", typeof(int), typeof(WeekView), new PropertyMetadata(-1)); + /// The head visible property. public static readonly DependencyProperty HeadVisibleProperty = DependencyProperty.Register("HeadVisible", typeof(bool), typeof(WeekView), new PropertyMetadata(true)); + /// to day coloring property. public static readonly DependencyProperty ToDayColoringProperty = DependencyProperty.Register("ToDayColoring", typeof(bool), typeof(WeekView), new PropertyMetadata(false)); - + + /// The selected day property. + public static readonly DependencyProperty SelectedDayProperty = DependencyProperty.Register("SelectedDay", typeof(DateTime), typeof(WeekView), new PropertyMetadata(null)); + /// List of borders. private List borderList = new List(); /// List of days. @@ -390,6 +395,19 @@ namespace CampusAppWP8.Utility.Lui.Templates } } + public DateTime SelectedDay + { + get + { + return (DateTime)this.GetValue(SelectedDayProperty); + } + + set + { + this.SetValue(SelectedDayProperty, value); + } + } + /// Sets column background. /// Fiedler, 06.11.2013. /// The column. diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml index 6cbe6cea..db9927df 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml @@ -33,7 +33,8 @@ Canvas.ZIndex="1" Height="{Binding Path=ActualHeight, ElementName=MainCanvas, Mode=OneWay}" Width="{Binding Path=Width, ElementName=MainCanvas, Mode=OneWay, Converter={StaticResource NaNConverter}}" - /> + Tap="BGCanvas_Tap" + Background="Transparent"/> The appointments property. public static readonly DependencyProperty AppointmentsProperty = DependencyProperty.Register("Appointments", typeof(ObservableCollection), typeof(WeekViewDay), new PropertyMetadata(null, OnAppointmentsChanged)); + /// The selected date property. + public static readonly DependencyProperty SelectedDateProperty = DependencyProperty.Register("SelectedDate", typeof(DateTime), typeof(WeekViewDay), new PropertyMetadata(DateTime.MinValue, OnSelectedDateChanged)); + + /// The selected property. + public static readonly DependencyProperty SelectedProperty = DependencyProperty.Register("Selected", typeof(bool), typeof(WeekViewDay), new PropertyMetadata(false)); + /// The stacks. private List> stacks = new List>(); @@ -79,6 +85,43 @@ namespace CampusAppWP8.Utility.Lui.Templates } } + /// Raises the dependency property changed event. + /// Fiedler, 26.11.2013. + /// The DependencyObject to process. + /// Event information to send to registered event handlers. + private static void OnSelectedDateChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + if (e.NewValue != null && e.OldValue != null) + { + if (((DateTime)e.NewValue).Date.Equals((o as WeekViewDay).Date.Date) + && ((DateTime)e.OldValue).Date.Equals((o as WeekViewDay).Date.Date)) + { + return; + } + } + + if (e.NewValue != null) + { + if (((DateTime)e.NewValue).Date.Equals((o as WeekViewDay).Date.Date)) + { + SolidColorBrush newBG = new SolidColorBrush(Colors.LightGray); + newBG.Opacity = 0.5; + + (o as WeekViewDay).BGCanvas.Background = newBG; + } + } + + if (e.OldValue != null) + { + if (((DateTime)e.OldValue).Date.Equals((o as WeekViewDay).Date.Date)) + { + SolidColorBrush newBG = new SolidColorBrush(Colors.Transparent); + + (o as WeekViewDay).BGCanvas.Background = newBG; + } + } + } + /// Raises the notify collection changed event. /// Fiedler, 06.11.2013. /// The object to process. @@ -178,6 +221,43 @@ namespace CampusAppWP8.Utility.Lui.Templates } } + /// Gets or sets the selected date. + /// The selected date. + public DateTime SelectedDate + { + get + { + return (DateTime)this.GetValue(SelectedDateProperty); + } + + set + { + this.SetValue(SelectedDateProperty, value); + } + } + + /// Gets or sets a value indicating whether the selected. + /// true if selected, false if not. + public bool Selected + { + get + { + return (this.Date.Date.Equals(this.SelectedDate.Date)); + } + + set + { + if (value == true) + { + this.SelectedDate = this.Date; + } + else + { + this.SelectedDate = DateTime.MinValue; + } + } + } + /// Check stack add. /// Fiedler, 06.11.2013. /// The model. @@ -422,13 +502,6 @@ namespace CampusAppWP8.Utility.Lui.Templates } } - /* - protected override void OnDoubleTap(System.Windows.Input.GestureEventArgs e) - { - base.OnDoubleTap(e); - } - */ - /// Draw lines. /// Fiedler, 22.10.2013. private void DrawLines() @@ -465,5 +538,10 @@ namespace CampusAppWP8.Utility.Lui.Templates } } } + + private void BGCanvas_Tap(object sender, System.Windows.Input.GestureEventArgs e) + { + this.Selected = true; + } } } From 560fbaea95206ca7a9df12f5937d424c3f08b483 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 27 Nov 2013 10:12:11 +0100 Subject: [PATCH 20/26] fix bugs --- .../AppAccentColorListPickerItemListModel.cs | 34 +++--- .../Pages/Setting/AppSettingPage.xaml.cs | 27 +++-- .../CampusAppWP8/Resources/Constants.resx | 36 ++++++ .../Resources/Constants1.Designer.cs | 108 ++++++++++++++++++ .../CampusAppWP8/Utility/Utilities.cs | 4 +- 5 files changed, 181 insertions(+), 28 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/AppAccentColorListPickerItemListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/AppAccentColorListPickerItemListModel.cs index 0abc5a61..45d8364c 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/AppAccentColorListPickerItemListModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/AppAccentColorListPickerItemListModel.cs @@ -8,9 +8,8 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Model.Utility { - - using CampusAppWPortalLib8.Resources; using System.Windows.Media; + using CampusAppWP8.Resources; /// A data Model for the application accent color list picker item list. /// Stubbfel, 26.11.2013. @@ -20,22 +19,22 @@ namespace CampusAppWP8.Model.Utility #region member /// The faculty 1 color. - private static readonly SolidColorBrush faculty1Color = (SolidColorBrush)App.Current.Resources["FacultyBrush1"]; + private static readonly SolidColorBrush Faculty1Color = (SolidColorBrush)App.Current.Resources[Constants.Brush_Faculty1]; /// The faculty 2 color. - private static readonly SolidColorBrush faculty2Color = (SolidColorBrush)App.Current.Resources["FacultyBrush2"]; + private static readonly SolidColorBrush Faculty2Color = (SolidColorBrush)App.Current.Resources[Constants.Brush_Faculty2]; /// The faculty 3 color. - private static readonly SolidColorBrush faculty3Color = (SolidColorBrush)App.Current.Resources["FacultyBrush3"]; + private static readonly SolidColorBrush Faculty3Color = (SolidColorBrush)App.Current.Resources[Constants.Brush_Faculty3]; /// The faculty 4 color. - private static readonly SolidColorBrush faculty4Color = (SolidColorBrush)App.Current.Resources["FacultyBrush4"]; + private static readonly SolidColorBrush Faculty4Color = (SolidColorBrush)App.Current.Resources[Constants.Brush_Faculty4]; /// The faculty 5 color. - private static readonly SolidColorBrush faculty5Color = (SolidColorBrush)App.Current.Resources["FacultyBrush5"]; + private static readonly SolidColorBrush Faculty5Color = (SolidColorBrush)App.Current.Resources[Constants.Brush_Faculty5]; /// The faculty. - private readonly string faculty = AppResources.Faculty; + private readonly string faculty = CampusAppWPortalLib8.Resources.AppResources.Faculty; #endregion @@ -55,16 +54,23 @@ namespace CampusAppWP8.Model.Utility #region Method + /// Gets index or default. + /// Stubbfel, 27.11.2013. + /// The value. + /// The index or default. public override int GetIndexOrDefault(SolidColorBrush value) { int index = 0; foreach (ColorListPickerItemModel brush in this.List) { - if (brush.Value.Color.Equals(value.Color)) { + if (brush.Value.Color.Equals(value.Color)) + { break; } + index++; } + return index; } @@ -73,11 +79,11 @@ namespace CampusAppWP8.Model.Utility protected override void LoadList() { this.AddItem(new ColorListPickerItemModel(new SolidColorBrush(Settings.AppSetting.DisplaySetting.PhoneAccentColor), CampusAppWP8.Resources.AppResources.AccentColor)); - this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty1Color, this.faculty + " 1")); - this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty2Color, this.faculty + " 2")); - this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty3Color, faculty + " 3")); - this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty4Color, faculty + " 4")); - this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.faculty5Color, faculty + " 5")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.Faculty1Color, this.faculty + " 1")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.Faculty2Color, this.faculty + " 2")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.Faculty3Color, this.faculty + " 3")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.Faculty4Color, this.faculty + " 4")); + this.AddItem(new ColorListPickerItemModel(AppAccentColorListPickerItemListModel.Faculty5Color, this.faculty + " 5")); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs index 8f91ea67..09efc36f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml.cs @@ -9,19 +9,19 @@ namespace CampusAppWP8.Pages.Setting { using System; - using System.Windows.Navigation; - using CampusAppWP8.Resources; - using Microsoft.Phone.Controls; - using CampusAppWP8.Model.Utility; using System.Windows.Media; + using System.Windows.Navigation; + using CampusAppWP8.Model.Utility; + using CampusAppWP8.Resources; using CampusAppWP8.Utility; + using Microsoft.Phone.Controls; /// Class for the AppSettingPage. /// Stubbfel, 15.10.2013. /// + /// public partial class AppSettingPage : PhoneApplicationPage, IRefreshingPage { - #region member /// List of colors of the application accents. @@ -56,6 +56,7 @@ namespace CampusAppWP8.Pages.Setting #endregion #region protected + /// Override the OnNavigatedTo method. /// Stubbfel, 15.10.2013. /// @@ -90,6 +91,7 @@ namespace CampusAppWP8.Pages.Setting #endregion #region private + /// Loads the settings. /// Stubbfel, 25.11.2013. private void LoadSettings() @@ -117,18 +119,19 @@ namespace CampusAppWP8.Pages.Setting this.LoadSettings(); } - /// - /// Event handler. Called by AccentColorPicker for selection changed events. - /// + /// Event handler. Called by AccentColorPicker for selection changed events. /// Stubbfel, 26.11.2013. /// Source of the event. /// Selection changed event information. private void AccentColorPicker_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { - int selectedIndex = this.AccentColorPicker.SelectedIndex; - Color newColor = this.appAccentColors.List[selectedIndex].Value.Color; - Utilities.SwitchAccentColor(newColor); - Settings.AppSetting.DisplaySetting.AppAccentColor = newColor; + if (e.AddedItems.Count == 1 && e.RemovedItems.Count == 1) + { + int selectedIndex = this.AccentColorPicker.SelectedIndex; + Color newColor = this.appAccentColors.List[selectedIndex].Value.Color; + Utilities.SwitchAccentColor(newColor); + Settings.AppSetting.DisplaySetting.AppAccentColor = newColor; + } } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index f72cd6ad..d4bcab11 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -684,4 +684,40 @@ PhoneAccentColor + + FacultyBrush1 + + + FacultyBrush2 + + + FacultyBrush3 + + + FacultyBrush4 + + + FacultyBrush5 + + + PhoneAccentBrush + + + FacultyColor1 + + + FacultyColor2 + + + FacultyColor3 + + + FacultyColor4 + + + FacultyColor5 + + + PhoneAccentColor + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index 95ec9c9d..cd451231 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -204,6 +204,60 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyBrush1 ähnelt. + /// + public static string Brush_Faculty1 { + get { + return ResourceManager.GetString("Brush_Faculty1", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyBrush2 ähnelt. + /// + public static string Brush_Faculty2 { + get { + return ResourceManager.GetString("Brush_Faculty2", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyBrush3 ähnelt. + /// + public static string Brush_Faculty3 { + get { + return ResourceManager.GetString("Brush_Faculty3", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyBrush4 ähnelt. + /// + public static string Brush_Faculty4 { + get { + return ResourceManager.GetString("Brush_Faculty4", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyBrush5 ähnelt. + /// + public static string Brush_Faculty5 { + get { + return ResourceManager.GetString("Brush_Faculty5", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die PhoneAccentBrush ähnelt. + /// + public static string Brush_PhoneAccent { + get { + return ResourceManager.GetString("Brush_PhoneAccent", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die BTU-CampusApp ähnelt. /// @@ -222,6 +276,60 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyColor1 ähnelt. + /// + public static string Color_Faculty1 { + get { + return ResourceManager.GetString("Color_Faculty1", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyColor2 ähnelt. + /// + public static string Color_Faculty2 { + get { + return ResourceManager.GetString("Color_Faculty2", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyColor3 ähnelt. + /// + public static string Color_Faculty3 { + get { + return ResourceManager.GetString("Color_Faculty3", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyColor4 ähnelt. + /// + public static string Color_Faculty4 { + get { + return ResourceManager.GetString("Color_Faculty4", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die FacultyColor5 ähnelt. + /// + public static string Color_Faculty5 { + get { + return ResourceManager.GetString("Color_Faculty5", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die PhoneAccentColor ähnelt. + /// + public static string Color_PhoneAccent { + get { + return ResourceManager.GetString("Color_PhoneAccent", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die 8 ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs index 01d58121..ba9a0eb1 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -467,8 +467,8 @@ namespace CampusAppWP8.Utility /// The new color. public static void SwitchAccentColor(Color newColor) { - Utilities.SwitchColor("PhoneAccentColor", newColor); - ((SolidColorBrush)App.Current.Resources["PhoneAccentBrush"]).Color = newColor; + Utilities.SwitchColor(Constants.Color_PhoneAccent, newColor); + ((SolidColorBrush)App.Current.Resources[Constants.Brush_PhoneAccent]).Color = newColor; } #endregion } From 8c2ce5db35af168ca198a965a4756b33a5b274ef Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 27 Nov 2013 12:12:44 +0100 Subject: [PATCH 21/26] refactor impressum --- .../Pages/Setting/AppSettingPage.xaml | 2 +- .../CampusAppWP8/Pages/Setting/Impressum.xaml | 54 ++++++++++++++++--- .../CampusAppWP8/Pages/StartPage.xaml | 25 +++------ .../CampusAppWP8/Pages/StartPage.xaml.cs | 8 +-- .../Resources/AppResources.Designer.cs | 2 +- .../CampusAppWP8/Resources/AppResources.resx | 2 +- .../CampusAppWP8/Styles/StartPageStyles.xaml | 4 +- 7 files changed, 62 insertions(+), 35 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml index 8cf1bb9d..91ccc82c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/AppSettingPage.xaml @@ -26,7 +26,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/Impressum.xaml b/CampusAppWP8/CampusAppWP8/Pages/Setting/Impressum.xaml index cba5a15d..ad1ea792 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Setting/Impressum.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/Impressum.xaml @@ -29,10 +29,13 @@ + - Name: BTU Campus-App - Version: 1.0 - Kontakt: + Name + BTU CampusApp + Version + 1.1 + Kontakt: @@ -43,19 +46,56 @@ - Email: + Email: - Website: + Website: - Facebook: + Facebook: - + Versionshinweise + Version 1.1: + + - neue Funktionen: + - Stundenplan + - Wahl der Akzentfarbe + - Änderungen + - Überarbeitetes Layout der Startseite + - Überarbeitetes Einstellungsmenu + - Überarbeitet Raumübersicht + + Version 1.0.0.1: + + - Bugfixes: + - Beseitigung eines Fehler beim starten der App + + Version 1.0: + + Initaler Release + Funktionsübersicht: + - Vorlesungsverzeichnis (Vorlesungen, Übungen, Prüfungen etc.) + - Mensaplan + - Lehrstuhlübersicht + - Fachschaftenübersicht + - Prüfungsordnung + - Personsuche (Mitarbeiter) + - BTU Webmail + - Öffnungszeiten + - Verzeichnis mit nützlichen Links + - News und Events rund um den Campus + - mit Text-to-Speech−Funktion + - Campusplan : + - Gebäudesuchfunktion + - Lokalisierung mittles GPS oder BTU-Tag (QR-Codes, NFC-Tags) + - Ebenenpläne für das IKMZ und MZG + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml index 4e3573d2..67902576 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml @@ -1,4 +1,4 @@ - @@ -27,8 +26,7 @@ - - + @@ -121,14 +119,12 @@ - - - + @@ -237,7 +233,7 @@ - + @@ -273,7 +269,6 @@ - - @@ -313,18 +307,15 @@ - + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index ed3ee63b..a125d5cd 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -12,27 +12,23 @@ namespace CampusAppWP8.Pages using System.Runtime.InteropServices.WindowsRuntime; using System.Threading; using System.Windows; - using System.Windows.Controls; using System.Windows.Navigation; using CampusAppWP8.Feed.Utility; using CampusAppWP8.File.Places; using CampusAppWP8.Model.Setting; - using CampusAppWP8.Pages.TimeTable; using CampusAppWP8.Resources; using CampusAppWP8.Utility; using CampusAppWP8.Utility.Lui.MessageBoxes; using CampusAppWP8.Utility.Lui.Page; using CampusAppWP8.Utility.Lui.Tiles; using CampusAppWP8.Utility.NDEF; - using Microsoft.Phone.Controls; - using Microsoft.Phone.Shell; using Windows.Networking.Proximity; - using System.Windows.Media; + using Microsoft.Phone.Controls; /// Class for the StartPage. /// Stubbfel, 15.10.2013. /// - public partial class StartPage : PortraitLandscapePage + public partial class StartPage : PhoneApplicationPage { #region Member diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index f339bccb..55e6f33d 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1303,7 +1303,7 @@ namespace CampusAppWP8.Resources { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Über BTU Campus-App ähnelt. + /// Sucht eine lokalisierte Zeichenfolge, die Über BTU CampusApp ähnelt. /// public static string Setting_ImpressumTitle { get { diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index eb852176..f3d9f5fd 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -570,7 +570,7 @@ BTU-Tag-Standardfunktion - Über BTU Campus-App + Über BTU CampusApp Der eingescannte Tag ist kein BTU-Tag diff --git a/CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml b/CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml index c6db84ac..73e98eca 100644 --- a/CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml +++ b/CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml @@ -22,8 +22,8 @@ - - + +