sharee.bike-App/TINKLib/Model/Connector/ConnectorFactory.cs

20 lines
720 B
C#
Raw Permalink Normal View History

2021-05-13 20:03:07 +02:00
using System;
namespace TINK.Model.Connector
{
public class ConnectorFactory
{
/// <summary>
/// Gets a connector object depending on whether beein onlin or offline.
/// </summary>
/// <param name="isConnected">True if online, false if offline</param>
/// <returns></returns>
public static IConnector Create(bool isConnected, Uri activeUri, string userAgent, string sessionCookie, string mail, TimeSpan? expiresAfter = null)
{
return isConnected
? new Connector(activeUri, userAgent, sessionCookie, mail, expiresAfter: expiresAfter) as IConnector
: new ConnectorCache(sessionCookie, mail);
}
}
}