当前位置: 首页>>代码示例>>C#>>正文


C# List.Join方法代码示例

本文整理汇总了C#中System.Windows.Documents.List.Join方法的典型用法代码示例。如果您正苦于以下问题:C# List.Join方法的具体用法?C# List.Join怎么用?C# List.Join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Documents.List的用法示例。


在下文中一共展示了List.Join方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetGestures

        public static List<Gesture> GetGestures(List<UIElement> uiElements)
        {
            var list = uiElements.Join(eventRequests, u => u, e => e.UIElement, (u, e) => e.Gesture).ToList<Gesture>();

            return list;
        }
开发者ID:tuliosouza,项目名称:ASG,代码行数:6,代码来源:EventRequestDirectory.cs

示例2: EditBiotaPermissions

        internal void EditBiotaPermissions(TaxonViewModel taxon)
        {
            if (!taxon.TaxaID.HasValue || taxon.TaxaID.Value < 0) {
                ErrorMessage.Show("You must save apply changes before you can proceed.");
                return;
            }

            bool readOnly = !User.HasBiotaPermission(taxon.TaxaID.Value, PERMISSION_MASK.OWNER);

            if (!readOnly) {
                PluginManager.Instance.AddNonDockableContent(Owner, new BiotaPermissions(User, taxon, readOnly), "Taxon Permissions for '" + taxon.TaxaFullName + (readOnly ? "' (Read Only)" : "'"), SizeToContent.Manual);
            } else {
                // Display a readonly version of the permissions...
                var permStr = "";
                string strOwners = "";
                using (new OverrideCursor(Cursors.Wait)) {
                    var service = new SupportService(User);
                    var perms = service.GetBiotaPermissions(User.Username, taxon.TaxaID.Value);
                    var owners = service.getBiotaOwners(taxon.TaxaID.Value);

                    if ((perms.PermMask1 & (int) PERMISSION_MASK.OWNER) != 0) {
                        permStr= "Owner";
                    } else if ((perms.PermMask1 & (int) PERMISSION_MASK.WRITE) != 0) {
                        var rights = new List<String>();
                        if ((perms.PermMask1 & (int) PERMISSION_MASK.INSERT) != 0) {
                            rights.Add("Insert");
                        }
                        if ((perms.PermMask1 & (int) PERMISSION_MASK.UPDATE) != 0) {
                            rights.Add("Update");
                        }
                        if ((perms.PermMask1 & (int) PERMISSION_MASK.DELETE) != 0) {
                            rights.Add("Delete");
                        }
                        permStr = rights.Join(", ");
                    } else {
                        permStr = "Read Only";
                    }

                    var ownerNames = new List<string>();
                    foreach (BiotaOwner owner in owners) {
                        if (!string.IsNullOrWhiteSpace(owner.Name)) {
                            ownerNames.Add(string.Format("{0} ({1})", owner.Name, owner.FullName));
                        }
                    }

                    strOwners = ownerNames.Join(", ");
                    if (string.IsNullOrWhiteSpace(strOwners)) {
                        strOwners = "sa (System Administrator)";
                    }
                }

                InfoBox.Show(string.Format("Permissions: {0}\n\nOwners: {1}", permStr, strOwners), "Permissions for " + taxon.TaxaFullName, this);
            }
        }
开发者ID:kehh,项目名称:biolink,代码行数:54,代码来源:TaxonExplorer.xaml.cs

示例3: DoImport

        private void DoImport()
        {
            if (String.IsNullOrEmpty(txtFilename.Text)) {
                ErrorMessage.Show("You must select a file before proceeding!");
                return;
            }

            int rowCount = 0;

            var service = new SupportService(User);

            using (var parser = new GenericParserAdapter(txtFilename.Text)) {
                parser.ColumnDelimiter = ',';
                parser.FirstRowHasHeader = chkFirstRowHeaders.IsChecked.GetValueOrDefault(false);
                parser.TextQualifier = '\"';
                parser.FirstRowSetsExpectedColumnCount = true;

                var columnNames = new List<String>();
                var values = new List<string>();
                while (parser.Read()) {
                    if (rowCount == 0) {
                        for (int i = 0; i < parser.ColumnCount; ++i) {
                            if (parser.FirstRowHasHeader) {
                                columnNames.Add(parser.GetColumnName(i));
                            } else {
                                columnNames.Add("Column" + i);
                            }
                        }
                    }
                    values.Clear();
                    for (int i = 0; i < parser.ColumnCount; ++i) {
                        values.Add(parser[i]);
                    }

                    String strFullPath = null;
                    if (values.Count == 0) {
                        strFullPath = values[0];
                    } else {
                        strFullPath = values.Join("\\");
                    }

                    if (!String.IsNullOrWhiteSpace(strFullPath)) {
                        service.GetDistributionIdFromPath(strFullPath);
                        lblProgress.InvokeIfRequired(() => {
                            lblProgress.Content = strFullPath;
                            lblProgress.UpdateLayout();
                        });
                        rowCount++;
                    }
                }
            }

            lblProgress.InvokeIfRequired(() => {
                lblProgress.Content = String.Format("{0} rows processed.", rowCount);
            });
            btnCancel.Content = "_Close";
        }
开发者ID:kehh,项目名称:biolink,代码行数:57,代码来源:ImportDistributionRegionsWindow.xaml.cs


注:本文中的System.Windows.Documents.List.Join方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。