Display Info instead of Alert
This commit is contained in:
@@ -25,6 +25,11 @@ namespace Jugenddienst_Stunden.ViewModels {
|
|||||||
public ICommand SelectEntryCommand { get; }
|
public ICommand SelectEntryCommand { get; }
|
||||||
|
|
||||||
public ICommand LoadDataCommand { get; private set; }
|
public ICommand LoadDataCommand { get; private set; }
|
||||||
|
|
||||||
|
public event EventHandler<string> AlertEvent;
|
||||||
|
public event EventHandler<string> InfoEvent;
|
||||||
|
|
||||||
|
|
||||||
public object Stunden { get; }
|
public object Stunden { get; }
|
||||||
|
|
||||||
|
|
||||||
@@ -138,7 +143,7 @@ namespace Jugenddienst_Stunden.ViewModels {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public event EventHandler<string> AlertEvent;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -171,7 +176,7 @@ namespace Jugenddienst_Stunden.ViewModels {
|
|||||||
////}
|
////}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
DayTimes = new List<DayTime>();
|
DayTimes = new List<DayTime>();
|
||||||
AlertEvent?.Invoke(this, e.Message);
|
InfoEvent?.Invoke(this, e.Message);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,16 @@ public partial class StundenPage : ContentPage {
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
if(BindingContext is StundenViewModel vm) {
|
if(BindingContext is StundenViewModel vm) {
|
||||||
vm.AlertEvent += Vm_AlertEvent;
|
vm.AlertEvent += Vm_AlertEvent;
|
||||||
|
vm.InfoEvent += Vm_InfoEvent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Vm_AlertEvent(object? sender, string e) {
|
private void Vm_AlertEvent(object? sender, string e) {
|
||||||
DisplayAlert("Fehler:", e, "OK");
|
DisplayAlert("Fehler:", e, "OK");
|
||||||
}
|
}
|
||||||
|
private void Vm_InfoEvent(object? sender, string e) {
|
||||||
|
DisplayAlert("Information:", e, "OK");
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnAppearing() {
|
protected override void OnAppearing() {
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
|
|||||||
Reference in New Issue
Block a user