当前位置: 首页>>代码示例>>C#>>正文


C# CheckedListBox.Contains方法代码示例

本文整理汇总了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;
        }
开发者ID:ajrod,项目名称:Task-Manager,代码行数:73,代码来源:TaskDataBase.cs

示例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;
        }
开发者ID:smartphonequadrotor,项目名称:Windows-Controller-Software,代码行数:50,代码来源:SerialSendUtilityForm.cs


注:本文中的System.Windows.Forms.CheckedListBox.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。