本文整理汇总了C#中BindingList.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.Remove方法的具体用法?C# BindingList.Remove怎么用?C# BindingList.Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.Remove方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DocumentsListVM
public DocumentsListVM(int siteId)
{
_site = Context.Sites.Single(s => s.Id == siteId);
var docs = Context.Documents.Where(x => x.Site.Id == siteId);
docs.Load();
_gridSource = new BindingList<Document>(docs.ToList());
RegisterCommand(new UiCommand("Провести", x => _selected.Accept(Context), x => _selected != null && !_selected.Accepted));
RegisterCommand(new UiCommand("Добавить", x => _controller.Show<DocumentVM, ViewDocument>(Context, _site.NewDocument(Context)), x => true));
RegisterCommand(new UiCommand("Удалить", x => _gridSource.Remove(_selected), x => _selected != null && !_selected.Accepted));
RegisterCommand(new UiCommand("Редактировать", x => _controller.Show<DocumentVM, ViewDocument>(Context, _selected), x => _selected != null && !_selected.Accepted));
}
示例2: SetupViewModel
public void SetupViewModel(PipeTest current, BindingList<Category> CategoryTypes, IReadOnlyList<PipeTest> pipeTests)
{
this.CategoryTypes = CategoryTypes;
IList<PipeTest> list = pipeTests.Where(_ => _.IsActive && !String.IsNullOrEmpty( _.Code)).OrderBy(x => x.Code).ToList<PipeTest>();
RepeatTestCandidates = new BindingList<Domain.Entity.Setup.PipeTest>(list);
pipeTest = new PipeTest();
if (current != null)
{
pipeTest.CustomShallowCopy(current);
if (current.Id != Guid.Empty)
{
PipeTest curr = RepeatTestCandidates.Where(s => s.Id == pipeTest.Id).SingleOrDefault();
RepeatTestCandidates.Remove(curr);
}
}
}
示例3: AnimatedToolbarCanvas
public AnimatedToolbarCanvas()
{
var ButtonOuterWidth = 16 + 4;
Items = new BindingList<AnimatedToolbarItem>();
Items.WithEvents(
(AddedSource, AddedIndex) =>
{
AddedSource.x = AddedIndex * ButtonOuterWidth;
AddedSource.cx = 8;
AddedSource.Button = new Canvas
{
Cursor = Cursors.Hand
}.AttachTo(this);
AddedSource.MoveTo =
delegate
{
AddedSource.Button.MoveTo(AddedSource.x + AddedSource.cx, 0);
};
#region ItemClicked
AddedSource.Button.MouseLeftButtonUp +=
delegate
{
if (ItemClicked != null)
ItemClicked(AddedSource);
};
#endregion
#region ItemMouseEnter
AddedSource.Button.MouseEnter +=
(e, s) =>
{
if (ItemMouseEnter != null)
ItemMouseEnter(AddedSource, s);
};
#endregion
#region ItemMouseLeave
AddedSource.Button.MouseLeave +=
(e, s) =>
{
if (ItemMouseLeave != null)
ItemMouseLeave(AddedSource, s);
};
#endregion
AddedSource.Button.MouseEnter +=
delegate
{
SelectedItem = AddedSource;
};
AddedSource.a = AddedSource.Button.ToAnimatedOpacity();
AddedSource.a.Opacity = 0;
#region fade in and slide left
AddedSource.Image.AttachTo(AddedSource.Button);
AddedSource.a.Opacity = 1;
if (AddedSource.cx > 0)
(1000 / 60).AtIntervalWithTimerAndCounter(
(t, c) =>
{
AddedSource.cx--;
AddedSource.MoveTo();
if (AddedSource.cx > 0)
return;
t.Stop();
}
);
#endregion
#region StartAnimatingRemove
Action StartAnimatingRemove =
delegate
{
if (Items.Count > MaxItems)
{
Items.First().With(
RemovedSource =>
{
RemovedSource.a.SetOpacity(0,
delegate
{
RemovedSource.Button.Orphanize();
RemovedSource.Button = null;
}
);
Items.Remove(RemovedSource);
//.........这里部分代码省略.........
示例4: Search
public BindingList<EventEntry> Search()
{
FormStorage<bool> storage = new FormStorage<bool>(false);
Dictionary<string, string> searchTerms = new Dictionary<string, string>();
Search search = new Search(searchTerms, typeof(EventEntry), storage);
search.ShowDialog();
if (storage.Value && searchTerms.Count != 0)
{
BindingList<EventEntry> searchList = new BindingList<EventEntry>();
foreach(EventEntry entry in _events)
{
searchList.Add(entry);
}
foreach (KeyValuePair<string, string> pair in searchTerms)
{
for (int i = 0; i < searchList.Count; i++)
{
object property = typeof(EventEntry).GetProperty(pair.Value).GetValue(searchList[i]);
if (property != null && !property.ToString().Contains(pair.Key))
{
i--;
searchList.Remove(searchList[i + 1]);
}
}
}
return searchList;
}
return _events;
}
示例5: FrmAddPlayers
public FrmAddPlayers(int homeTeamId, int guestTeamId, BindingList<Player> homePlayers, BindingList<Player> guestPlayers)
{
InitializeComponent();
this.HomeTeamId = homeTeamId;
this.GuestTeamId = guestTeamId;
string homeTeamName;
string guestTeamName;
this.PlayersAddSuccess = false;
using (var db = new MatchReporterEntities())
{
this.HomePlayersAll = new BindingList<Player>(db.Player
.Where(p => p.ClubId == homeTeamId).ToList<Player>());
this.GuestPlayersAll = new BindingList<Player>(db.Player
.Where(p => p.ClubId == guestTeamId).ToList<Player>());
homeTeamName = (db.Club
.Where(c => c.ClubId == homeTeamId).FirstOrDefault().Name).ToString();
guestTeamName = (db.Club
.Where(c => c.ClubId == guestTeamId).FirstOrDefault().Name).ToString();
}
lblHomeTeamName.Text = homeTeamName;
lblGuestTeamName.Text = guestTeamName;
this.HomePlayersPlay = new BindingList<Player>();
this.GuestPlayersPlay = new BindingList<Player>();
foreach(Player player in HomePlayersAll)
{
foreach(Player homePlayer in homePlayers)
{
if(player.PlayerId == homePlayer.PlayerId)
{
this.HomePlayersPlay.Add(player);
break;
}
}
}
foreach (Player player in GuestPlayersAll)
{
foreach (Player guestPlayer in guestPlayers)
{
if (player.PlayerId == guestPlayer.PlayerId)
{
this.GuestPlayersPlay.Add(player);
break;
}
}
}
this.HomePlayersAddedCount = HomePlayersPlay.Count;
this.GuestPlayersAddedCount = GuestPlayersPlay.Count;
lblHomeCurrentPlayerNumber.Text = this.HomePlayersAddedCount.ToString() + "/16";
lblGuestCurrentPlayerNumber.Text = this.GuestPlayersAddedCount.ToString() + "/16";
for (int i = 0; i < HomePlayersAll.Count; i++ )
{
Player player = HomePlayersAll[i];
for(int j = 0; j < HomePlayersPlay.Count; j++)
{
if(player.PlayerId == HomePlayersPlay[j].PlayerId)
{
HomePlayersAll.Remove(player);
i--;
break;
}
}
}
for (int i = 0; i < GuestPlayersAll.Count; i++)
{
Player player = this.GuestPlayersAll[i];
for (int j = 0; j < this.GuestPlayersPlay.Count; j++)
{
if (player.PlayerId == this.GuestPlayersPlay[j].PlayerId)
{
this.GuestPlayersAll.Remove(player);
i--;
break;
}
}
}
dgvHomePlayersAll.DataSource = this.HomePlayersAll;
dgvHomePlayersPlay.DataSource = this.HomePlayersPlay;
dgvGuestPlayersAll.DataSource = this.GuestPlayersAll;
dgvGuestPlayersPlay.DataSource = this.GuestPlayersPlay;
}
示例6: btnFilter
private void btnFilter(object sender, EventArgs e, ListBox lb, TextBox tb1, TextBox tb2, BindingList<string> lstDel, BindingList<string> lstAdd)
{
int[] arr = new int[lb.SelectedItems.Count];
lb.SelectedIndices.CopyTo(arr, 0);
for (int index = lb.SelectedItems.Count - 1; index >= 0; index--)
{
string item = (string)lb.Items[arr[index]];
lstAdd.Add(item);
lstDel.Remove(item);
}
FireEvent(tb1, "TextChanged", e);
FireEvent(tb2, "TextChanged", e);
lb.ClearSelected();
}
示例7: DoProcesses
private void DoProcesses(BindingList<Process> _processes)
{
while (programIsRunning || _processes.Count > 0)
{
if (_processes.Count > 0)
{
mut.WaitOne();
List<Process> sortedProcesses = _processes.OrderBy(x => x.Priority).ToList();
mut.ReleaseMutex();
sortedProcesses[0].Execute();
this.Invoke((Action) (() =>
{
results.First(x => x.ProcessId == sortedProcesses[0].Id).PauseTime =
sortedProcesses[0].GetPauseTime();
results.First(x => x.ProcessId == sortedProcesses[0].Id).EndTime = watch.ElapsedMilliseconds;
_processes.Remove(_processes.First(x => x.Id == sortedProcesses[0].Id));
dataGridViewResults.Refresh();
}));
}
else
{
Thread.Sleep(10);
processorFreeTime += 10;
}
}
ActionsAfterProgramStops();
}
示例8: EditSkillsForm_Load
private void EditSkillsForm_Load(object sender, EventArgs e)
{
BindingList<string> jobSkills = new BindingList<string>();
editExistingSkills = new BindingList<string>(service.DisplaySkills());
jobSkillsLBX.DataSource = editSelectedSkills;
for (int i = 0; i < editExistingSkills.Count; i++)
{
foreach (string j in editSelectedSkills)
{
if (j == editExistingSkills[i])
{
editExistingSkills.Remove(j);
}
}
}
DbSkillsLBX.DataSource = editExistingSkills;
}
示例9: CreateRemoveSensorButtonTemplate
public FrameworkElementFactory CreateRemoveSensorButtonTemplate(PlantsArea area,
BindingList<DataGridSensorView> dataGridSensorViews,
BindingList<DataGridServiceScheduleView> dataGridServiceScheduleViews,
Func<PlantsArea, Sensor, ServiceSchedule, bool> removeSensor)
{
FrameworkElementFactory buttonTemplate = new FrameworkElementFactory(typeof (Button));
buttonTemplate.SetValue(ContentControl.ContentProperty, "X");
buttonTemplate.AddHandler(
ButtonBase.ClickEvent,
new RoutedEventHandler((o, e) =>
{
DataGridSensorView dataGridSensorView = ((FrameworkElement) o).DataContext as DataGridSensorView;
if (dataGridSensorView != null)
{
if (dataGridSensorViews.Count(s => s.Measurable == dataGridSensorView.Measurable) == 0)
{
MessageBox.Show(
$"'{dataGridSensorView.Measurable}': sensor with such measurable does not exist");
return;
}
ServiceState serviceState = area.PlantServicesStates.ServicesStates.SingleOrDefault(
state => state.IsFor(dataGridSensorView.Measurable));
if (serviceState != null)
{
DataGridServiceScheduleView dataGridServiceScheduleView =
dataGridServiceScheduleViews.SingleOrDefault(
s => s.ServiceName == serviceState.ServiceName);
ServiceSchedule serviceSchedule =
area.ServicesSchedulesStates.ServicesSchedules.SingleOrDefault(
schedule => schedule.ServiceName == serviceState.ServiceName);
removeSensor(area, dataGridSensorView.Sensor, serviceSchedule);
dataGridSensorViews.Remove(dataGridSensorView);
dataGridServiceScheduleViews.Remove(dataGridServiceScheduleView);
}
}
OnRefreshControls();
})
);
return buttonTemplate;
}
示例10: Search
public BindingList<DatabaseEntry> Search()
{
FormStorage<bool> storage = new FormStorage<bool>(false);
Dictionary<string, string> searchTerms = new Dictionary<string,string>();
Search search = new Search(searchTerms, typeof(DatabaseEntry), storage);
search.ShowDialog();
if (storage.Value && searchTerms.Count != 0)
{
BindingList<DatabaseEntry> searchList = new BindingList<DatabaseEntry>();
foreach (DatabaseEntry entry in _availableEntries)
{
searchList.Add(entry);
}
foreach (KeyValuePair<string, string> pair in searchTerms)
{
for(int i = 0; i < searchList.Count; i++)
{
if (pair.Value == "Majors" || pair.Value == "Minors")
{
bool contains = false;
BindingList<string> keyList = (BindingList<string>)typeof(DatabaseEntry).GetProperty(pair.Value).GetValue(searchList[i]);
foreach (string major in keyList)
{
if (major.Contains(pair.Key))
{
contains = true;
}
}
if(!contains)
{
i--;
searchList.Remove(searchList[i + 1]);
}
}
else
{
object property = typeof(DatabaseEntry).GetProperty(pair.Value).GetValue(searchList[i]);
if (property != null && !property.ToString().Contains(pair.Key))
{
i--;
searchList.Remove(searchList[i + 1]);
}
}
}
}
return searchList;
}
return _availableEntries;
}
示例11: MovePositionRow
public void MovePositionRow(CBatch_detail_aa_twofold row_ini, CBatch_detail_aa_twofold row_end)
{
CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
BindingList<CBatch_detail_aa_twofold> lst = new BindingList<CBatch_detail_aa_twofold>(ListSamples);
// --- copiar muestra drag como temporal
CBatch_detail_aa_twofold tmp_row_ini = lst.Single(c => c.Cod_interno == row_ini.Cod_interno);
CBatch_detail_aa_twofold tmp_row_end = lst.Single(c => c.Cod_interno == row_end.Cod_interno);
// --- quitar muestra drag de la lista
lst.Remove(tmp_row_ini);
// --- obetener indice o posición a donde será movido
int new_index_end = lst.IndexOf(tmp_row_end);
// --- insertar la muestra que fue removida
lst.Insert(new_index_end, tmp_row_ini);
// --- reset orden de las muestras
short count = 1;
foreach (CBatch_detail_aa_twofold item in lst)
{
item.Order_sample_batch = count;
count++;
faBatch_detail_aa_twofold.Update(item);
}
// --- get source data
dtPivotBatch =
new BindingList<CBatch_detail_aa_twofold>(
faBatch_detail_aa_twofold
.GetAll()
.Where(c => c.Idbatch == Idbatch && c.Idtemplate_method == Idtemplate_method).ToList());
}
示例12: MineMapLoader
public MineMapLoader(BindingList<MineFieldButton> Context)
{
this.Context = Context;
const int ProgressbarWidth = 16;
var Progressbar = Enumerable.Range(0, ProgressbarWidth).ToArray(
i =>
{
var k = new MineFieldButton
{
IndexX = i - ProgressbarWidth / 2,
IndexY = 0,
IsEnabled = false,
BackgroundColor = Colors.Gray
};
Context.Add(k);
return k;
}
);
var Gradient = new[] {
Colors.Red,
Colors.Gray,
Colors.Gray
}.ToGradient(Progressbar.Length);
var ProgressbarTimer = (1000 / 24).AtIntervalWithCounter(
c =>
{
for (int i = 0; i < Progressbar.Length; i++)
{
Progressbar[Progressbar.Length - 1 - i].BackgroundColor = Gradient.AtModulus(c + i);
}
}
);
Action<double, Color> SetPercentage =
(value, color) =>
{
var k = Math.Ceiling(ProgressbarWidth * value);
for (int i = 0; i < Progressbar.Length; i++)
{
if (i < k)
Progressbar[i].BackgroundColor = color;
else
Progressbar[i].BackgroundColor = Colors.Gray;
}
};
const int ChunkLoad = 8;
Action<MineFieldButton[], Action> PrepareCache =
(a, done) =>
{
var n = new List<MineFieldButton>();
a.ForEach(
(j, next) =>
{
j.CachedNeighbours = j.Neighbours.ToArray();
j.CachedRegion = j.Region.ToArray();
n.Add(j);
SetPercentage((double)n.Count / (double)a.Length, Colors.Red);
if (n.Count % ChunkLoad == 0)
1.AtDelay(next);
else
next();
}
)(
delegate
{
foreach (var k in Progressbar)
{
Context.Remove(k);
}
Context.AddRange(a.ToArray());
done();
}
);
};
this.Prepare =
(i, done) =>
{
ProgressbarTimer.Stop();
foreach (var k in Progressbar)
{
k.BackgroundColor = Colors.Gray;
}
var a = i.ToArray();
var n = new List<MineFieldButton>();
//.........这里部分代码省略.........