web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / testblog / code editor testing

code editor testing

S_CM Profile Picture S_CM 15

Below is the content of the files mentioned above (please remove those numbers inside the code - they, by some reason, were put there by the code editor used to prepare this post).

MainWindow.xaml.cs:


using Microsoft.Dynamics.Commerce.RetailProxy; using System; using System.Configuration; using System.Windows; public partial class MainWindow : Window { readonly ManagerFactory managerFactory; public MainWindow() { // Creating an instance of RetailServerContext by supplying Retail Service URL And Operating Unit Number. RetailServerContext context = RetailServerContext.Create( new Uri(ConfigurationManager.AppSettings["RetailServerRoot"]), ConfigurationManager.AppSettings["OperatingUnitNumber"]); // Creating a factory based on RetailServerContext. managerFactory = ManagerFactory.Create(context); InitializeComponent(); } protected override async void OnInitialized(EventArgs e) { base.OnInitialized(e); // Getting a channelID. IOrgUnitManager orgUnitManager = managerFactory.GetManager<IOrgUnitManager>(); ChannelConfiguration channelConfiguration = await orgUnitManager.GetOrgUnitConfiguration(); // Loading categories. ICategoryManager categoryManager = managerFactory.GetManager<ICategoryManager>(); PagedResult<Category> categories = await categoryManager.GetCategories(channelConfiguration.RecordId, new QueryResultSettings { Paging = new PagingInfo { Skip = 0, Top = 100 } }); // Binding categories to UI element to be displayed there. listView.ItemsSource = categories; } }

Comments

*This post is locked for comments