本文整理汇总了C#中System.Windows.Forms.BindingSource.ResetBindings方法的典型用法代码示例。如果您正苦于以下问题:C# BindingSource.ResetBindings方法的具体用法?C# BindingSource.ResetBindings怎么用?C# BindingSource.ResetBindings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.BindingSource
的用法示例。
在下文中一共展示了BindingSource.ResetBindings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Form1
public Form1()
{
InitializeComponent();
source = new BindingSource();
using (var ctx = new Model1Container())
{
var ads = from carAds in ctx.BargainAdsSet
select new { carAds.Id, carAds.Brand, carAds.Model, carAds.Engine,
carAds.Year, carAds.Price, carAds.City, carAds.FromDate, carAds.ToDate };
source.ResetBindings(true);
source.DataSource = ads.ToList();
try
{
dataGridView1.DataSource = source;
}
catch (Exception ex)
{
Console.WriteLine(ex.InnerException);
}
}
}
示例2: iAlarm
public iAlarm()
{
InitializeComponent();
if (!DesignMode)
{
_almList = AlarmManager.Instance.Alarms.FindAll(delegate(IAlarm alarm) { return alarm.TimeStampAck == null && Convert.ToDateTime(alarm.TimeStamp) > DateTime.Now.Subtract(new TimeSpan(24, 0, 0));});
_bs=new BindingSource();
_bs.DataSource = _almList;
dgvAlarms.DataSource = _bs;
dgvAlarms.Columns["DataType"].Visible = false;
_refreshTmr = new System.Windows.Forms.Timer();
_refreshTmr.Interval = 1000;
_refreshTmr.Tick += delegate
{
dataThread = new Thread(new ThreadStart(this.ThreadProcSafe));
dataThread.Start();
_bs.ResetBindings(false);
};
_refreshTmr.Start();
}
}
示例3: RebindBindingSource
/// <summary>
/// Rebinds the binding source.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="data">The data.</param>
/// <param name="metadataChanged">if set to <c>true</c> then metadata (ovject/list type) was changed.</param>
public static void RebindBindingSource(BindingSource source, object data, bool metadataChanged)
{
if (data != null)
{
source.DataSource = data;
}
// set Raise list changed to True
source.RaiseListChangedEvents = true;
// tell currency manager to resume binding
source.ResumeBinding();
// Notify UI controls that the dataobject/list was reset - and if metadata was changed
source.ResetBindings(metadataChanged);
}
示例4: DynamicTeComponentControl
/// <summary>
/// Constructor
/// </summary>
public DynamicTeComponentControl(DynamicTeComponent component)
:base(component)
{
InitializeComponent();
_component = component;
_bindingSource = new BindingSource();
_bindingSource.DataSource = _component;
_probabilityMapVisible.DataBindings.Clear();
_probabilityMapVisible.DataBindings.Add("Enabled", _bindingSource, "ProbabilityMapEnabled", true,
DataSourceUpdateMode.OnPropertyChanged);
_probabilityMapVisible.DataBindings.Add("Checked", _bindingSource, "ProbabilityMapVisible", true,
DataSourceUpdateMode.OnPropertyChanged);
_opacityControl.TrackBarIncrements = 100;
_thresholdControl.TrackBarIncrements = 500;
_opacityControl.DataBindings.Clear();
_opacityControl.DataBindings.Add("Enabled", _bindingSource, "OpacityEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
_opacityControl.DataBindings.Add("Minimum", _bindingSource, "OpacityMinimum", true, DataSourceUpdateMode.OnPropertyChanged);
_opacityControl.DataBindings.Add("Maximum", _bindingSource, "OpacityMaximum", true, DataSourceUpdateMode.OnPropertyChanged);
_opacityControl.DataBindings.Add("Value", _bindingSource, "Opacity", true, DataSourceUpdateMode.OnPropertyChanged);
_thresholdControl.DataBindings.Clear();
_thresholdControl.DataBindings.Add("Enabled", _bindingSource, "ThresholdEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
_thresholdControl.DataBindings.Add("Minimum", _bindingSource, "ThresholdMinimum", true, DataSourceUpdateMode.OnPropertyChanged);
_thresholdControl.DataBindings.Add("Maximum", _bindingSource, "ThresholdMaximum", true, DataSourceUpdateMode.OnPropertyChanged);
_thresholdControl.DataBindings.Add("Value", _bindingSource, "Threshold", true, DataSourceUpdateMode.OnPropertyChanged);
_createDynamicTeButton.DataBindings.Clear();
_createDynamicTeButton.DataBindings.Add("Enabled", _bindingSource, "CreateDynamicTeSeriesEnabled", true,
DataSourceUpdateMode.OnPropertyChanged);
_createDynamicTeButton.Click += delegate(object sender, EventArgs e)
{
_component.CreateDynamicTeSeries();
};
_component.AllPropertiesChanged += delegate(object sender, EventArgs e)
{
_bindingSource.ResetBindings(false);
};
}
示例5: AgregarProducto_Click
private void AgregarProducto_Click(object sender, EventArgs e)
{
var idSeleccionado = productosGrid.SelectedRows[0].Cells["Id"].Value.ToString();
bool existe = false;
for (int i = 0; i < _lproductosPedido.Count && !existe; i++)
{
if (_lproductosPedido[i].Id.Equals(idSeleccionado))
{
_lproductosPedido[i].Cantidad += 1;
existe = true;
}
}
if (!existe)
{
var productoSeleccionado = _lproductos.First(p => p.Id == idSeleccionado);
_lproductosPedido.Add(new PedidoGV()
{
Id = productoSeleccionado.Id,
Nombre = productoSeleccionado.Nombre,
Cantidad = 1
});
}
BindingSource source = new BindingSource();
source.DataSource = _lproductosPedido;
pedidoGrid.DataSource = source;
source.ResetBindings(false);
if (_lproductosPedido.Count > 0)
{
eliminarButton.Enabled = true;
crearButton.Enabled = true;
}
}
示例6: ResortGrid
protected override void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid,
FrameType frameType)
{
dataGrid.DataSource = bindingSource;
bindingSource.ResetBindings(false);
}
示例7: FormLoad
/// <summary>
/// initializes the form, loads the on screen widgets with data
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FormLoad(object sender, System.EventArgs e)
{
DERMSInterface.CIMData.header header = _cim.CreateDERHeader;
// header info
this.endPointText.Text = header.EndPoint;
this.messageTypeText.Text = "Create DER";
this.replyAddressText.Text = header.ReplyAddress;
this.userIDText.Text = header.UserID;
this.organizationText.Text = header.UserOrganization;
this.contextText.Text = header.Context;
this.verbText.Text = header.Verb;
this.ackRequiredCheck.Checked = header.AckRequired;
this.commentText.Text = header.Comment;
// group widgets
DERMSInterface.CIMData.DERGroup group = _group;
DERGroupNameText.Text = group.GroupName;
DERGroupMRIDText.Text = group.Mrid;
DERGroupRevisionText.Text = group.Revision;
DERGroupSubText.Text = group.Substation;
DERGroupFeederText.Text = group.Feeder;
DERGroupSegmentText.Text = group.Segment;
// TODO : we do not set count, reactive and total power values, they are derived
int deviceCount = 0;
double realPower = 0.0;
double reactivePower = 0.0;
// bind datasource to the currently selected DER group row
bs = new BindingSource();
bs.DataSource = group.Devices;
DERView.DataSource = bs;
bs.ResetBindings(false);
// we allow editing/adding to DER members
DERView.CellValueChanged += new DataGridViewCellEventHandler(DERCellValue_Updated);
DERView.CellValidating += new DataGridViewCellValidatingEventHandler(DERCell_Validating);
// first time, set the read-only sum/count vars for DERGRoup based
// on the DER members
group.Devices.ForEach(x =>
{
deviceCount++;
realPower += x.WattCapacity;
reactivePower += x.VarCapacity;
});
// editing for DER members, no edit on derived DER Group fields
DERView.ReadOnly = false;
DERGroupDeviceCountText.Enabled = false;
DERGroupRealText.Enabled = false;
DERGroupReactiveText.Enabled = false;
// intialize readonly vars
DERGroupDeviceCountText.Text = group.Devices.Count.ToString();
DERGroupReactiveText.Text = group.getVarCapacity().ToString();
DERGroupRealText.Text = group.getWattCapacity().ToString();
// if (_editDER == true)
// DERView.CellValueChanged += new DataGridViewCellEventHandler(CellValue_Changed);
}
示例8: EliminarLinea_Click
private void EliminarLinea_Click(object sender, EventArgs e)
{
var idSeleccionado = pedidoGrid.SelectedRows[0].Cells["Id"].Value.ToString();
System.Diagnostics.Debug.WriteLine(idSeleccionado);
for (int i = 0; i < _lproductosPedido.Count; i++)
{
if (_lproductosPedido[i].Id.Equals(idSeleccionado))
{
_lproductosPedido.RemoveAt(i);
if (_lproductosPedido.Count == 0)
{
eliminarButton.Enabled = false;
crearButton.Enabled = false;
}
}
}
BindingSource source = new BindingSource();
source.DataSource = _lproductosPedido;
pedidoGrid.DataSource = source;
source.ResetBindings(false);
}
示例9: buttonSearch_Click
//.........这里部分代码省略.........
(maxIVs[5] - minIVs[5] + 1);
if (combinations > 200)
{
MessageBox.Show(
"There were too many combinations of IV possibilities to accurately find your intitial seed (" +
combinations + ") please try with a higher level Pokemon,", "Too many IV Combinations");
return;
}
}
var version = (Version) comboBoxVersion.SelectedIndex;
var language = (Language) comboBoxLanguage.SelectedIndex;
var dstype = (DSType) comboBoxDSType.SelectedIndex;
var interval = (uint) ((VCountMax - VCountMin)/(float) jobs.Length);
uint VCountMinLower = VCountMin;
uint VCountMinUpper = VCountMin + interval;
var button = new int[3];
button[0] = comboBoxButton1.SelectedIndex;
button[1] = comboBoxButton2.SelectedIndex;
button[2] = comboBoxButton3.SelectedIndex;
try
{
progress.SetupAndShow(this, 0, 0, false, true);
for (int i = 0; i < jobs.Length; i++)
{
if (i < (jobs.Length - 1))
{
uint lower = VCountMinLower;
uint upper = VCountMinUpper;
jobs[i] =
new Thread(
() => GenerateSearchJob(testTime, minIVs, maxIVs, lower, upper,
Timer0Min, Timer0Max, GxStatMin, GxStatMax, VFrameMin,
VFrameMax, secondsMin, secondsMax, version, language, dstype,
button,
checkBoxSoftReset.Checked, checkBoxRoamer.Checked, minMaxGxStat));
}
else
{
uint lower = VCountMinLower;
jobs[i] =
new Thread(
() => GenerateSearchJob(testTime, minIVs, maxIVs, lower, VCountMax, Timer0Min,
Timer0Max, GxStatMin, GxStatMax, VFrameMin, VFrameMax,
secondsMin, secondsMax, version, language, dstype, button,
checkBoxSoftReset.Checked, checkBoxRoamer.Checked, minMaxGxStat));
}
jobs[i].Start();
Thread.Sleep(100);
VCountMinLower = VCountMinLower + interval + 1;
VCountMinUpper = VCountMinUpper + interval + 1;
}
bool alive = true;
while (alive)
{
progress.ShowProgress(progressSearched/(float) progressTotal, progressSearched, progressFound);
if (refreshQueue)
{
listBinding.ResetBindings(false);
refreshQueue = false;
}
foreach (Thread job in jobs)
{
if (job != null && job.IsAlive)
{
alive = true;
break;
}
alive = false;
}
}
}
catch (Exception exception)
{
if (exception.Message != "Operation Cancelled")
{
throw;
}
}
finally
{
progress.Finish();
if (dsParameters.Count > 0)
{
btnSendTimeFinder.Enabled = true;
}
for (int i = 0; i < jobs.Length; i++)
{
if (jobs[i] != null)
{
jobs[i].Abort();
}
}
}
}
示例10: ResortGrid
private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType)
{
switch (frameType)
{
case FrameType.Method5Standard:
case FrameType.Method5Natures:
case FrameType.Wondercard5thGen:
case FrameType.Wondercard5thGenFixed:
var iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "TimeDate"};
((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer);
CapDateTime.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
break;
case FrameType.BWBred:
case FrameType.BWBredInternational:
iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "TimeDate"};
((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer);
ColumnEggDate.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
break;
}
dataGrid.DataSource = bindingSource;
bindingSource.ResetBindings(false);
}
示例11: ResortGrid
private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType)
{
switch (frameType)
{
case FrameType.EBredPID:
var iframeComparer = new IFrameEEggPIDComparer {CompareType = "Frame"};
((List<IFrameEEggPID>) bindingSource.DataSource).Sort(iframeComparer);
EPIDFrame.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
break;
}
dataGrid.DataSource = bindingSource;
bindingSource.ResetBindings(false);
}
示例12: refreshgrid
public static void refreshgrid(DataGridView _dg, BindingSource _bs, bool endstate)
{
if (_dg.InvokeRequired)
{
try
{
_dg.Invoke(new booldel(refreshgrid), new object[] { _dg,_bs,endstate });
}
catch (ObjectDisposedException) { }
}
else
{
// save screen position and selections
List<int> sel = new List<int>();
int first = -1;
try
{
lock (_dg)
{
first = _dg.FirstDisplayedScrollingRowIndex;
foreach (DataGridViewRow dr in _dg.SelectedRows)
sel.Add(dr.Index);
}
// update screen
_bs.RaiseListChangedEvents = true;
_bs.ResetBindings(false);
// diable updates again
_bs.RaiseListChangedEvents = endstate;
}
catch (Exception ex)
{
}
// restore screen position and selections
lock (_dg)
{
try
{
if (first != -1)
_dg.FirstDisplayedScrollingRowIndex = first;
foreach (int r in sel)
_dg.Rows[r].Selected = true;
}
catch
{
// in case this row was deleted in the middle of an update
}
}
}
}
示例13: bindDevices
/// <summary>
/// binds the DER Group and DER Members to the group passed
/// </summary>
/// <param name="group"></param>
private void bindDevices(DERMSInterface.CIMData.DERGroup group)
{
if (group == null)
{
dERGroupBindingSource.DataSource = null;
DERView.DataSource = null;
dERGroupBindingSource.Clear();
}
else
{
if (group.Devices == null)
group.Devices = new List<DERMSInterface.CIMData.device>();
dERGroupBindingSource = new BindingSource();
dERGroupBindingSource.DataSource = group.Devices;
DERView.DataSource = dERGroupBindingSource;
dERGroupBindingSource.ResetBindings(false);
}
}
示例14: buttonSearch_Click
//.........这里部分代码省略.........
buttons[1] = comboBoxButton2.SelectedIndex;
buttons[2] = comboBoxButton3.SelectedIndex;
uint button = Functions.buttonMashed(buttons);
String[] arrows = txtSpins.Text.Split(' ');
var pattern = new uint[arrows.Length];
for (int i = 0; i < arrows.Length; ++i)
{
switch (arrows[i])
{
case "↑":
pattern[i] = 0;
break;
case "↗":
pattern[i] = 1;
break;
case "→":
pattern[i] = 2;
break;
case "↘":
pattern[i] = 3;
break;
case "↓":
pattern[i] = 4;
break;
case "↙":
pattern[i] = 5;
break;
case "←":
pattern[i] = 6;
break;
case "↖":
pattern[i] = 7;
break;
}
}
try
{
progress.SetupAndShow(this, 0, 0, false, true);
for (int i = 0; i < jobs.Length; i++)
{
uint lower = VCountMinLower;
uint upper = (i < (jobs.Length - 1)) ? VCountMinUpper : VCountMax;
jobs[i] =
new Thread(
() => Search(testTime, lower, upper, Timer0Min, Timer0Max, VFrameMin,
VFrameMax, GxStatMin, GxStatMax, minMaxGxStat, secondsMin, secondsMax,
checkBoxSoftReset.Checked, version, language, dstype, cbMemoryLink.Checked,
MAC_address,
button, pattern));
jobs[i].Start();
Thread.Sleep(100);
VCountMinLower = VCountMinLower + interval + 1;
VCountMinUpper = VCountMinUpper + interval + 1;
}
bool alive = true;
while (alive)
{
progress.ShowProgress(progressSearched/(float) progressTotal, progressSearched, progressFound);
if (refreshQueue)
{
listBinding.ResetBindings(false);
refreshQueue = false;
}
foreach (Thread job in jobs)
{
if (job != null && job.IsAlive)
{
alive = true;
break;
}
alive = false;
}
}
}
catch (Exception exception)
{
if (exception.Message != "Operation Cancelled")
{
throw;
}
}
finally
{
progress.Finish();
if (dsParameters.Count > 0)
{
//btnSendProfile.Enabled = true;
}
for (int i = 0; i < jobs.Length; i++)
{
if (jobs[i] != null)
{
jobs[i].Abort();
}
}
}
}
示例15: Populate
//.........这里部分代码省略.........
Artist_Sort,
Album_Year,
AverageTempo,
Volume,
Preview_Volume,
AlbumArtPath,
AudioPath,
audioPreviewPath,
Track_No,
Author,
Version,
DLC_Name,
DLC_AppID,
Current_FileName,
Original_FileName,
Import_Path,
Import_Date,
Folder_Name,
File_Size,
File_Hash,
Original_File_Hash,
Is_Original,
Is_OLD,
Is_Beta,
Is_Alternate,
Is_Multitrack,
Is_Broken,
MultiTrack_Version,
Alternate_Version_No,
DLC,
Has_Bass,
Has_Guitar,
Has_Lead,
Has_Rhythm,
Has_Combo,
Has_Vocals,
Has_Sections,
Has_Cover,
Has_Preview,
Has_Custom_Tone,
Has_DD,
Has_Version,
Tunning,
Bass_Picking,
Tones,
Groups,
Rating,
Description,
Comments,
Has_Track_No,
Platform,
PreviewTime,
PreviewLenght,
Temp,
CustomForge_Followers,
CustomForge_Version,
Show_Available_Instruments,
Show_Alternate_Version,
Show_MultiTrack_Details,
Show_Group,
Show_Beta,
Show_Broken,
Show_DD,
Original,
Selected,
YouTube_Link,
CustomsForge_Link,
CustomsForge_Like,
CustomsForge_ReleaseNotes,
SignatureType,
ToolkitVersion,
Has_Author,
OggPath,
oggPreviewPath,
UniqueDLCName,
AlbumArt_Hash,
Audio_Hash,
audioPreview_Hash,
Bass_Has_DD,
Has_Bonus_Arrangement,
Artist_ShortName,
Album_ShortName,
Available_Old,
Available_Duplicate,
Has_Been_Corrected
}
);
bs.ResetBindings(false);
dssx.Tables["Main"].AcceptChanges();
bs.DataSource = dssx.Tables["Main"];
DataGridView.AutoGenerateColumns = false;
DataGridView.DataSource = null;
DataGridView.DataSource = bs;
DataGridView.AutoGenerateColumns = false;
DataGridView.Refresh();
//bs.Dispose();
dssx.Dispose();
//MessageBox.Show("-");
//DataGridView.ExpandColumns();
}