本文整理汇总了C#中ApiClient.IsSubbed方法的典型用法代码示例。如果您正苦于以下问题:C# ApiClient.IsSubbed方法的具体用法?C# ApiClient.IsSubbed怎么用?C# ApiClient.IsSubbed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiClient
的用法示例。
在下文中一共展示了ApiClient.IsSubbed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateIsSubbed
internal void UpdateIsSubbed()
{
Log.Info("Getting IsSubscribed");
bool? ret = null;
try
{
if (Program.LobbyClient.IsConnected)
{
var client = new ApiClient();
var res = client.IsSubbed(Program.LobbyClient.Me.UserName, Prefs.Password.Decrypt());
switch (res)
{
case IsSubbedResult.Ok:
ret = true;
break;
default:
ret = false;
break;
}
}
else
{
if (string.IsNullOrWhiteSpace(Prefs.Password.Decrypt())) ret = false;
else
{
var client = new ApiClient();
var res = client.IsSubbed(Prefs.Username, Prefs.Password.Decrypt());
switch (res)
{
case IsSubbedResult.Ok:
ret = true;
break;
default:
ret = false;
break;
}
}
}
}
catch (Exception e)
{
Log.Warn("ce", e);
}
Log.InfoFormat("Is Subscribed = {0}", ret == null ? "Unknown" : ret.ToString());
var prev = PrevSubValue;
PrevSubValue = ret;
if (ret != prev && ret != null)
{
this.OnIsSubbedChanged((bool)ret);
//Program.LobbyClient.SetSub((bool)ret);
}
}
示例2: UpdateIsSubbed
internal void UpdateIsSubbed()
{
Log.Info("Getting IsSubscribed");
bool? ret = null;
try
{
if (Program.LobbyClient.IsConnected)
{
var client = new ApiClient();
var res = IsSubbedResult.UnknownError;
if (!String.IsNullOrWhiteSpace(Program.LobbyClient.Password))
{
res = client.IsSubbed(Program.LobbyClient.Me.UserName, Program.LobbyClient.Password);
}
else
res = client.IsSubbed(Prefs.Username, Prefs.Password.Decrypt());
switch (res)
{
case IsSubbedResult.Ok:
ret = true;
break;
case IsSubbedResult.AuthenticationError:
case IsSubbedResult.NoSubscription:
case IsSubbedResult.SubscriptionExpired:
ret = false;
break;
}
}
else
{
if (string.IsNullOrWhiteSpace(Prefs.Password.Decrypt())) ret = false;
else
{
var client = new ApiClient();
var res = client.IsSubbed(Prefs.Username, Prefs.Password.Decrypt());
switch (res)
{
case IsSubbedResult.Ok:
ret = true;
break;
case IsSubbedResult.AuthenticationError:
case IsSubbedResult.NoSubscription:
case IsSubbedResult.SubscriptionExpired:
ret = false;
break;
}
}
}
}
catch (Exception e)
{
Log.Warn("ce", e);
}
Log.InfoFormat("Is Subscribed = {0}", ret == null ? "Unknown" : ret.ToString());
var prev = PrevSubValue;
if (ret == null) // If we happen to not get a result back, then fuck it, don't want a failure to make the user seem like they don't have a sub.
return;
PrevSubValue = ret;
if (ret != prev)
{
this.OnIsSubbedChanged((bool)ret);
//Program.LobbyClient.SetSub((bool)ret);
}
}