本文整理汇总了C#中BindingList.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.RemoveAt方法的具体用法?C# BindingList.RemoveAt怎么用?C# BindingList.RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.RemoveAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IssueEditorViewModel
public IssueEditorViewModel()
{
if (GitHubApi.Repository != null)
_repository = GitHubApi.Repository.Repository;
Assignees = new BindingList<User>();
Labels = new BindingList<LabelModel>();
foreach (var label in GitHubApi.Labels)
Labels.Add(new LabelModel(label));
Milestones = new BindingList<Milestone>();
foreach (var milestone in GitHubApi.Milestones)
Milestones.Add(milestone);
// The lists contain non-items
if (Labels.Count > 0) Labels.RemoveAt(0);
if (Milestones.Count > 0) Milestones.RemoveAt(0);
if (Milestones.Count > 0) Milestones.RemoveAt(0);
SaveCommand = new RelayCommand(Save, p => CanSave());
CancelCommand = new RelayCommand(Cancel, p => true);
ClearAssigneeCommand = new RelayCommand(p => Assignee = null, p => Assignee != null);
ClearMilestoneCommand = new RelayCommand(p => Milestone = null, p => Milestone != null);
SetLabelsCommand = new RelayCommand(SetLabels, p => true);
CloseLabelPickerCommand = new RelayCommand(CloseLabelPicker, p => true);
}
示例2: RemoveBlankAttributesFromList
private static void RemoveBlankAttributesFromList(BindingList<WebAnnotationModel.ObjAttribute> list)
{
for(int i = list.Count -1; i >= 0; i--)
{
WebAnnotationModel.ObjAttribute item = list[i];
if(item.Name == null)
{
list.RemoveAt(i);
continue;
}
if (item.Name.Length == 0)
{
list.RemoveAt(i);
continue;
}
}
return;
}
示例3: MoveEncodersDown
private void MoveEncodersDown(DataGridView grid, BindingList<DisplaySoftwareEncoder> list)
{
DataGridViewSelectedRowCollection srows = grid.SelectedRows;
List<int> indices = new List<int>();
if (srows.Count == 0)
{
return;
}
// Juggle rows...
for (int i = srows.Count - 1; i >= 0; i--)
{
int index = srows[i].Index;
indices.Add(index);
if (index < grid.Rows.Count - 1)
{
list[index].Priority = (Convert.ToInt32(list[index].Priority) + 1).ToString();
list[index + 1].Priority = (Convert.ToInt32(list[index + 1].Priority) - 1).ToString();
DisplaySoftwareEncoder item = list[index + 1];
list.RemoveAt(index + 1);
list.Insert(index, item);
}
}
// Maintain selection...
grid.ClearSelection();
for (int i = indices.Count - 1; i >= 0; i--)
{
int index = indices[i];
if (index == grid.Rows.Count - 1)
{
grid.Rows[index].Selected = true;
}
else
{
grid.Rows[index + 1].Selected = true;
}
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Guid sessionId = (Guid)Session["sessionId"];
// user = new DbUser();
user = service.DisplayProfile(sessionId);
//trap the selected item
if (LBAddedSkills.SelectedIndex > -1)
{
removeSelectedItem = LBAddedSkills.SelectedItem.ToString();
}
if(LBExisitingSkills.SelectedIndex > -1)
{
addedSelectedItem = LBExisitingSkills.SelectedItem.ToString();
}
//refill the bidinglist
//add the trapped item to the bindinglist
#region Postback
if (!Page.IsPostBack)
{
//newlyAddedSkills;
//EditPanel.Visible = false;
ViewProfilePanel.Visible = true;
EditPanel.Visible = false;
//Fill the View and Edit Profile labels and TextBox fields
TxtBoxFname.Text = user.FirstName;
VPFirstNameLbl.Text = user.FirstName;
TxtBoxLName.Text = user.LastName;
VPLastNameLbl.Text = user.LastName;
TxtBoxEmail.Text = user.Email;
VPEmailLbl.Text = user.Email;
TxtBoxDegree.Text = user.Degree;
VPPDegreeLbl.Text = user.Degree;
TxtBoxLocation.Text = user.Location;
VPLocLbl.Text = user.Location;
TxtBoxModules.Text = user.Modules;
VPModulesLbl.Text = user.Modules;
//Fill the ComboBox for Status and Stream
FillDropDownLists();
CmbBoxStatus.SelectedValue = user.TStatus;
VPStatusLbl.Text = user.TStatus;
CmbBoxStream.SelectedValue = user.Stream;
VpStreamLbl.Text = user.Stream;
//Add theImage for the Consultant
Add_Image();
//Fill the user existing skills fields
userId = int.Parse(Session["userid"].ToString());
userExistingSkills = new BindingList<string>(service.GetUserSkills(userId));
LBAddedSkills.DataSource = userExistingSkills;
LBAddedSkills.DataBind();
//Fill the List of available skills from the database
dbExistingSkills = new BindingList<string>(service.DisplaySkills());
//Get rid of the skills already added for the user
for (int i = 0; i < dbExistingSkills.Count; i++)
{
foreach (string j in userExistingSkills)
{
if (j == dbExistingSkills[i])
{
dbExistingSkills.RemoveAt(i);
}
}
}
LBExisitingSkills.DataSource = dbExistingSkills;
LBExisitingSkills.DataBind();
}
#endregion
userId = int.Parse(Session["userid"].ToString());
userExistingSkills = new BindingList<string>(service.GetUserSkills(userId));
VPSkillsLB.DataSource = userExistingSkills;
VPSkillsLB.DataBind();
Label14.Text = "";
Label13.Text = "";
}
示例5: DamageTableTN
//.........这里部分代码省略.........
if (DamagePerColumn >= Penetration)
{
HalfSpread = (int)((float)(Spread + 1) / 2.0f);
/// <summary>
/// 100 is the arbitrary midpoint for the damage template for the time being, and two is added to spread value every iteration of this
/// while loop.
/// </summary>
for (int loop = (HitPoint - HalfSpread); loop <= (HitPoint + HalfSpread); loop++)
{
DamageTemplate[loop] = (ushort)(DamageTemplate[loop] + (ushort)Penetration);
RemainingDamage = RemainingDamage - Penetration;
}
Spread = Spread + 2;
}
else
{
int BasePerColumn = (int)Math.Floor(DamagePerColumn);
HalfSpread = (int)((float)(Spread + 1) / 2.0f);
if (BasePerColumn > 0)
{
for (int loop = (HitPoint - HalfSpread); loop <= (HitPoint + HalfSpread); loop++)
{
DamageTemplate[loop] = (ushort)(DamageTemplate[loop] + (ushort)BasePerColumn);
RemainingDamage = RemainingDamage - BasePerColumn;
}
}
for (int loop = (HitPoint - HalfSpread); loop <= (HitPoint + HalfSpread); loop++)
{
DamageTemplate[loop] = (ushort)(DamageTemplate[loop] + 1);
RemainingDamage = RemainingDamage - 1;
if (RemainingDamage == 0)
break;
}
}
}
}
else
{
/// <summary>
/// Plasma damage has to be handled a little differently from beams,particle weapons, and missiles. Penetration value is effectively 1/2, and damage to armor spreads out more.
/// </summary>
int RemainingDamage = DamageTotal;
if (RemainingDamage == 1)
{
DamageTemplate[HitPoint] = 1;
RemainingDamage = 0;
}
else
{
DamageTemplate[HitPoint] = 1;
DamageTemplate[HitPoint + 1] = 1;
RemainingDamage = RemainingDamage - 2;
Spread = 2;
while (RemainingDamage != 0)
{
HalfSpread = Spread / 2;
for (int loop = HalfSpread; loop >= 0; loop--)
{
DamageTemplate[HitPoint - loop] = (ushort)(DamageTemplate[HitPoint - loop] + (ushort)1);
RemainingDamage = RemainingDamage - 1;
if (RemainingDamage == 0)
break;
DamageTemplate[HitPoint + loop + 1] = (ushort)(DamageTemplate[HitPoint + loop + 1] + (ushort)1);
RemainingDamage = RemainingDamage - 1;
if (RemainingDamage == 0)
break;
}
Spread = Spread + 2;
}
}
}
/// <summary>
/// Remove the excess 0s from the template.
/// </summary>
int limit = DamageTemplate.Count;
for (int loop = limit - 1; loop >= 0; loop--)
{
if (DamageTemplate[loop] == 0)
{
DamageTemplate.RemoveAt(loop);
if (loop < HitPoint)
HitPoint--;
}
}
}