示例#1
0
 public ExcludedItemsForm(ExcludedItems e, DB db)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     ex = e;
     InitializeComponent();
     refreshList();
 }
 public ExcludedItemsForm(ExcludedItems e, DB db)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     ex = e;
     InitializeComponent();
     refreshList();
 }
示例#3
0
    private void Btn_candidate_OnMouseEnter(object sender, MouseEventArgs e)
    {
        ButtonModel model = ((Button)sender).DataContext as ButtonModel;

        if (model != null && model.IsCurrentTarget && !ExcludedItems.Contains(model.ButtonNumber))
        {
            model.IsReached = true;
            ExcludedItems.Add(model.ButtonNumber);
        }
    }
 public NewExcludedItem(ExcludedItems ex)
 {
     exc=ex;
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     //
     // TODO: Add constructor code after the InitializeComponent() call.
     //
 }
 public NewExcludedItem(ExcludedItems ex)
 {
     exc = ex;
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     //
     // TODO: Add constructor code after the InitializeComponent() call.
     //
 }
示例#6
0
    private int GetNextTarget()
    {
        if (ExcludedItems.Count == BTN_NUMBERS)
        {
            return(-1);
        }
        var target = _rnd.Next(0, BTN_NUMBERS);

        if (ExcludedItems.Contains(target))
        {
            return(GetNextTarget());
        }
        return(target);
    }
        public virtual Expression <Func <TResult, bool> > Build()
        {
            var ruleExpression = RuleParser.GetQueryExpression <TResult, RuleContext>(Conditions);

            var predicate = ruleExpression ?? PredicateBuilder.True <TResult>();

            if (ValidTemplates.Any())
            {
                var orPredicate = PredicateBuilder.True <TResult>();
                orPredicate = ValidTemplates.Aggregate(orPredicate, (current, templateId) => current.Or(item => item.TemplateId == templateId));

                predicate = predicate.And(orPredicate);
            }

            predicate = ExcludedItems.Aggregate(predicate, (current, excludedId) => current.And(item => item.ItemId != excludedId));

            if (!string.IsNullOrEmpty(Location))
            {
                predicate = predicate.And(item => item.Path.StartsWith(Location));
            }

            return(predicate);
        }
示例#8
0
        public DirectoryEntryCollection GetContent()
        {
            List <DirectoryEntry> entries = new List <DirectoryEntry>();

            if (!Directory.Exists(DirectoryPath))
            {
                return(new DirectoryEntryCollection(""));
            }

            var dirInfo = new DirectoryInfo(DirectoryPath);

            foreach (FileSystemInfo entry in dirInfo.GetFileSystemInfos("*", SearchOption.AllDirectories))
            {
                int    time        = (int)(entry.LastWriteTimeUtc - (new DateTime(2010, 1, 1))).TotalDays;
                bool   isDirectory = entry is DirectoryInfo;
                string content;
                if (isDirectory)
                {
                    content = "";
                }
                else
                {
                    content = File.ReadAllText(entry.FullName);
                }

                string fileName = entry.FullName.Substring((dirInfo.FullName + "/").Length);

                if (ExcludedItems == null || !ExcludedItems.IsMatch(fileName))
                {
                    entries.Add(new DirectoryEntry(fileName, isDirectory, time, content));
                }
            }

            DirectoryEntryCollection entryCollection = new DirectoryEntryCollection(entries.ToArray());

            return(entryCollection);
        }
    /// <summary>
    /// Fills dropdown with data.
    /// </summary>
    /// <param name="parentID">Identifier of node which children you want to add</param>
    /// <param name="level">Level of indentation</param>
    private void FillDropDown(int parentID, int level)
    {
        if (GroupedCategories != null)
        {
            List <DataRowView> gCategory = GroupedCategories.GetGroup(parentID);
            if (gCategory != null)
            {
                var categoryTypeInfo = CategoryInfo.TypeInfo;

                foreach (DataRowView drCategory in gCategory)
                {
                    if (!ExcludedItems.Contains(ValidationHelper.GetInteger(drCategory[categoryTypeInfo.IDColumn], 0)))
                    {
                        string name       = ResHelper.LocalizeString(drCategory[CategoryInfo.Generalized.DisplayNameColumn].ToString());
                        int    categoryId = ValidationHelper.GetInteger(drCategory[categoryTypeInfo.IDColumn], 0);

                        List <DataRowView> objectGroup        = ((!ShowEmptyCategories || ShowObjects) && GroupedObjects != null) ? GroupedObjects.GetGroup(drCategory[categoryTypeInfo.IDColumn]) : null;
                        List <DataRowView> childCategoryGroup = !ShowEmptyCategories?GroupedCategories.GetGroup(categoryId) : null;

                        // Check for empty categories except the root
                        if ((level == 0) || ShowEmptyCategories || ((objectGroup != null) && (objectGroup.Count > 0)) || ((childCategoryGroup != null) && (childCategoryGroup.Count > 0)))
                        {
                            bool enabled = true;

                            // Resolve Enabled condition
                            if (!String.IsNullOrEmpty(EnabledCondition))
                            {
                                MacroResolver.SetAnonymousSourceData(drCategory);
                                enabled = ValidationHelper.GetBoolean(MacroResolver.ResolveMacros(EnabledCondition), true);
                            }

                            string indentation = String.Empty;

                            if ((level > 0) || ShowRoot)
                            {
                                // Create indentation for specified level
                                indentation = String.Concat(Enumerable.Repeat(SubItemPrefix, ShowRoot ? level : level - 1));

                                string value = ((level == 0) && (RootValue > 0) ? RootValue : categoryId).ToString();

                                // Prevent category list item to be selected by ID when selecting object
                                if (ShowObjects)
                                {
                                    value = "cat_" + value;
                                }

                                // Insert category
                                ListItem listItem = new ListItem(indentation + ResHelper.LocalizeString(name), value);
                                if (ShowObjects || DisabledItems.Contains(categoryId) || !enabled)
                                {
                                    listItem.Attributes.Add("style", DisabledItemStyle);
                                    listItem.Attributes.Add("disabled", "disabled");
                                }
                                else
                                {
                                    if (!firstItem && String.IsNullOrEmpty(mSelectedValue))
                                    {
                                        SetItem(parentID, value);
                                    }
                                }
                                drpCategory.Items.Add(listItem);
                            }

                            // Go deeper
                            FillDropDown(categoryId, level + 1);

                            // Insert all child objects if needed
                            if (ShowObjects && !DataHelper.DataSourceIsEmpty(objectGroup))
                            {
                                if (objectGroup != null)
                                {
                                    indentation += SubItemPrefix;
                                    foreach (DataRowView childObject in objectGroup)
                                    {
                                        string text     = indentation + ResHelper.LocalizeString(childObject[ObjectInfo.Generalized.DisplayNameColumn].ToString());
                                        string objValue = childObject[ObjectInfo.TypeInfo.IDColumn].ToString();
                                        drpCategory.Items.Add(new ListItem(text, objValue));

                                        if (!firstItem && String.IsNullOrEmpty(mSelectedValue))
                                        {
                                            SetItem(parentID, objValue);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }