Example #1
0
        public async void LoadVideos()
        {
            var videos = await YouTubeDataCollection.LoadVideosAsync("WPF", "relevance", null, 50);

            var cv = new C1.WPF.DataCollection.C1CollectionView(new C1DataCollection <YouTubeVideo>(videos.Item2));

            //using (cv.DeferRefresh())
            //{
            //    cv.GroupDescriptions.Add(new System.Windows.Data.PropertyGroupDescription("ChannelTitle"));
            //    cv.GroupDescriptions.Add(new System.Windows.Data.PropertyGroupDescription("TitleIndex"));
            //}
            grid.ItemsSource = cv;
        }
        public async void LoadItems()
        {
            if (string.IsNullOrWhiteSpace(UrlDynamics) || string.IsNullOrWhiteSpace(AccessToken) || string.IsNullOrWhiteSpace(TokenEnpoint))
            {
                throw new InvalidOperationException("Please update the configuration constants");
            }

            string connstr = $@"Url={UrlDynamics};OAuth Access Token={AccessToken};Use Etag=true;OAuth Client Id={ClientID};OAuth Client Secret={CllentSecret};OAuth Refresh Token={RefreshToken};OAuth Token Endpoint={TokenEnpoint};Max Page Size = {MaxPageSize}";

            string[] fields          = new string[] { "accountid", "name", "emailaddress1" };
            var      d365SConnection = new C1D365SConnection(connstr);
            var      dataCollection  = new C1AdoNetCursorDataCollection(d365SConnection, "Accounts", fields, MaxPageSize);
            //Force collection to load once
            await dataCollection.RefreshAsync();

            C1.WPF.DataCollection.C1CollectionView cv = new C1.WPF.DataCollection.C1CollectionView(dataCollection);
            grid.ItemsSource = cv;
        }