本文整理汇总了C#中System.Windows.Documents.List.RemoveAll方法的典型用法代码示例。如果您正苦于以下问题:C# List.RemoveAll方法的具体用法?C# List.RemoveAll怎么用?C# List.RemoveAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.RemoveAll方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListarTaxas
private void ListarTaxas()
{
List<Contrato.Taxa> lstTaxas = new List<Contrato.Taxa>();
Contrato.EntradaTaxa entTaxa = new Contrato.EntradaTaxa();
entTaxa.UsuarioLogado = Comum.Util.UsuarioLogado.Login;
entTaxa.EmpresaLogada = Comum.Parametros.EmpresaProduto;
entTaxa.Chave = Comum.Util.Chave;
entTaxa.Taxa = new Contrato.Taxa() { Ativo = true, Produto = true };
Servico.BrasilDidaticosClient servBrasilDidaticos = new Servico.BrasilDidaticosClient(Comum.Util.RecuperarNomeEndPoint());
Contrato.RetornoTaxa retTaxa = servBrasilDidaticos.TaxaListar(entTaxa);
servBrasilDidaticos.Close();
// Se encontrou taxas
if (retTaxa.Taxas != null)
// Adiciona as taxas do Produto
lstTaxas.AddRange(retTaxa.Taxas);
if (cmbFornecedor.ValorSelecionado != null)
{
// Recupera as taxas do fornecedor
List<Contrato.Taxa> taxas = (from f in _lstFornecedores
where f.Id == ((Contrato.Fornecedor)cmbFornecedor.ValorSelecionado).Id
select f).First().Taxas;
// Se encontrou as taxas do fornecedor
if (taxas != null)
{
// Para cada taxa dentro da listagem de taxa do fornecedor
foreach (Contrato.Taxa tx in taxas)
{
if (tx != null)
{
Contrato.Taxa objTaxa = lstTaxas.Where(t => t.Nome == tx.Nome).FirstOrDefault();
if (objTaxa != null)
{
if (lstTaxas.RemoveAll(t => t.Nome == tx.Nome && (objTaxa.Valor != t.Valor || t.Valor == 0)) > 0)
lstTaxas.Add(tx);
}
else
lstTaxas.Add(tx);
}
}
}
}
if (lstTaxas != null)
{
List<Objeto.Taxa> objTaxas = null;
if (_produto != null && _produto.Taxas != null)
{
objTaxas = new List<Objeto.Taxa>();
// Para cada taxa existente
foreach (Contrato.Taxa taxa in lstTaxas)
{
// Verifica se a taxa não está vazia
if (taxa != null)
{
// Adiciona a taxa no objeto que popula o grid
objTaxas.Add(new Objeto.Taxa { Selecionado = false, Id = taxa.Id, Nome = taxa.Nome, Prioridade = taxa.Prioridade, Ativo = taxa.Ativo });
// Recupera a mesma taxa na lista de taxas do produto
Contrato.Taxa objTaxa = (from ft in _produto.Taxas where ft.Nome == taxa.Nome select ft).FirstOrDefault();
// Se a taxa existe para o produto
if (objTaxa != null)
{
// Atualiza a taxa com os valores do produto
objTaxas.Last().Selecionado = true;
objTaxas.Last().Valor = objTaxa.Valor;
objTaxas.Last().Prioridade = objTaxa.Prioridade;
}
}
}
}
else
objTaxas = (from t in lstTaxas
select new Objeto.Taxa { Selecionado = false, Id = t.Id, Nome = t.Nome, Valor = t.Valor, Prioridade = t.Prioridade, Ativo = t.Ativo }).ToList();
dgTaxas.ItemsSource = objTaxas;
}
}
示例2: DeleteItem
private void DeleteItem()
{
List<PID> PIDLIST = new List<PID>();
PIDLIST = XML_W_R.XMLRead(FileName);
PIDLIST.RemoveAll(FindItem);
XML_W_R.XMLWrite(PIDLIST, FileName);
PIDLIST.Clear();
}
示例3: DoCut
internal static void DoCut(List<ModelItem> modelItemsToCut, EditingContext context)
{
if (modelItemsToCut == null)
{
throw FxTrace.Exception.AsError(new ArgumentNullException("modelItemsToCut"));
}
if (context == null)
{
throw FxTrace.Exception.AsError(new ArgumentNullException("context"));
}
modelItemsToCut.RemoveAll((modelItem) => { return modelItem == null; });
if (modelItemsToCut.Count > 0)
{
using (EditingScope es = (EditingScope)modelItemsToCut[0].BeginEdit(SR.CutOperationEditingScopeDescription))
{
try
{
CutCopyOperation(modelItemsToCut, context, true);
}
catch (ExternalException e)
{
es.Revert();
ErrorReporting.ShowErrorMessage(e.Message);
return;
}
DesignerView view = context.Services.GetService<DesignerView>();
//Setting the selection to Breadcrumb root.
Fx.Assert(view != null, "DesignerView Cannot be null during cut");
WorkflowViewElement rootView = view.RootDesigner as WorkflowViewElement;
if (rootView != null)
{
Selection.SelectOnly(context, rootView.ModelItem);
}
es.Complete();
}
}
}
示例4: DoCopy
private static void DoCopy(List<ModelItem> modelItemsToCopy, EditingContext context)
{
if (modelItemsToCopy == null)
{
throw FxTrace.Exception.AsError(new ArgumentNullException("modelItemsToCopy"));
}
if (context == null)
{
throw FxTrace.Exception.AsError(new ArgumentNullException("context"));
}
// copy only works if we have DesignerView up and running so check and throw here
if (context.Services.GetService<DesignerView>() == null)
{
throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CutCopyRequiresDesignerView));
}
modelItemsToCopy.RemoveAll((modelItem) => { return modelItem == null; });
try
{
CutCopyOperation(modelItemsToCopy, context, false);
}
catch (ExternalException e)
{
ErrorReporting.ShowErrorMessage(e.Message);
}
}
示例5: Button32_OnClick
private void Button32_OnClick(object sender, RoutedEventArgs e)
{
var retstr = "";
var plist = new List<string>();
var dlist = 用户管理.查询用户<单位用户>(0, 0);
foreach (var d in dlist)
{
if (d.联系方式.手机!=null)
plist.Add(d.联系方式.手机);
}
plist.RemoveAll(o => o.Length < 10 || o.Contains("88888"));
plist = plist.Distinct().ToList();
foreach (var p in plist)
{
retstr += p + "\r\n";
}
textBox1.Text = retstr;
}
示例6: ExpandChildren
internal void ExpandChildren(TaxonViewModel taxon, List<Taxon> remaining = null)
{
if (remaining == null) {
remaining = Service.GetExpandFullTree(taxon.TaxaID.Value);
}
if (!taxon.IsExpanded) {
// BringModelToView(tvwAllTaxa, taxon);
taxon.BulkAddChildren(remaining.FindAll((elem) => { return elem.TaxaParentID == taxon.TaxaID; }), GenerateTaxonDisplayLabel);
remaining.RemoveAll((elem) => { return elem.TaxaParentID == taxon.TaxaID; });
taxon.IsExpanded = true;
}
foreach (HierarchicalViewModelBase child in taxon.Children) {
ExpandChildren(child as TaxonViewModel, remaining);
}
}
示例7: RefreshBinds
private void RefreshBinds()
{
_binds = BindManager.CurrentKeybinds.ToList();
ListKeybinds.Items.Clear();
var shoulders = new List<GamepadButton>
{
GamepadButton.ShoulderLeft,
GamepadButton.ShoulderRight,
GamepadButton.TriggerLeft,
GamepadButton.TriggerRight,
};
switch (Properties.Settings.Default.ModifierStyle)
{
case 0:
shoulders.Remove(GamepadButton.ShoulderRight);
shoulders.Remove(GamepadButton.TriggerRight);
break;
case 1:
shoulders.Remove(GamepadButton.ShoulderLeft);
shoulders.Remove(GamepadButton.ShoulderRight);
break;
case 2:
shoulders.Remove(GamepadButton.ShoulderLeft);
shoulders.Remove(GamepadButton.TriggerLeft);
break;
case 3:
shoulders.Remove(GamepadButton.TriggerLeft);
shoulders.Remove(GamepadButton.TriggerRight);
break;
}
_binds.RemoveAll(bind => shoulders.Contains(bind.BindType));
foreach (var bind in _binds)
{
var buttonBind = new TextBlock
{
Text = bind.Key.ToString(),
VerticalAlignment = VerticalAlignment.Center
};
var buttonText = new TextBlock
{
Text = ControllerManager.GetButtonName(bind.BindType),
VerticalAlignment = VerticalAlignment.Center,
Width = 100,
};
var buttonIcon = new Image
{
Source = ControllerManager.GetButtonIcon(bind.BindType),
Width = 32,
Height = 32,
Stretch = Stretch.Uniform
};
var buttonPanel = new DockPanel {Children = {buttonIcon, buttonText, buttonBind}};
var buttonItem = new ListViewItem {Content = buttonPanel};
ListKeybinds.Items.Add(buttonItem);
}
}
示例8: m_sourcePathBox_TextChanged
void m_sourcePathBox_TextChanged(object sender, TextChangedEventArgs e)
{
string check_url = m_sourcePathBox.Text;
/* Try to grab XML document from URL */
XmlDocument xd = new XmlDocument();
try
{
xd.Load(check_url);
}
catch(Exception) // TODO: Make sure this is working properly
{
m_recordCombo.IsEnabled = false;
return;
}
m_recordCombo.IsEnabled = true;
XmlNode inXmlNode = xd.DocumentElement;
/* BOBEX: Here is the example of tree traversal, in fact, since it already finds all the nodes everytime you change the URL, you just have to remove the
* non-relevant ones. The bigger problem will be appending a drop down box to a DataTable */
traverseNodes(xd.ChildNodes, "");
pos_xml_paths = pos_xml_paths.Distinct().ToList();
pos_xml_paths.RemoveAll(ContainsHash);
pos_xml_paths.Sort();
m_recordCombo.ItemsSource = pos_xml_paths;
}
示例9: StartGrabbing
/// <summary>
/// Validates, then starts grabbing.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param>
private void StartGrabbing(object sender, ExecutedRoutedEventArgs e)
{
var scheduledGrab = e.Parameter as ScheduledGrab;
List<string> paths = new List<string>();
foreach (var item in cboFileName.Items) {
string path = Convert.ToString(item);
if (!string.IsNullOrWhiteSpace(path) && !paths.Contains(path)) {
paths.Add(path);
}
}
paths.RemoveAll(p => p == cboFileName.Text);
if (!string.IsNullOrWhiteSpace(cboFileName.Text)) {
paths.Insert(0, cboFileName.Text);
cboFileName.Items.Insert(0, cboFileName.Text);
};
Settings.Default.LogToDatabase = chkLogDatabase.IsChecked == true;
Settings.Default.LogToFile = chkLogFile.IsChecked == true;
Settings.Default.TrimExtraWhitespace = chkTrimWhitespace.IsChecked == true;
Settings.Default.LogDbPath = cboDbPath.Text;
Settings.Default.FilePath = CsvGrabber.Core.Utils.SerializeList(paths);
Settings.Default.Save();
_config = WPFConfiguration.GetConfig();
_grabber = new Grabber();
_grabber.Logger = new CompositeLogger(new ConsoleLogger(), new RichTextBoxLogger(rtbLog));
_grabber.GrabComplete += new EventHandler<GrabCompleteEventArgs>(grabber_GrabComplete);
_grabber.GrabFailed += new EventHandler(grabber_GrabFailed);
if (scheduledGrab == null)
{
_grabber.Start();
} else {
_grabber.GrabSingle(scheduledGrab);
}
}
示例10: Startup
private void Startup(String title, List<CategoryItem> categories)
{
ExitCode = 0;
Title = title;
Owner = Controller.MainWindow;
Categories = categories;
Categories.RemoveAll(c => (c.Name == "All") || (c.Name == "Favorite"));
InitializeComponent();
ViewFields();
}
示例11: ComboBox_UtilitiesNames_SelectionChanged
// При смене утилиты определяется её версия,
// очищается список доступных параметров и загружается новый список,
// а также выводится описание выбранной утилиты
private void ComboBox_UtilitiesNames_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// Получаем имя выбранной утилиты (т.к. выбирается только один объект,
// то в массиве AddedItems он будет всегда находиться под индексом 0)
string name = e.AddedItems[0].ToString();
// Получаем запускаем процесс с параметром --version,
// чтобы получить версию выбранной утилиты
m_ProcessForVersion.StartInfo.FileName =
Properties.Settings.Default.UtilitiesDirectory + name;
m_ProcessForVersion.Start();
m_ProcessForVersion.BeginOutputReadLine();
m_ProcessForVersion.WaitForExit();
m_ProcessForVersion.CancelOutputRead();
m_ProcessForVersion.Close();
TextBox_UtilityVersion.Text = m_UtilityVersion.ToString();
StackPanel_AdditionalParameters.Children.Clear();
// Получаем параметры для данной утилиты,
// проверяем их совместимость с выбранной версией утилиты и
// выводим список в ListBox
m_UtilityParameters = DataBaseControl.GetUtilityParameters(name);
m_UtilityParameters.RemoveAll(x => new Version(x.GetDataRow["Version"].ToString()) > m_UtilityVersion);
//ListBox_AvailableParameters.ItemsSource = m_UtilityParameters;
// Добавляем только те параметры, которые должны выводиться
// в списке доступных параметров (отсекает src_dataset и dst_dataset)
ListBox_AvailableParameters.ItemsSource =
m_UtilityParameters.Where(x => (bool)x.GetDataRow["MustBeInAvailableParametersList"] == true);
// Выводим описание выбранной утилиты в соответствии с
// выбранным в настройках языком
m_UtilityInfo = DataBaseControl.GetUtilityInfo(e.AddedItems[0].ToString());
TextBlock_UtilityDescription.Text =
m_UtilityInfo["Description"+Properties.Settings.Default.DescriptionsLanguage].ToString();
// Если утилита не поддерживает вход/выход, то отключаем соответствующие
// GroupBox, в которых выбираются входные/выходные данные
GroupBox_InputPaths.IsEnabled = (bool) m_UtilityInfo["IsThereInput"];
GroupBox_OutputPaths.IsEnabled = (bool)m_UtilityInfo["IsThereOutput"];
}