當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。