/// <summary> /// Main loading event for the User Control /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AlternateKeyManagerControl_Load(object sender, EventArgs e) { // initialize the user control with the connection and parent reference EntitiesListControl.Initialize(this, Service); EntityDropDown.Initialize(this, Service); // udpate some UI elements on load UpdateKeysToolbar(); ToggleNewKeyPane(false); ToggleNewKeyPaneEnabled(false); }
/// <summary> /// This event occurs when the connection has been updated in XrmToolBox /// </summary> public override void UpdateConnection(IOrganizationService newService, ConnectionDetail detail, string actionName, object parameter) { base.UpdateConnection(newService, detail, actionName, parameter); // update the connection and clear out the related data EntitiesListControl.UpdateConnection(Service); EntityDropDown.UpdateConnection(Service); ClearSelectedEntitiesList(); if (_mySettings != null && detail != null) { _mySettings.LastUsedOrganizationWebappUrl = detail.WebApplicationUrl; LogInfo("Connection has changed to: {0}", detail.WebApplicationUrl); } }
/// <summary> /// Populate the Alternate Key details pane /// </summary> private void PopulateNewKeyControls() { ToggleNewKeyPaneEnabled(false); ToggleMainUIControlsEnabled(false); // load the entities into the drop down control EntityDropDown.LoadData(); WorkAsync(new WorkAsyncInfo { Message = "Retrieving Publishers", AsyncArgument = null, IsCancelable = true, MessageWidth = 340, MessageHeight = 150, Work = (w, e) => { var entLogicalName = e.Argument as string; w.ReportProgress(0, $"Retrieving Publishers"); var results = CrmActions.RetrievePublishers(Service); w.ReportProgress(100, $"Retrieving Publishers complete!"); e.Result = results; }, ProgressChanged = e => { SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(e.ProgressPercentage, e.UserState.ToString())); }, PostWorkCallBack = e => { var pubs = e.Result as List <Entity>; comboBoxPrefixes.Items.Clear(); // load the publishers foreach (var pub in pubs) { comboBoxPrefixes.Items.Add(pub.Attributes["customizationprefix"]); } } }); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context?.Instance == null || !(context.PropertyDescriptor.GetValue(context.Instance) is IEntityReference eref)) { return(value); } var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); var dropDown = new EntityDropDown { Objects = eref.Entities, SelectedObject = eref.Entity }; dropDown.SelectObject += delegate { editorService.CloseDropDown(); }; editorService.DropDownControl(dropDown); if (dropDown.SelectedObject is IEntity entity) { return(eref.WithIndex(entity.Index)); } return(value); }