Пример #1
0
        public MainPage()
        {
            this.InitializeComponent();

            var oDataConnection = new C1ODataConnection($@"Url={ODataServerUrl};Max Page Size=50");
            var dataCollection  = new C1AdoNetCursorDataCollection <Invoice>(oDataConnection, "Invoices");

            listView.ItemsSource = new C1CollectionView(dataCollection);
        }
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var oDataConnection = new C1ODataConnection($@"Url={NorthwindSampleUrl}");
            var tableViewSource = new InvoicesSource(TableView);
            var dataCollection  = new C1AdoNetCursorDataCollection <Invoice>(oDataConnection, "Invoices", new string[] { "ProductName", "Address", "City", "Country" });

            TableView.Source = tableViewSource;
            RefreshControl   = new UIRefreshControl();
            tableViewSource.RefreshControl = RefreshControl;
            tableViewSource.ItemsSource    = dataCollection;
        }
        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;
        }