Anpassungen Api
Anfrage genaues Datum und einzelner Eintrag
This commit is contained in:
@@ -12,6 +12,11 @@
|
|||||||
ContentTemplate="{DataTemplate views:StundenPage}"
|
ContentTemplate="{DataTemplate views:StundenPage}"
|
||||||
Icon="{OnPlatform 'icon_watch.png', iOS='icon_watch_ios.png', MacCatalyst='icon_watch_ios.png'}" />
|
Icon="{OnPlatform 'icon_watch.png', iOS='icon_watch_ios.png', MacCatalyst='icon_watch_ios.png'}" />
|
||||||
|
|
||||||
|
<ShellContent
|
||||||
|
Title="Stunde"
|
||||||
|
ContentTemplate="{DataTemplate views:StundePage}"
|
||||||
|
Icon="{OnPlatform 'icon_watch.png', iOS='icon_watch_ios.png', MacCatalyst='icon_watch_ios.png'}" />
|
||||||
|
|
||||||
<ShellContent
|
<ShellContent
|
||||||
Title="Notes"
|
Title="Notes"
|
||||||
ContentTemplate="{DataTemplate views:AllNotesPage}"
|
ContentTemplate="{DataTemplate views:AllNotesPage}"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">27.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">29.0</SupportedOSPlatformVersion>
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
|
||||||
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
|
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ using Microsoft.Maui.Networking;
|
|||||||
using Microsoft.Maui.Controls;
|
using Microsoft.Maui.Controls;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
using Jugenddienst_Stunden.Types;
|
using Jugenddienst_Stunden.Types;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
namespace Jugenddienst_Stunden.Models
|
namespace Jugenddienst_Stunden.Models {
|
||||||
{
|
|
||||||
internal class Stunde : ObservableObject {
|
internal class Stunde : ObservableObject {
|
||||||
|
|
||||||
|
|
||||||
@@ -54,14 +55,14 @@ namespace Jugenddienst_Stunden.Models
|
|||||||
//name = "Le";
|
//name = "Le";
|
||||||
//surname = "Ma";
|
//surname = "Ma";
|
||||||
|
|
||||||
//apiKey = "OXxpM0lQcXcySUp0S3hHbzFSb3VqdStwRXlDQmd8aHR0cHM6Ly9ob3Vycy5waWRhLmluZm8vYXBwYXBp";
|
apiKey = "OXxzTkxVWjJqdmI2VXFrdUhtcktwK1d1YU41cTh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp";
|
||||||
//name = "Eli";
|
name = "Eli";
|
||||||
//surname = "Gap";
|
surname = "Gap";
|
||||||
|
|
||||||
|
|
||||||
//Preferences.Default.Set("apiKey", apiKey);
|
Preferences.Default.Set("apiKey", apiKey);
|
||||||
//Preferences.Default.Set("name", name);
|
Preferences.Default.Set("name", name);
|
||||||
//Preferences.Default.Set("surname", surname);
|
Preferences.Default.Set("surname", surname);
|
||||||
|
|
||||||
|
|
||||||
Hours hours = new Hours();
|
Hours hours = new Hours();
|
||||||
@@ -93,10 +94,10 @@ namespace Jugenddienst_Stunden.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static async Task<Hours> LoadDay(DateTime date) {
|
public static async Task<List<DayTime>> LoadDay(DateTime date) {
|
||||||
|
|
||||||
|
|
||||||
Hours hours = new Hours();
|
List<DayTime> daytimes = new List<DayTime>();
|
||||||
|
|
||||||
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
||||||
await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
||||||
@@ -115,19 +116,24 @@ namespace Jugenddienst_Stunden.Models
|
|||||||
throw new Exception("Problem mit Token");
|
throw new Exception("Problem mit Token");
|
||||||
}
|
}
|
||||||
|
|
||||||
hours = JsonConvert.DeserializeObject<Hours>(data);
|
daytimes = System.Text.Json.JsonSerializer.Deserialize<List<DayTime>>(data);
|
||||||
//Preferences.Default.Set("name", hours.operator_api.name);
|
//Preferences.Default.Set("name", hours.operator_api.name);
|
||||||
//Preferences.Default.Set("surname", hours.operator_api.surname);
|
//Preferences.Default.Set("surname", hours.operator_api.surname);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Hours = hours;
|
//Hours = hours;
|
||||||
return hours;
|
return daytimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DayTime LoadEntry(int id) {
|
public static async Task<DayTime> LoadEntry(int id) {
|
||||||
|
|
||||||
DayTime hours = Hours.daytime.Find(x => x.id == id);
|
var tokendata = new TokenData(apiKey);
|
||||||
|
|
||||||
|
var data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?id=" + id, tokendata.apiKey);
|
||||||
|
|
||||||
|
//DayTime hours = Hours.daytime.Find(x => x.id == id);
|
||||||
|
DayTime hours = JsonConvert.DeserializeObject<DayTime>(data);
|
||||||
|
|
||||||
return hours;
|
return hours;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ namespace Jugenddienst_Stunden.ViewModels {
|
|||||||
public object Stunden { get; }
|
public object Stunden { get; }
|
||||||
|
|
||||||
|
|
||||||
|
private List<Types.DayTime> _stunde;
|
||||||
|
public List<Types.DayTime> Stunde {
|
||||||
|
get => _stunde;
|
||||||
|
}
|
||||||
private Types.Hours _hour;
|
private Types.Hours _hour;
|
||||||
public Types.Hours Hours {
|
public Types.Hours Hours {
|
||||||
get => _hour;
|
get => _hour;
|
||||||
@@ -155,14 +158,14 @@ namespace Jugenddienst_Stunden.ViewModels {
|
|||||||
|
|
||||||
public async Task LoadDay(DateTime date) {
|
public async Task LoadDay(DateTime date) {
|
||||||
try {
|
try {
|
||||||
_hour = await Models.Stunde.LoadDay(date);
|
_hour.daytime = await Models.Stunde.LoadDay(date);
|
||||||
if (_hour.zeit_total_daily_api != null) {
|
////if (_hour.zeit_total_daily_api != null) {
|
||||||
TimeDay = _hour.zeit_total_daily_api.Where(static p => p.Day == GetDay.Day).ToList() ?? new List<TimeDay> { new TimeDay { Day = GetDay.Day, Hours = 0 } };
|
////TimeDay = _hour.zeit_total_daily_api.Where(static p => p.Day == GetDay.Day).ToList() ?? new List<TimeDay> { new TimeDay { Day = GetDay.Day, Hours = 0 } };
|
||||||
//RefreshProperties();
|
//RefreshProperties();
|
||||||
OnPropertyChanged(nameof(ShowDay));
|
OnPropertyChanged(nameof(ShowDay));
|
||||||
OnPropertyChanged(nameof(TimeDay));
|
OnPropertyChanged(nameof(TimeDay));
|
||||||
OnPropertyChanged(nameof(DayTimes));
|
OnPropertyChanged(nameof(DayTimes));
|
||||||
}
|
////}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
AlertEvent?.Invoke(this, e.Message);
|
AlertEvent?.Invoke(this, e.Message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,21 @@
|
|||||||
x:Class="Jugenddienst_Stunden.Views.StundePage"
|
x:Class="Jugenddienst_Stunden.Views.StundePage"
|
||||||
Title="StundePage">
|
Title="StundePage">
|
||||||
|
|
||||||
<ContentPage.BindingContext>
|
<!--<ContentPage.BindingContext>
|
||||||
<models:StundeViewModel />
|
<models:StundeViewModel />
|
||||||
</ContentPage.BindingContext>
|
</ContentPage.BindingContext>-->
|
||||||
|
|
||||||
<VerticalStackLayout>
|
<VerticalStackLayout>
|
||||||
<Label
|
<Label
|
||||||
|
x:Name="StundeDescription"
|
||||||
Text="Welcome to .NET MAUI!"
|
Text="Welcome to .NET MAUI!"
|
||||||
VerticalOptions="Center"
|
VerticalOptions="Center"
|
||||||
HorizontalOptions="Center" />
|
HorizontalOptions="Center" />
|
||||||
|
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
|
||||||
|
<Button Text="Save" Clicked="GetDayTime" />
|
||||||
|
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Text="Delete" />
|
||||||
|
</Grid>
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
@@ -1,9 +1,28 @@
|
|||||||
|
using Jugenddienst_Stunden.Types;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Jugenddienst_Stunden.Views;
|
namespace Jugenddienst_Stunden.Views;
|
||||||
|
|
||||||
public partial class StundePage : ContentPage
|
public partial class StundePage : ContentPage
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private DayTime _stunde;
|
||||||
|
|
||||||
public StundePage()
|
public StundePage()
|
||||||
{
|
{
|
||||||
|
//GetDayTime();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void GetDayTime() {
|
||||||
|
_stunde = await Models.Stunde.LoadEntry(4096);
|
||||||
|
//_stunde = new DayTime();
|
||||||
|
//_stunde.description = "asd";
|
||||||
|
StundeDescription.Text = _stunde.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetDayTime(object sender, EventArgs e) {
|
||||||
|
GetDayTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user