Beispiel #1
0
 private async void GetItemTypeDef_OnClicked(object sender, EventArgs e)
 {
     IPlatformClient platformClient = _connection.CreatePlatformClient();
     await platformClient.GetHealthRecordItemTypeDefinitionAsync(new List <Guid> {
         BloodPressure.TypeId
     }, ThingTypeSections.All, new List <string>(), SystemClock.Instance.GetCurrentInstant());
 }
 public PushNotificationsService(
     IPlatformClient platformClient,
     ILoggerFactory loggerFactory)
 {
     _platformClient = platformClient;
     _logger         = loggerFactory.CreateLogger <NotificationInfo>();
 }
Beispiel #3
0
 public MedicalChangeStatusService(
     IPlatformClient platformClient,
     ILoggerFactory loggerFactory,
     IConnectivityService connectivityService,
     IMedicalChangeStatusServiceErrorHandler serviceErrorHandler)
 {
     _platformClient      = platformClient;
     _connectivityService = connectivityService;
     _serviceErrorHandler = serviceErrorHandler;
     _logger = loggerFactory.CreateLogger <MedicalChangeStatusService>();
 }
Beispiel #4
0
 public MedicalAuthenticationService(
     IPlatformClient client,
     IAccountContainer accountContainer,
     ILoggerFactory loggerFactory,
     IConnectivityService connectivityService,
     IMedicalAuthenticationServiceErrorHandler serviceErrorHandler)
 {
     _client              = client;
     _accountContainer    = accountContainer;
     _connectivityService = connectivityService;
     _serviceErrorHandler = serviceErrorHandler;
     _logger              = loggerFactory.CreateLogger <MedicalAuthenticationService>();
 }
Beispiel #5
0
 public RecommendationsService(
     IPlatformClient platformClient,
     IRecommendationsContainer recommendationsContainer,
     IErrorResponseHandler serviceErrorHandler,
     IConnectivityService connectivityService,
     ILoggerFactory loggerFactory)
 {
     _platformClient           = platformClient;
     _recommendationsContainer = recommendationsContainer;
     _serviceErrorHandler      = serviceErrorHandler;
     _connectivityService      = connectivityService;
     _logger = loggerFactory.CreateLogger <RecommendationsService>();
 }
 /// <summary>
 /// 发送命令
 /// </summary>
 /// <param name="cmd"></param>
 /// <param name="client"></param>
 public void SendToService(CtrlPlatformCommandInfo cmd, IPlatformClient client)
 {
     try
     {
         PlatformServiceClient psc = new PlatformServiceClient();
         psc.DoActionCompleted += client_DoActionCompleted;
         psc.DoActionAsync(CommandHelper.ToPlatfromCommandInfo(cmd), client);
     }
     catch (Exception ee)
     {
         PrintfLog(ee);
     }
     //  PrintfLog(cmd, "发送命令信息");
 }
        private async Task <ServiceInfo> GetFromServiceAsync()
        {
            IWebHealthVaultConnection webHealthVaultConnection = Ioc.Container.Locate <IWebHealthVaultConnection>(
                extraData: new
            {
                serviceLocator = _serviceLocator
            });

            IPlatformClient platformClient = webHealthVaultConnection.CreatePlatformClient();

            ServiceInfo serviceInfo = await platformClient.GetServiceDefinitionAsync(ServiceInfoSections.Topology).ConfigureAwait(false);

            return(serviceInfo);
        }
 public Task<Tuple<CircleData[], ProfileData[]>> GetCircleDatasAsync(IPlatformClient client)
 {
     var profiles = Enumerable.Range(0, 3)
         .Select(idx => GenerateProfileData(idx, ProfileUpdateApiFlag.LookupCircle, "GetCircleDatasAsync"))
         .ToArray();
     var circles = StubGenerator.GenerateData<CircleData[]>("GetCircleDatasAsync",
         new object[]{
             new{GenerateData_Id = 0, Id = StubGenerator.GenerateSetter("anyone"), Name = StubGenerator.GenerateSetter("全員"), Members = StubGenerator.GenerateSetter(new[]{profiles[0],profiles[1],profiles[2]})},
             new{GenerateData_Id = 1, Members = StubGenerator.GenerateSetter(new[]{profiles[0],profiles[1]})},
             new{GenerateData_Id = 2, Members = StubGenerator.GenerateSetter(new[]{profiles[1],profiles[2]})},
             new{GenerateData_Id = 3, Members = StubGenerator.GenerateSetter(new ProfileData[]{ })},
             new{GenerateData_Id = 4, Id = StubGenerator.GenerateSetter("15"), Name = StubGenerator.GenerateSetter("ブロック中"), Members = StubGenerator.GenerateSetter(new ProfileData[]{ GenerateProfileData(3, ProfileUpdateApiFlag.LookupCircle, "GetCircleDatasAsync") })},
         });
     return Task.FromResult(Tuple.Create(circles, profiles));
 }
 public SignInService(
     IPlatformClient platformClient,
     ILoggerFactory loggerFactory,
     IAuthenticationServiceErrorHandler serviceErrorHandler,
     IConnectivityService connectivityService,
     ISecretsProvider secretsProvider,
     IAuthenticationInfoService authenticationInfoService)
 {
     _platformClient            = platformClient;
     _serviceErrorHandler       = serviceErrorHandler;
     _connectivityService       = connectivityService;
     _secretsProvider           = secretsProvider;
     _authenticationInfoService = authenticationInfoService;
     _logger = loggerFactory.CreateLogger <SignInService>();
 }
Beispiel #10
0
 public MetadataService(
     IMetadataContainer metadataContainer,
     IUserProfileContainer userProfileContainer,
     IPlatformClient platformClient,
     IErrorResponseHandler serviceErrorHandler,
     IConnectivityService connectivityService,
     ILoggerFactory loggerFactory)
 {
     _metadataContainer    = metadataContainer;
     _userProfileContainer = userProfileContainer;
     _platformClient       = platformClient;
     _serviceErrorHandler  = serviceErrorHandler;
     _connectivityService  = connectivityService;
     _logger = loggerFactory.CreateLogger <UserService>();
 }
 public UserStatusChangeService(
     IPlatformClient platformClient,
     ILoggerFactory loggerFactory,
     IConnectivityService connectivityService,
     IMeetingsService meetingsService,
     IUserStatusChangeServiceErrorHandler serviceErrorHandler,
     IUserProfileContainer userProfileContainer,
     IMetadataContainer metadataContainer)
 {
     _platformClient = platformClient;
     _connectivityService = connectivityService;
     _meetingsService = meetingsService;
     _logger = loggerFactory.CreateLogger<UserStatusChangeService>();
     _serviceErrorHandler = serviceErrorHandler;
     _userProfileContainer = userProfileContainer;
     _metadataContainer = metadataContainer;
 }
        private async Task ProvisionForSodaAuthAsync()
        {
            // Set a temporary service instance for the NewApplicationCreationInfo and GetServiceDefinition calls.
            var defaultHealthVaultUrl      = Configuration.DefaultHealthVaultUrl;
            var defaultHealthVaultShellUrl = Configuration.DefaultHealthVaultShellUrl;
            var masterApplicationId        = Configuration.MasterApplicationId;

            ServiceInstance = new HealthServiceInstance(
                "1",
                "Default",
                "Default HealthVault instance",
                UrlUtilities.GetFullPlatformUrl(defaultHealthVaultUrl),
                defaultHealthVaultShellUrl);

            // Note: This apparent circular call is intentional. This method is called from AuthenticateAsync.
            // PlatformClient is calling HealthVaultConnectionBase.ExecuteAsync("NewApplicationCreationInfo"),
            // which avoids calling AuthenticateAsync because "NewApplicationCreationInfo" is an anonymous method.
            IPlatformClient         platformClient             = CreatePlatformClient();
            ApplicationCreationInfo newApplicationCreationInfo = await platformClient.NewApplicationCreationInfoAsync().ConfigureAwait(false);

            string environmentInstanceId = await _shellAuthService.ProvisionApplicationAsync(
                defaultHealthVaultShellUrl,
                masterApplicationId,
                newApplicationCreationInfo.AppCreationToken,
                newApplicationCreationInfo.AppInstanceId.ToString()).ConfigureAwait(false);

            ServiceInfo serviceInfo = await platformClient.GetServiceDefinitionAsync(ServiceInfoSections.Topology).ConfigureAwait(false);

            HealthServiceInstance bouncedHealthServiceInstance;

            if (!serviceInfo.ServiceInstances.TryGetValue(environmentInstanceId, out bouncedHealthServiceInstance))
            {
                // TODO: Come up with better error for  Current HealthServiceException is restrictive.
                throw new HealthServiceException(HealthServiceStatusCode.Failed);
            }

            // We've successfully made it through the flow. Save all the information.
            await _localObjectStore.WriteAsync(ServiceInstanceKey, bouncedHealthServiceInstance).ConfigureAwait(false);

            ServiceInstance = bouncedHealthServiceInstance;

            await _localObjectStore.WriteAsync(ApplicationCreationInfoKey, newApplicationCreationInfo).ConfigureAwait(false);

            ApplicationCreationInfo = newApplicationCreationInfo;
        }
Beispiel #13
0
        protected RavenClient(Dsn dsn, bool captureUnhandled = true)
        {
            Dsn = dsn;

#if NETFX_CORE
            _storage = new RavenStorageClient();
            _platform = new WindowsPlatformClient();
#endif

            _httpClient = BuildHttpClient();

            if (captureUnhandled)
            {
#if NETFX_CORE
                Application.Current.UnhandledException += Application_UnhandledException;
#endif
            }
        }
Beispiel #14
0
        protected RavenClient(Dsn dsn, bool captureUnhandled = true)
        {
            Dsn = dsn;

#if NETFX_CORE
            _storage  = new RavenStorageClient();
            _platform = new WindowsPlatformClient();
#endif

            _httpClient = BuildHttpClient();

            if (captureUnhandled)
            {
#if NETFX_CORE
                Application.Current.UnhandledException += Application_UnhandledException;
#endif
            }
        }
        /// <summary>
        /// We will mock webhealthvaultconnection and substitute CreatePlatformClient call
        /// on the mock to return a mock platform client. Platform client will substitute
        /// call to platform "getservicedefintion" by returning a dummy serviceinstance with
        /// id set to "US instance".
        /// </summary>
        private async Task <HealthServiceInstance> GetHealthServiceInstanceAsync()
        {
            _webHealthVaultConnection = Substitute.For <IWebHealthVaultConnection>();
            Ioc.Container.Configure(c => { c.ExportInstance(_webHealthVaultConnection).As <IWebHealthVaultConnection>(); });

            IPlatformClient platformClient = Substitute.For <IPlatformClient>();

            _webHealthVaultConnection.CreatePlatformClient().Returns(platformClient);

            ServiceInfo serviceInfo = Substitute.For <ServiceInfo>();

            serviceInfo.ServiceInstances.Add(UsInstanceId, new HealthServiceInstance {
                Id = UsInstanceId
            });

            platformClient
            .GetServiceDefinitionAsync(ServiceInfoSections.Topology)
            .Returns(serviceInfo);

            HealthServiceInstance serviceInstance = await _serviceInstanceProvider.GetHealthServiceInstanceAsync("1");

            return(serviceInstance);
        }
 public Task<ProfileData[]> GetIgnoredProfilesAsync(IPlatformClient client)
 {
     return Task.FromResult(Enumerable.Range(4, 3).Select(
         id => GenerateProfileData(id, ProfileUpdateApiFlag.Base, "GetIgnoredProfilesAsync")).ToArray());
 }
 public Task<ProfileData[]> GetProfileOfPusherAsync(string plusOneId, int pushCount, IPlatformClient client)
 {
     throw new NotImplementedException();
 }
 public Task<ProfileData[]> GetFollowedProfilesAsync(string profileId, int count, IPlatformClient client)
 {
     var pid = int.Parse(profileId.Substring(2));
     return Task.FromResult(Enumerable.Range(pid + 1, 3).Select(
         id => GenerateProfileData(id, ProfileUpdateApiFlag.Base, "GetFollowedProfilesAsync")).ToArray());
 }
 public Task UpdateNotificationCheckDateAsync(DateTime value, IPlatformClient client) { return Task.Factory.StartNew(() => { }); }
Beispiel #20
0
        /// <summary>
        /// 发送命令【方法是:public void Process+方法名称,参数里自己定义名称】
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="client"></param>
        public void SendToService(CtrlPlatformCommandInfo cmd, IPlatformClient client)
        {
            ClientCommand cc = new ClientCommand();

            cc.SendToService(cmd, client);
        }
        public static StyleElement ParseHtml(string contentHtml, IPlatformClient client)
        {
            if (string.IsNullOrEmpty(contentHtml))
                return null;

            //"<"はhtml上では&lt;と書くため、これの出現は確実にタグの開始となる。よって、
            //内容を読み取ることができる。以下のwhile文はhtmlをリンク、メンション、テキスト
            //に分割する処理を記述している
            int nextReadIdx = 0, idx, startIdx, endIdx, tmpInt;
            string tmpStr;
            var currentEleStack = new Stack<char>();
            var blocks = new Stack<List<ContentElement>>();
            blocks.Push(new List<ContentElement>());
            while ((idx = contentHtml.IndexOf('<', nextReadIdx)) >= 0)
            {
                //タグが開始される前に出現したテキストをblocksに入れる
                tmpStr = contentHtml.Substring(nextReadIdx, idx - nextReadIdx);
                if (tmpStr.Length > 0)
                    blocks.Peek().Add(new TextElement(Primitive.ApiAccessorUtility.DecodeHtmlText(tmpStr)));

                //メンション、リンク用
                if (contentHtml[idx + 1] == 'a' || contentHtml.IndexOf("span", idx + 1) == idx + 1)
                {
                    //開始されたタグがspanタグである場合は12/03/08時点ではメンション
                    //用の要素である
                    var isMension = contentHtml[idx + 1] == 's';

                    //IndexOf("<a href=\"", idx)のidx引数の部分は効率を考えた場合はidx + 1
                    //するとメンションの読み取りはより良い。しかしリンクの場合には現状の検索
                    //文字ではidxの添字に存在する"<"が存在しないと"<a"を検出出来ない。現状で
                    //は"<a href"の"<"を省かず、検索開始位置をidx + 1にしない事で動かしてる
                    var innerCloseEleIdx = contentHtml.IndexOf("</span>", idx + 5);
                    var outerCloseEleIdx = isMension ? contentHtml.IndexOf("</span>", innerCloseEleIdx + 7) : contentHtml.IndexOf("</a>", idx);
                    startIdx = Math.Min(
                        (tmpInt = contentHtml.IndexOf("href=\"", idx, outerCloseEleIdx - idx)) < 0 ? int.MaxValue : tmpInt,
                        (tmpInt = contentHtml.IndexOf("href='", idx, outerCloseEleIdx - idx)) < 0 ? int.MaxValue : tmpInt) + 6;
                    string mensionTargetProfileUrl = null, mensionTargetName = null;
                    if (startIdx >= 0)
                    {
                        endIdx = Math.Min(
                            (tmpInt = contentHtml.IndexOf("\"", startIdx, outerCloseEleIdx - startIdx)) < 0 ? int.MaxValue : tmpInt,
                            (tmpInt = contentHtml.IndexOf("'", startIdx, outerCloseEleIdx - startIdx)) < 0 ? int.MaxValue : tmpInt);
                        mensionTargetProfileUrl = contentHtml.Substring(startIdx, endIdx - startIdx);
                        idx = endIdx + 1;
                    }
                    else
                        idx = innerCloseEleIdx;

                    startIdx = contentHtml.IndexOf(">", idx) + 1;
                    endIdx = contentHtml.IndexOf("</", startIdx);
                    mensionTargetName = Primitive.ApiAccessorUtility.DecodeHtmlText(
                        contentHtml.Substring(startIdx, endIdx - startIdx));

                    //最端の閉じタグの最後の">"部分の直後の番地を次の文字処理位置とする
                    //たまに閉じタグが探し出せない(IndexOfのバグ?)事があり、無限ループする。これをMath.Maxで対策
                    nextReadIdx = Math.Max(nextReadIdx + 1, contentHtml.IndexOf('>', outerCloseEleIdx) + 1);

                    if (isMension)
                    {
                        if (mensionTargetProfileUrl != null)
                            blocks.Peek().Add(new MensionElement(new ProfileData(
                                mensionTargetProfileUrl.Substring(mensionTargetProfileUrl.LastIndexOf('/') + 1),
                                mensionTargetName, loadedApiTypes: ProfileUpdateApiFlag.Base)));
                        else
                            blocks.Peek().Add(new TextElement("+" + mensionTargetName));
                    }
                    else
                    {
                        Uri tmpUrl;
                        if (!Uri.TryCreate(client.PlusBaseUrl, mensionTargetProfileUrl, out tmpUrl)
                            && !Uri.TryCreate("about:blank", UriKind.Absolute, out tmpUrl)) { }
                        blocks.Peek().Add(new HyperlinkElement(tmpUrl, mensionTargetName));
                    }
                }
                else if (contentHtml.IndexOf("br", idx + 1) == idx + 1)
                {
                    blocks.Peek().Add(new BreakElement());
                    //たまに閉じタグが探し出せない(IndexOfのバグ?)事があり、無限ループする。これをMath.Maxで対策
                    nextReadIdx = Math.Max(nextReadIdx + 1, contentHtml.IndexOf(">", idx + 3) + 1);
                }
                //文字装飾タグ用
                else
                    switch (contentHtml[idx + 1])
                    {
                        case '/':
                            var currentEleChildren = blocks.Pop().ToArray();
                            switch (currentEleStack.Pop())
                            {
                                case 'b':
                                    blocks.Peek().Add(new StyleElement(StyleType.Bold, currentEleChildren));
                                    break;
                                case 'i':
                                    blocks.Peek().Add(new StyleElement(StyleType.Italic, currentEleChildren));
                                    break;
                                case 's':
                                case 'd':
                                    blocks.Peek().Add(new StyleElement(StyleType.Middle, currentEleChildren));
                                    break;
                                default:
                                    blocks.Peek().Add(new StyleElement(StyleType.Unknown, currentEleChildren));
                                    break;
                            }
                            nextReadIdx = Math.Max(nextReadIdx + 1, contentHtml.IndexOf('>', idx + 2) + 1);
                            break;
                        default:
                            startIdx = contentHtml.IndexOf('>', idx + 1) + 1;
                            var closeEleIdx = contentHtml.IndexOf("</", startIdx);
                            var otherStartEleIdx = contentHtml.IndexOf("<", startIdx);
                            if (closeEleIdx == otherStartEleIdx)
                            {
                                var elements = new[] { new TextElement(
                                    Primitive.ApiAccessorUtility.DecodeHtmlText(
                                    contentHtml.Substring(startIdx, closeEleIdx - startIdx))) };
                                switch (contentHtml[idx + 1])
                                {
                                    case 'b':
                                        blocks.Peek().Add(new StyleElement(StyleType.Bold, elements));
                                        break;
                                    case 'i':
                                        blocks.Peek().Add(new StyleElement(StyleType.Italic, elements));
                                        break;
                                    case 's':
                                    case 'd':
                                        blocks.Peek().Add(new StyleElement(StyleType.Middle, elements));
                                        break;
                                    default:
                                        blocks.Peek().Add(new StyleElement(StyleType.Unknown, elements));
                                        break;
                                }
                                nextReadIdx = contentHtml.IndexOf('>', closeEleIdx + 1) + 1;
                            }
                            else
                            {
                                var elements = new List<ContentElement>();
                                tmpStr = Primitive.ApiAccessorUtility.DecodeHtmlText(
                                    contentHtml.Substring(startIdx, otherStartEleIdx - startIdx));
                                if (tmpStr.Length > 0)
                                    elements.Add(new TextElement(tmpStr));
                                blocks.Push(elements);

                                currentEleStack.Push(contentHtml[idx + 1]);
                                nextReadIdx = otherStartEleIdx;
                            }
                            break;
                    }
            }
            //タグが無くなったら残りの文字列をblocksに入れる
            tmpStr = contentHtml.Substring(nextReadIdx, contentHtml.Length - nextReadIdx);
            if (tmpStr.Length > 0)
                blocks.Peek().Add(new TextElement(Primitive.ApiAccessorUtility.DecodeHtmlText(tmpStr)));

            //ルート要素は書式設定無しのスタイル要素にする。しかし、配列に要素が
            //一つしか入っておらず、要素がスタイル要素だった場合には新しく生成せ
            //ずにそのスタイル要素を戻り値とする
            if (blocks.Peek().Count == 1 && blocks.Peek().First() is StyleElement)
                return (StyleElement)blocks.Peek().First();
            else
                return new StyleElement(StyleType.None, blocks.Pop().ToArray());
        }
 public Task<int> GetUnreadNotificationCountAsync(IPlatformClient client)
 { return Task.FromResult(0); }
 public Task<bool> LoginAsync(string email, string password, IPlatformClient client)
 { return Task.Delay(3000).ContinueWith(tsk => true); }
 public Task MutateBlockUser(Tuple<string, string>[] userIdAndNames, AccountBlockType blockType, BlockActionType status, IPlatformClient client)
 { return Task.Delay(0); }
 public Task<ImageData> GetImageAsync(string imageId, string profileId, IPlatformClient client)
 {
     throw new NotImplementedException();
 }
Beispiel #26
0
        public async Task DoesUploadAddCorrectSubstitutionRecord()
        {
            var request = new UploadSubstitutionsCommand
            {
                IpAddress         = MockData.CorrectIpAddress,
                Key               = MockData.CorrectUploadKey,
                SubstitutionsDate = MockData.CorrectDate,
                UploadDateTime    = MockData.CorrectDate,
                Substitutions     = new[]
                {
                    new SubstitutionDto
                    {
                        Absent       = "MockedAbsent1", Lesson = 1, Subject = "MockedSubject1",
                        ClassesNames = new[] { "1b", "2a" }, Groups = "group1,group2", Note = "MockedNote",
                        Cancelled    = true, Room = "MockedRoom"
                    },
                    new SubstitutionDto
                    {
                        Absent = "MockedAbsent2", Lesson = 2, Subject = "MockedSubject2", ClassesNames = new[] { "1b" },
                        Groups = "n/a", Note = "MockedNote2", Substituting = "MockedSubstituting", Room = "MockedRoom"
                    }
                }
            };

            var context       = new FakeDbContext();
            var clients       = new IPlatformClient[0];
            var hangfire      = new Mock <IBackgroundJobClient>();
            var classesParser = new Mock <IClassesParser>();

            classesParser
            .Setup(x => x.Parse(new[] { "1b" }))
            .Returns(new[] { new Class(1, "b") });
            classesParser
            .Setup(x => x.Parse(new[] { "1b", "2a" }))
            .Returns(new[] { new Class(1, "b"), new Class(2, "a") });

            var handler = new UploadSubstitutionsCommandHandler(context, clients, hangfire.Object, classesParser.Object);
            await handler.Handle(request, CancellationToken.None);

            var expected = new SubstitutionsRecord {
                UploadDateTime    = MockData.CorrectDate,
                SubstitutionsDate = MockData.CorrectDate,
                Substitutions     = new[]
                {
                    new Substitution
                    {
                        Teacher = "MockedAbsent1", Lesson = 1, Subject = "MockedSubject1", Groups = "group1,group2",
                        Note    = "MockedNote", Cancelled = true, Room = "MockedRoom",
                        Classes = new[]
                        {
                            await context.Classes.FirstOrDefaultAsync(x => x.Year == 1 && x.Section == "b"),
                            await context.Classes.FirstOrDefaultAsync(x => x.Year == 2 && x.Section == "a")
                        }
                    },
                    new Substitution
                    {
                        Teacher = "MockedAbsent2", Lesson = 2, Subject = "MockedSubject2", Groups = "n/a",
                        Note    = "MockedNote2", Substituting = "MockedSubstituting", Room = "MockedRoom",
                        Classes = new[]
                        {
                            await context.Classes.FirstOrDefaultAsync(x => x.Year == 1 && x.Section == "b")
                        }
                    }
                }
            };

            var actual = await context.SubstitutionsRecords.FirstOrDefaultAsync();

            actual.Should().BeEquivalentTo(expected);
        }
 public Task<CommentData> EditComment(string activityId, string commentId, string content, IPlatformClient client)
 { return Task.Delay(500).ContinueWith(tsk => GenerateCommentData(0, activityId, "EditComment")); }
 public Task<ActivityData> PostActivity(string content, Dictionary<string, string> targetCircles, Dictionary<string, string> targetUsers, bool isDisabledComment, bool isDisabledReshare, IPlatformClient client)
 { return Task.Delay(500).ContinueWith(tsk => GenerateActivityData(0, ActivityUpdateApiFlag.GetActivity, new int[0], "PostComment")); }
 public Task<ActivityData> GetActivityAsync(string activityId, IPlatformClient client)
 {
     return Task.FromResult(GenerateActivityData(
         int.Parse(activityId.Substring(2)), ActivityUpdateApiFlag.GetActivity,
         Enumerable.Range(0, 3).ToArray(), "GetActivityAsync"));
 }
 public Task<Tuple<ActivityData[], string>> GetActivitiesAsync(string circleId, string profileId, string ctValue, int length, IPlatformClient client)
 {
     var continueToken = int.Parse(ctValue ?? "0");
     return Task.FromResult(Tuple.Create(Enumerable.Range(continueToken, length)
         .Select(id => GenerateActivityData(id, ActivityUpdateApiFlag.GetActivities, Enumerable.Range(0, 3).ToArray(), "GetActivitiesAsync"))
         .ToArray(), (continueToken + length).ToString()));
 }
 public Task<InitData> GetInitDataAsync(IPlatformClient client)
 { return Task.FromResult(StubGenerator.GenerateData<InitData>("GetInitDataAsync", 0)); }
 public Task<Tuple<NotificationData[], DateTime, string>> GetNotificationsAsync(bool isFetchNewItemMode, int length, string continueToken, IPlatformClient client)
 {
     throw new NotImplementedException();
     //return Task.FromResult(Tuple.Create(
     //    new[] {
     //        new ContentNotificationData(
     //            GenerateActivityData(1, ActivityUpdateApiFlag.Notification, Enumerable.Range(1,3).ToArray(), "notify"),
     //            NotificationsFilter.OtherPost, new[] {
     //                new ChainingNotificationData("01", GenerateProfileData(2, ProfileUpdateApiFlag.Base, "notify"), DateTime.UtcNow),
     //                new ChainingNotificationData("02", GenerateProfileData(2, ProfileUpdateApiFlag.Base, "notify"), DateTime.UtcNow)
     //            }),
     //        new NotificationData(
     //            NotificationsFilter.OtherPost, new[] {
     //                new ChainingNotificationData("03", GenerateProfileData(2, ProfileUpdateApiFlag.Base, "notify"), DateTime.UtcNow),
     //                new ChainingNotificationData("04", GenerateProfileData(2, ProfileUpdateApiFlag.Base, "notify"), DateTime.UtcNow)
     //            }),
     //        new NotificationDataWithActivity(
     //            GenerateActivityData(1, ActivityUpdateApiFlag.Notification, Enumerable.Range(1,3).ToArray(), "notify"),
     //            NotificationsFilter.OtherPost, new[] {
     //                new ChainingNotificationData("05", GenerateProfileData(2, ProfileUpdateApiFlag.Base, "notify"), DateTime.UtcNow),
     //                new ChainingNotificationData("06", GenerateProfileData(2, ProfileUpdateApiFlag.Base, "notify"), DateTime.UtcNow)
     //            })
     //    }, DateTime.UtcNow, "continueToken_notify"));
 }
 public Task<AlbumData[]> GetAlbumsAsync(string profileId, IPlatformClient client)
 {
     throw new NotImplementedException();
 }
 public Task<ProfileData> GetProfileFullAsync(string profileId, IPlatformClient client)
 { return Task.FromResult(GenerateProfileData(int.Parse(profileId.Substring(2)), ProfileUpdateApiFlag.ProfileGet, "GetProfileFullAsync")); } 
 public Task<ProfileData> GetProfileAboutMeAsync(IPlatformClient client)
 { return Task.FromResult(GenerateProfileData(0, ProfileUpdateApiFlag.ProfileGet, "GetProfileAboutMeAsync")); }
 public Task DeleteComment(string commentId, IPlatformClient client)
 { return Task.Delay(500); }
 public IObservable<object> GetStreamAttacher(IPlatformClient client)
 {
     return Observable.Return(GenerateActivityData(1, ActivityUpdateApiFlag.Unloaded, new int[] { }, "getStreamAttacher"));
 }
 public Task MarkAsReadAsync(NotificationData target, IPlatformClient client)
 { return Task.Delay(100); }
Beispiel #39
0
 public TokenRefreshInvoker(IPlatformClient platformClient)
 {
     _platformClient = platformClient;
 }