mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-21 04:26:29 +02:00
Version 3.0.370
This commit is contained in:
parent
f5cf9bb22f
commit
bdb2dec1c1
233 changed files with 10252 additions and 6779 deletions
12
TINKLib/Model/Message/IMessage.cs
Normal file
12
TINKLib/Model/Message/IMessage.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace TINK.Model.Message
|
||||
{
|
||||
public interface IMessage
|
||||
{
|
||||
void LongAlert(string message);
|
||||
void ShortAlert(string message);
|
||||
}
|
||||
}
|
67
TINKLib/Model/Message/Message.cs
Normal file
67
TINKLib/Model/Message/Message.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Android.App;
|
||||
using Android.Widget;
|
||||
using Foundation;
|
||||
using TINK.Model.Message;
|
||||
using UIKit;
|
||||
|
||||
[assembly: Xamarin.Forms.Dependency(typeof(MessageAndroid))]
|
||||
[assembly: Xamarin.Forms.Dependency(typeof(MessageIOS))]
|
||||
namespace TINK.Model.Message
|
||||
{
|
||||
public class MessageAndroid : IMessage
|
||||
{
|
||||
public void LongAlert(string message)
|
||||
{
|
||||
Toast.MakeText(Application.Context, message, ToastLength.Long).Show();
|
||||
}
|
||||
|
||||
public void ShortAlert(string message)
|
||||
{
|
||||
Toast.MakeText(Application.Context, message, ToastLength.Short).Show();
|
||||
}
|
||||
}
|
||||
|
||||
public class MessageIOS : IMessage
|
||||
{
|
||||
const double LONG_DELAY = 3.5;
|
||||
const double SHORT_DELAY = 0.75;
|
||||
|
||||
public void LongAlert(string message)
|
||||
{
|
||||
ShowAlert(message, LONG_DELAY);
|
||||
}
|
||||
|
||||
public void ShortAlert(string message)
|
||||
{
|
||||
ShowAlert(message, SHORT_DELAY);
|
||||
}
|
||||
|
||||
void ShowAlert(string message, double seconds)
|
||||
{
|
||||
var alert = UIAlertController.Create(null, message, UIAlertControllerStyle.Alert);
|
||||
|
||||
var alertDelay = NSTimer.CreateScheduledTimer(seconds, obj =>
|
||||
{
|
||||
DismissMessage(alert, obj);
|
||||
});
|
||||
|
||||
UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alert, true, null);
|
||||
}
|
||||
|
||||
void DismissMessage(UIAlertController alert, NSTimer alertDelay)
|
||||
{
|
||||
if (alert != null)
|
||||
{
|
||||
alert.DismissViewController(true, null);
|
||||
}
|
||||
|
||||
if (alertDelay != null)
|
||||
{
|
||||
alertDelay.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue