本文整理汇总了C#中BindingList.First方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.First方法的具体用法?C# BindingList.First怎么用?C# BindingList.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.First方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RateCalculatorForm
public RateCalculatorForm()
{
InitializeComponent();
closeButton.Click += OnCloseButtonClick;
saveButton.Click += OnSaveButtonClick;
testButton.Click += OnTestButtonClick;
parameters = new Dictionary<int, string>();
foreach (object[] d in DataHelper.GetParameters())
{
parameters.Add((int)d[0], (string)d[1]);
}
repositoryItemComboBox1.Items.Add(string.Empty);
repositoryItemComboBox1.Items.AddRange(parameters.Values.OrderBy(v => v).ToArray());
formulas = new BindingList<Formula>(DataHelper.GetFormulas());
gridRateList.DataSource = formulas;
modifiedObjects = new Dictionary<int, int>();
modifiedParams = new Dictionary<int, int>();
viewRateList.CustomDrawCell += (_,e) => OnCustomDrawCell(false, e);
viewRateList.CellValueChanged += OnCellValueChanged;
viewRateList.FocusedRowChanged += OnFocusedRowChanged;
viewRateParams.CustomDrawCell += (_, e) => OnCustomDrawCell(true, e);
viewRateParams.CellValueChanged += OnParamCellValueChanged;
if (formulas.Count > 0)
{
viewRateList.SelectRow(0);
formParameters = new BindingList<FormulaParameter>(formulas.First().Parameters);
tbFormulaExp.Text = formulas.First().Expression;
}
else
{
formParameters = new BindingList<FormulaParameter>();
tbFormulaExp.Text = string.Empty;
}
testCalcValue.Text = string.Empty;
gridRateParams.DataSource = formParameters;
validButton.Click += OnValidButtonClick;
tbFormulaExp.TextChanged += OnTextChanged;
testValues = new List<TestValue>();
}
示例2: AssertMatchShows
private void AssertMatchShows(BindingList<IJointShow> sourceShows, BindingList<IJointShow> loadedShows)
{
Assert.AreEqual(sourceShows.Count, loadedShows.Count);
foreach (IJointShow jointShow in loadedShows)
{
IJointShow matchingSourceShow = sourceShows.First(sourceShow => sourceShow.Name == jointShow.Name);
Assert.NotNull(matchingSourceShow);
BindingList<IShow> importedShows = (BindingList<IShow>)matchingSourceShow.ImportedShowsDataSource;
BindingList<IShow> showOrderShows = (BindingList<IShow>)matchingSourceShow.ShowOrderDataSource;
foreach (IShow showOrderShow in jointShow.ShowOrderShows)
Assert.IsTrue(importedShows.Any(show => show.Path == showOrderShow.Path));
foreach (IShow importedShow in showOrderShows)
Assert.IsTrue(importedShows.Any(show => show.Path == importedShow.Path));
}
}
示例3: MainViewModel
private MainViewModel()
{
NewCommand = new RelayCommand(CreateNew);
OpenCommand = new RelayCommand(Open);
SaveCommand = new RelayCommand(Save, CanSave);
SaveAsCommand = new RelayCommand(SaveAs, CanSave);
ExportCommand = new RelayCommand(Export, CanSave);
UndoCommand = new RelayCommand(Undo, CanUndo);
RedoCommand = new RelayCommand(Redo, CanRedo);
OpenProjects = new BindingList<Project>();
EditorModes = new BindingList<EditorMode>
{
EditorMode.Cursor,
EditorMode.Line,
EditorMode.Arc,
EditorMode.Bezier,
EditorMode.Spline,
};
currentEditorMode = EditorModes.First();
}
示例4: 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);
//.........这里部分代码省略.........
示例5: 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();
}
示例6: init
public void init()
{
smartphones = DataManager.getSmartphones();
phonesListBox.DataSource = smartphones;
phonePictureBox.Image = smartphones.First().image;
}