sharee.bike-App/LastenradBayern/TINK/View/FeedbackPopup.xaml.cs

64 lines
1.8 KiB
C#
Raw Permalink Normal View History

2021-11-07 19:42:59 +01:00
using System;
using Xamarin.CommunityToolkit.UI.Views;
using Xamarin.Forms.Xaml;
namespace TINK.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class FeedbackPopup : Popup<FeedbackPopup.Result>
{
2022-01-04 18:54:03 +01:00
/// <summary> Constructs user feedback popup.</summary>
/// <param name="co2Saving"> Co2 saving information.</param>
public FeedbackPopup(string co2Saving = null)
2021-11-07 19:42:59 +01:00
{
InitializeComponent();
2022-01-04 18:54:03 +01:00
if (string.IsNullOrEmpty(co2Saving))
Co2SavingFrame.IsVisible = false;
else
Co2SavingLabel.Text = co2Saving;
2021-11-07 19:42:59 +01:00
}
protected override FeedbackPopup.Result GetLightDismissResult()
{
return new Result
{
Message = feedbackMessage.Text,
IsBikeBroken = brockenCheckBox.IsChecked
};
}
private void OnOkClicked(object sender, EventArgs eventArgs)
{
var result = new Result
{
Message = feedbackMessage.Text,
IsBikeBroken = brockenCheckBox.IsChecked
};
Dismiss(result);
}
/// <summary>
/// Feedback given by user when returning bike.
/// </summary>
#if USCSHARP9
public class Result : IViewService.IUserFeedback
#else
public new class Result : IUserFeedback
#endif
{
/// <summary>
/// Holds whether bike is broken or not.
/// </summary>
public bool IsBikeBroken { get; set; }
/// <summary>
/// Holds either
/// - general feedback
/// - error description of broken bike
/// or both.
/// </summary>
public string Message { get; set; }
}
}
}