public void Start(bool useXMPP)
{
lock (UpdateLock)
{
ThrowIfDisposed();
if (Config.OAuthRefreshToken != null && Config.OAuthCodeAccepted)
{
if (OAuthTicket == null)
{
OAuthTicket = new OAuthTicket(Config.OAuthRefreshToken, Config.OAuthClientID, Config.OAuthClientSecret, Config.OAuthRedirectURI);
}
if (PrintQueueUpdateTimer == null)
{
PrintQueueUpdateTimer = new Timer((obj) => { lock (UpdateLock) { PollUpdatePrintQueues(); } }, null, TimeSpan.Zero, PrintQueueUpdateInterval);
}
if (XMPP == null && PrintJobUpdateTimer == null)
{
PrintJobUpdateTimer = new Timer((obj) => PollUpdateCloudPrintJobs(), null, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30));
if (useXMPP)
{
RunXMPP();
}
}
Logger.Log(LogLevel.Info, "Cloud Print Proxy started");
}
else
{
throw new InvalidOperationException("Need to register and accept proxy before it can be started");
}
}
}