private static string GetUriParameters(QueryResultSettings settings, params OperationParameter[] actionParameters) { List <string> sections = new List <string>(); if (settings != null) { string str = string.Format( "{0}={1}", "queryResultSettings", CommerceRuntimeContext.EscapeLongDataString(settings.SerializeToJsonObject())); sections.Add(str); } foreach (var parameter in actionParameters) { string str = string.Format( "{0}={1}", parameter.Name, CommerceRuntimeContext.EscapeLongDataString(parameter.Value.SerializeToJsonObject())); sections.Add(str); } return(string.Join("&", sections)); }
private void RefreshActivationStorageInformation() { this.comboRetailServerUrl.Items.Clear(); foreach (DeviceActivationInformation x in this.appStorage.ActivationInformation) { this.comboRetailServerUrl.Items.Add(x); } if (this.currentDeviceActivationInfo != null) { this.comboRetailServerUrl.SelectedItem = this.currentDeviceActivationInfo; this.txtNewRetailServerUrl.Text = this.currentDeviceActivationInfo.RetailServerUrl; } else if (this.appStorage.ActivationInformation.Length > 0) { this.comboRetailServerUrl.SelectedIndex = 0; } if (this.appStorage.ActivationInformation.Length == 0) { this.btnSelectActivated.Enabled = false; } this.listViewActivationDetails.Items.Clear(); string retailServerUrl = null; string deviceToken = null; if (this.currentDeviceActivationInfo != null) { foreach (string line in this.currentDeviceActivationInfo.ToString().Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { this.listViewActivationDetails.Items.Add(line); } retailServerUrl = this.currentDeviceActivationInfo.RetailServerUrl; deviceToken = this.currentDeviceActivationInfo.DeviceToken; } else { retailServerUrl = this.txtNewRetailServerUrl.Text; } IContext context = null; if (this.ShouldUseOnlineMode) { if (!string.IsNullOrEmpty(retailServerUrl)) { context = Helpers.CreateNewRetailServerContext(retailServerUrl); this.currentManagerFactory = ManagerFactory.Create(context); if (!string.IsNullOrEmpty(deviceToken)) { this.currentManagerFactory.Context.SetDeviceToken(deviceToken); } } } else { string offlineConnectionString = ConfigurationManager.ConnectionStrings["OfflineDatabase"].ConnectionString; ICommerceRuntimeSection commerceRuntimeSection = (ICommerceRuntimeSection)ConfigurationManager.GetSection("commerceRuntime"); var commerceRuntimeConfiguration = new CommerceRuntimeConfiguration( commerceRuntimeSection, offlineConnectionString, storageLookupConnectionStrings: null, isOverride: true, isMasterDatabaseConnectionString: false); CommerceAuthenticationRuntimeProvider authenticationProvider = new CommerceAuthenticationRuntimeProvider(); context = new CommerceRuntimeContext(_ => commerceRuntimeConfiguration, authenticationProvider); this.currentManagerFactory = ManagerFactory.Create(context); context.SetDeviceToken(deviceToken); } }