Exemplo n.º 1
0
        private void WorldMapScene_SelectionChanged(object sender, EventArgs e)
        {
            unlockRoutesNormal.Clear();
            unlockRoutesSecret.Clear();

            if (SelectedObjects.Count == 1 && SelectedObjects.First() is WorldMapPoint point)
            {
                if (pointCsv.TryGetValue(point.BoneName, out string[] entry))
Exemplo n.º 2
0
        void CreateExtendActionMenus()
        {
            ClearExtendActionMenus();

            if (ChartContextMenuStrip == null || SelectedObjects.Length != 1)
            {
                return;
            }

            var mindex = ExtendActionMenuIndex;

            if (mindex < 0 || mindex >= ChartContextMenuStrip.Items.Count)
            {
                mindex = ChartContextMenuStrip.Items.Count;
            }


            var so = SelectedObjects.First();

            if (so is IExtendActionProvider)
            {
                var ep = (IExtendActionProvider)so;
                CreateExtendActionMenus(ep.GetExtendActions(ReadOnly), ref mindex);
            }

            //
            CreateExtendActionMenus(GetExtendActions(), ref mindex);

            // separators
            if (!ExtendActionItems.IsEmpty())
            {
                var min = ChartContextMenuStrip.Items.IndexOf(ExtendActionItems.First());
                var max = ChartContextMenuStrip.Items.IndexOf(ExtendActionItems.Last());

                if (max < ChartContextMenuStrip.Items.Count - 1 && !(ChartContextMenuStrip.Items[max + 1] is ToolStripSeparator))
                {
                    var tss = new ToolStripSeparator();
                    ChartContextMenuStrip.Items.Insert(max, tss);
                    ExtendActionItems.Add(tss);
                }

                if (min > 0 && !(ChartContextMenuStrip.Items[min - 1] is ToolStripSeparator))
                {
                    var tss = new ToolStripSeparator();
                    ChartContextMenuStrip.Items.Insert(min, tss);
                    ExtendActionItems.Add(tss);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Selects the given nodes.
        /// </summary>
        /// <param name="items"></param>
        private void SetSelectedObjects(IEnumerable <Item> items)
        {
            // Updates selection
            SelectedObjects = items == null ? new List <Item>() : new List <Item>(items);

            // Selects the proper nodes
            if (SelectedObjects.Count() == 1)
            {
                // If the object is not already selected
                Item obj = SelectedObjects.First();
                tvItems.SelectNodeWithTag(obj);
            }

            // Notify subscribers
            SelectionChanged?.ThreadSafeInvoke(this, new EventArgs());
        }