コード例 #1
0
        protected override void SetContextItemAvailability()
        {
            base.SetContextItemAvailability();

            if (ClickedNode != null)
            {
                if (ClickedNode.Tag != null && IsFileNode(ClickedNode))
                {
                    _contextOpenMergedFile.Available = _contextOpenMergedFileDir.Available = true;
                }

                if (!IsCategoryNode(ClickedNode))
                {
                    _contextDeleteMerge.Available = _contextDeleteSeparator.Available = true;
                    if (IsModNode(ClickedNode))
                    {
                        _contextDeleteAssociatedMerges.Available = true;
                        _contextDeleteAssociatedMerges.Text      = $"Delete All {ClickedNode.Text} Merges";
                    }
                }
            }
            else if (!this.IsEmpty())
            {
                ContextSelectAll.Available = CategoryNodes.Any(catNode => !catNode.Checked);

                ContextDeselectAll.Available = FileNodes.Any(fileNode => fileNode.Checked);
            }
        }
コード例 #2
0
        protected override void SetContextItemAvailability()
        {
            base.SetContextItemAvailability();

            if (ClickedNode != null)
            {
                if (IsModNode(ClickedNode))
                {
                    _contextCustomLoadOrderSeparator.Available = true;
                    _contextPrioritizeMod.Available            = true;

                    foreach (var item in ContextNodeRegion.Items.Cast <ToolStripItem>())
                    {
                        item.Enabled = Program.LoadOrder.IsValid;
                    }

                    var isDisabled = Program.LoadOrder.IsModDisabledByName(ClickedNode.Text);

                    _contextToggleMod.Available = true;
                    _contextToggleMod.Text      =
                        isDisabled
                        ? "Enable Mod"
                        : "Disable Mod";

                    _contextRemoveFromCustomLoadOrder.Available = Program.LoadOrder.ContainsMod(ClickedNode.Text);
                    _contextRemoveFromCustomLoadOrder.Text      =
                        isDisabled
                        ? "Clear Priority && Disabled State"
                        : "Clear Priority";
                }
            }
            else if (!this.IsEmpty())
            {
                ContextSelectAll.Available = CategoryNodes.Any(catNode => !catNode.Checked && (catNode.Tag as ModFileCategory).IsSupported);

                ContextDeselectAll.Available = ModNodes.Any(modNode => modNode.Checked);
            }
        }