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


C# List.All方法代码示例

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


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

示例1: checkIfDirectoriesExist

        private bool checkIfDirectoriesExist()
        {
            List<string> directories = new List<string>() {
                FolderLocator1.Text,
                FolderLocator2.Text,
                FolderLocator3.Text
            };

            if (directories.All(s => string.IsNullOrEmpty(s)))
            {
                this.ErrorSection.Text = "You must choose at least one directory.";
                return false;
            }

            foreach (string directory in directories)
            {
                if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
                {
                    this.ErrorSection.Text = "The chosen file directory " + directory + " does not exist.";
                    return false;
                }
            }
            return true;
        }
开发者ID:RobertLippens,项目名称:GitUpdater,代码行数:24,代码来源:MainWindow.xaml.cs

示例2: UpdateView

 public void UpdateView(List<Table> tables)
 {
     Methods.UiInvoke(() =>
     {
         // remove non-existing
         foreach (var tableInfo in _tablesInfo.Where(ti => tables.All(t => t != ti.Table)).ToArray())
         {
             _tablesInfo.Remove(tableInfo);
         }
         // find of add new
         foreach (var table in tables)
         {
             TableInfo tableInfo = _tablesInfo.FirstOrDefault(ti => ti.Table == table);
             if (tableInfo == null)
             {
                 tableInfo = new TableInfo(table);
                 _tablesInfo.Add(tableInfo);
             }
             tableInfo.Update();
         }
         // fit grid view
         GridView_TablesInfo.ResetColumnWidths();
     });
 }
开发者ID:kampiuceris,项目名称:PsHandler,代码行数:24,代码来源:UCTables.xaml.cs

示例3: SaveFile

 private void SaveFile()
 {
     if (Files.SelectedItem != null)
     {
         List<Documents> D = new List<Documents>();
         foreach (Documents d in Files.SelectedItems)
         {
             D.Add(d);
         }
         D.All(a =>
         {
             Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
             sfd.OverwritePrompt = true;
             sfd.FileName = a.Name;
             sfd.ValidateNames = true;
             sfd.AddExtension = true;
             sfd.Filter = "文档|*.doc;*docx;*.pdf|电子表格|*.xls;*.xlsx|图片|*.jpg;*.gif;*.png;*.jpge|所有支持的文件类型|*.doc;*docx;*.pdf;*.xls;*.xlsx;*.jpg;*.gif;*.png;*.jpge";
             sfd.FilterIndex = 4;
             sfd.Title = String.Format("另存为——{0}", a.Name);
             if ((bool)sfd.ShowDialog(this))
             {
                 System.IO.Stream output = sfd.OpenFile();
                 output.BeginWrite(a.Data, 0, a.Data.Length, new AsyncCallback((b) => { output.Close(); }), null);
                 return true;
             }
             return false;
         });
     }
     statusText.Content = "请先选择一个要下载的文件。";
 }
开发者ID:JackJCSN,项目名称:APMS,代码行数:30,代码来源:RulesAndRegulationsManagement.xaml.cs

示例4: OnTagCheckedOrUnchecked

        void OnTagCheckedOrUnchecked(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            List<int> selected_tags = new List<int>();
            if (e.PropertyName != "IsChecked") return;

            foreach (Tag t in _tags.Where(obj => obj.IsChecked))
            {
                selected_tags.Add(t.ID);
            }

            _filteredAudioFiles.Clear();
            if (selected_tags.Count == 0) return;
            foreach (AudioFile f in _audioFiles)
            {
                if (selected_tags.All(id => f.Tags.Contains(id)))
                {
                    _filteredAudioFiles.Add(f);
                }
            }
        }
开发者ID:VikramB87,项目名称:MusicTagger,代码行数:20,代码来源:GenPlaylist.xaml.cs

示例5: dataGridInvoices_SelectedCellsChanged

        private void dataGridInvoices_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            var selectedRow = dataGridInvoices.CurrentItem as InvoiceViewModel;

            if (selectedRow is InvoiceViewModel)
            {                
                _total = 0;
                tractors.Clear();
                tractors = data.GetDetails<TRACTOR_PURCHASE>(s => s.INVOICE_ID, selectedRow.InvoiceNumber, selectedRow.InvoiceDate, CommonLayer.TYPE.TRACTOR);
                gridTractors.ItemsSource = tractors;
                tractors.All(s => { _total += s.TRACTOR_PURCHASE_RATE; return true; });
                ShowTotal();
            }
        }
开发者ID:qq5013,项目名称:TMS-1,代码行数:14,代码来源:AddTractorPurchaseDetailView.xaml.cs

示例6: GetApproximateCount

        private static double GetApproximateCount(List<Dot> dots, double radius)
        {
            if (dots.All(o => !o.IsStatic))
            {
                return dots.Count;
            }

            double[] rads = dots.Select(o => o.Position.ToVector().Length).ToArray();
            double maxRadius = radius * .15d;
            double retVal = 0d;

            for (int cntr = 0; cntr < dots.Count; cntr++)
            {
                if (!dots[cntr].IsStatic)
                {
                    // The movable dots are always counted
                    retVal += 1d;
                }
                else if (rads[cntr] <= radius)
                {
                    // Fully include everything that's <= radius
                    retVal += 1d;
                }
                else
                {
                    // Scale out the ones that are > radius
                    double percent = (rads[cntr] - radius) / maxRadius;
                    if (percent < 1d && percent > 0d)
                    {
                        retVal += percent;
                    }
                }
            }

            // Exit Function
            return retVal;
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:37,代码来源:EvenDistributionSphere.xaml.cs


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