当前位置: 首页>>代码示例>>C#>>正文


C# ApiClient.IsSubbed方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:haslo,项目名称:OCTGN,代码行数:53,代码来源:SubscriptionModule.cs

示例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);
            }
        }
开发者ID:rexperalta,项目名称:OCTGN,代码行数:66,代码来源:SubscriptionModule.cs


注:本文中的ApiClient.IsSubbed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。