Пример #1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            var d = taskInstance.GetDeferral();

            try
            {
                _Register(true);
                if (!Enabled)
                {
                    return;
                }
                if (ExClient.Client.Current.NeedLogOn)
                {
                    return;
                }
                HentaiVerseInfo.DawnOfDayRewardsAwarded += _HentaiVerseInfo_DawnOfDayRewardsAwarded;
                await HentaiVerseInfo.FetchAsync();

                if (ExClient.Client.Current.UserId == 1832306)
                {
                    // it is a secret!
                    var topic = await Topic.FetchAsync(201268);

                    var content = new[] { "每日签到", "签到~", "簽到 ._.", " :D 签到", "新的一天开始了" };
                    var index   = new Random().Next(content.Length);
                    await topic.SendPostAsync(content[index], false, true, true);
                }
            }
            catch { }
            finally
            {
                HentaiVerseInfo.DawnOfDayRewardsAwarded -= _HentaiVerseInfo_DawnOfDayRewardsAwarded;
                d.Complete();
            }
        }
Пример #2
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            var d = taskInstance.GetDeferral();

            try
            {
                _Register(true);
                if (!Enabled)
                {
                    return;
                }
                if (ExClient.Client.Current.NeedLogOn)
                {
                    return;
                }
                HentaiVerseInfo.DawnOfDayRewardsAwarded += _HentaiVerseInfo_DawnOfDayRewardsAwarded;
                await HentaiVerseInfo.FetchAsync();
            }
            catch { }
            finally
            {
                HentaiVerseInfo.DawnOfDayRewardsAwarded -= _HentaiVerseInfo_DawnOfDayRewardsAwarded;
                d.Complete();
            }
        }