本文整理汇总了C#中System.Windows.Forms.CheckedListBox.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# CheckedListBox.Contains方法的具体用法?C# CheckedListBox.Contains怎么用?C# CheckedListBox.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.CheckedListBox
的用法示例。
在下文中一共展示了CheckedListBox.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AcceptTask
/// <summary>
/// Returns true if the task passes the current filters selected.
/// </summary>
/// <param name="activeFilters">The active filters.</param>
/// <param name="task">The task.</param>
/// <returns>True iff the task passes the current filters selected.</returns>
private bool AcceptTask(CheckedListBox.CheckedItemCollection activeFilters, Task task)
{
if (activeFilters.Contains("All") || activeFilters.Contains(task.tag))
{
return true;
}
else if (activeFilters.Contains("Today") && task.date.Date == System.DateTime.Today)
{
return true;
}
else if (activeFilters.Contains("Next 3 Days")
&& (task.date.Date <= System.DateTime.Today.AddDays(3))
&& task.date.Date >= System.DateTime.Today)
{
return true;
}
else if (activeFilters.Contains("Next 5 Days")
&& (task.date.Date <= System.DateTime.Today.AddDays(5))
&& task.date.Date >= System.DateTime.Today)
{
return true;
}
else if (activeFilters.Contains("Current Month") && task.date.Month == System.DateTime.Today.Month)
{
return true;
}
else if (activeFilters.Contains("Current Week"))
{
int offset = GetDayOfTheWeekOffset();
if (task.date.Date >= System.DateTime.Today.AddDays(-offset).Date
&& task.date.Date <= System.DateTime.Today.AddDays(6 - offset).Date)
{
return true;
}
}
else if (activeFilters.Contains("Next Week"))
{
int offset = GetDayOfTheWeekOffset();
if (task.date.Date >= System.DateTime.Today.AddDays(-offset + 7).Date
&& task.date.Date <= System.DateTime.Today.AddDays(6 - offset + 7).Date)
{
return true;
}
}
else if (activeFilters.Contains("Completed") && task.completed)
{
if (activeFilters.Count == 1)
{
return true;
}
else
{
return true;
}
}
else if (activeFilters.Contains("Not Completed") && !task.completed)
{
return true;
}
else if (activeFilters.Contains("Over Due") && !task.completed && task.date.Date < System.DateTime.Today.Date)
{
return true;
}
return false;
}
示例2: changeMotors
private string changeMotors(CheckedListBox.CheckedItemCollection c)
{
string binaryString;
if (c.Contains("Motor 4"))
{
binaryString = "1";
changingMotors[0] = 1;
}
else
{
binaryString = "0";
changingMotors[0] = 0;
}
if (c.Contains("Motor 3"))
{
binaryString += "1";
changingMotors[1] = 1;
}
else
{
binaryString += "0";
changingMotors[1] = 0;
}
if (c.Contains("Motor 2"))
{
binaryString += "1";
changingMotors[2] = 1;
}
else
{
binaryString += "0";
changingMotors[2] = 0;
}
if (c.Contains("Motor 1"))
{
binaryString += "1";
changingMotors[3] = 1;
}
else
{
binaryString += "0";
changingMotors[3] = 0;
}
return binaryString;
}