예제 #1
0
        private void FillImageList()
        {
            ListViewDelegates.ClearItems(lstWebResources);

            if (webResourcesImageCache == null || webResourcesImageCache.Count == 0)
            {
                webResourcesImageCache = new List <Entity>();

                QueryExpression qe = new QueryExpression("webresource");

                ConditionExpression ce = new ConditionExpression();
                ce.AttributeName = "webresourcetype";

                if (requestedType == (int)WebResourceType.Image)
                {
                    ce.Operator = ConditionOperator.In;
                    ce.Values.AddRange(5, 6, 7);
                }
                else
                {
                    ce.Operator = ConditionOperator.Equal;
                    ce.Values.Add(requestedType);
                }

                qe.Criteria.AddCondition(ce);
                qe.ColumnSet.AllColumns = true;

                EntityCollection ec = service.RetrieveMultiple(qe);

                foreach (Entity webresource in ec.Entities)
                {
                    webResourcesImageCache.Add(webresource);
                }
            }

            foreach (Entity webresource in webResourcesImageCache)
            {
                if (requestedType == 11 && webresource.GetAttributeValue <OptionSetValue>("webresourcetype").Value == 11 ||
                    requestedType != 11 &&
                    webresource.GetAttributeValue <OptionSetValue>("webresourcetype").Value != 11)
                {
                    ListViewItem item = new ListViewItem(webresource.Contains("displayname")
                        ? webresource["displayname"].ToString()
                        : "N/A");
                    item.SubItems.Add(webresource["name"].ToString());
                    item.Tag = webresource;

                    ListViewDelegates.AddItem(lstWebResources, item);
                }
            }

            ListViewDelegates.Sort(lstWebResources);
            ListViewDelegates.SetEnableState(lstWebResources, true);
            CommonDelegates.SetEnableState(btnWebResourcePickerCancel, true);
            CommonDelegates.SetEnableState(btnWebResourcePickerValidate, true);
            CommonDelegates.SetEnableState(btnNewResource, true);
            CommonDelegates.SetEnableState(btnRefresh, true);
        }
        private void TextBox1TextChanged(object sender, EventArgs e)
        {
            if (fillPrivThread != null)
            {
                fillPrivThread.Abort();
            }

            ListViewDelegates.ClearItems(lvPrivileges);
            ListViewDelegates.ClearGroups(lvPrivileges);

            fillPrivThread = new Thread(DoWork);
            fillPrivThread.Start();
        }
예제 #3
0
        /// <summary>
        /// Fills the entities listview
        /// </summary>
        public void FillEntitiesList()
        {
            try
            {
                ListViewDelegates.ClearItems(lvEntities);

                foreach (EntityMetadata emd in entitiesCache)
                {
                    var item = new ListViewItem {
                        Text = emd.DisplayName.UserLocalizedLabel.Label, Tag = emd.LogicalName
                    };
                    item.SubItems.Add(emd.LogicalName);
                    ListViewDelegates.AddItem(lvEntities, item);
                }
            }
            catch (Exception error)
            {
                string errorMessage = CrmExceptionHelper.GetErrorMessage(error, true);
                CommonDelegates.DisplayMessageBox(ParentForm, errorMessage, "Error", MessageBoxButtons.OK,
                                                  MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void FillList()
        {
            try
            {
                ListViewDelegates.ClearItems(lstSolutions);

                EntityCollection ec = RetrieveSolutions();

                foreach (Entity solution in ec.Entities)
                {
                    ListViewItem item = new ListViewItem(solution["friendlyname"].ToString());
                    item.SubItems.Add(solution["version"].ToString());
                    item.SubItems.Add(((EntityReference)solution["publisherid"]).Name);
                    item.Tag = solution;

                    ListViewDelegates.AddItem(lstSolutions, item);
                }
            }
            catch (Exception error)
            {
                CommonDelegates.DisplayMessageBox(this, error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }