Beispiel #1
0
        private void GatherRomsComplete(AsyncTaskData taskData)
        {
            var args           = (RomDiscoveryData)taskData;
            var discoveredRoms = args.NewRoms;
            var addedRoms      = Model.AddNewItemsFromList(discoveredRoms, args.InsertLocation);

            if (addedRoms.Any())
            {
                var collectionChanged = CollectionChanged;
                if (collectionChanged != null)
                {
                    collectionChanged(this, new System.Collections.Specialized.NotifyCollectionChangedEventArgs(System.Collections.Specialized.NotifyCollectionChangedAction.Add, addedRoms as System.Collections.IList));
                }
                if (args.SelectNewRoms)
                {
                    CurrentSelection.Clear();
                    var addedItemIndexes = addedRoms.Select(r => Programs.ModelCollection.IndexOf(r));
                    foreach (var addedRomIndex in addedItemIndexes)
                    {
                        var programViewModel = Programs[addedRomIndex];
                        CurrentSelection.Add(programViewModel);
                    }
                }
                SaveRomList(true);
            }
            Model.EndAddRomsFromFiles(args.DuplicateRomPaths);
            if (taskData.Error != null)
            {
                OSMessageBox.Show(Resources.Strings.AddRomsErrorMessage, Resources.Strings.AddRomsErrorTitle, taskData.Error, null);
            }
        }
Beispiel #2
0
        public void DeselectAll()
        {
            foreach (var item in RenderingEngine.CurrentProject.Items)
            {
                item.IsSelected = false;
            }
            CurrentSelection.Clear();

            foreach (var item in RenderingEngine.CurrentProject.Connections)
            {
                item.IsSelected = false;
            }
            CurrentSelectionConnection.Clear();
        }
        private void RemoveSelectionArea()
        {
            // Deselect current selection
            var currentHotbarSelection = GameSystems.UI.gameplayLayer.selectionHotbar.CurrentSelection;

            if (currentHotbarSelection != null)
            {
                // Update the view
                currentHotbarSelection.Selected = false;
            }

            // Clear the selection
            CurrentSelection.Clear();
            CurrentSelection = null;
        }
        public void OnSelectGroup(InputAction.CallbackContext context)
        {
            if (shiftIsPressed)
            {
                return;
            }

            switch (context.phase)
            {
            case InputActionPhase.Performed:
                var index = context.ReadValue <float>().Round();

                CurrentSelection?.Clear();
                CurrentSelection = GameSystems.UI.gameplayLayer.selectionHotbar.Select(index);
                break;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Clears selection.
        /// </summary>
        /// <param name="bNotify">True if notification of this change is required. False if this is an internal clear command.</param>
        public void ClearSelection(bool bNotify)
        {
            if (CurrentSelection.Count == 0)
            {
                return;
            }

            for (int i = CurrentSelection.Count - 1; i >= 0; i--)
            {
                CurrentSelection[i].IsSelected = false;
            }
            CurrentSelection.Clear();

            if (bNotify)
            {
                Notify();
            }
        }
        public void RemoveImages(object sender, object args)
        {
            var count = CurrentSelection.Count;

            for (int i = 0; i < count; i++)
            {
                AlbumImages.Remove(CurrentSelection[0]);
            }
            if (CurrentSelection.Count != 0)
            {
                CurrentSelection.Clear();
            }
            var cover = AlbumImages.FirstOrDefault(i => i.Id == CoverImage.Id);

            if (cover == null)
            {
                CoverImage = AlbumImages[0];
            }
        }
        private void OnEndSelectionArea()
        {
            if (IsSelectingArea)
            {
                // Clear the current selection
                CurrentSelection?.Clear();

                // Update selection builder
                var worldPoint = Systems.Input.MouseWorldPoint;
                selectionBuilder.UpdateSelection(worldPoint);

                // Hide the selection area overlay
                GameSystems.UI.gameplayLayer.selectionArea.Hide();

                // Get the selection and save it in the hotbar if possible
                var selection = selectionBuilder.Build();

                CurrentSelection = selection;
                selectionBuilder = null;
            }
        }
Beispiel #8
0
        /// <summary>
        /// Clears selection.
        /// </summary>
        /// <param name="bNotify">True if notification of this change is required. False if this is an internal clear command.</param>
        public void ClearSelection(bool bNotify)
        {
            if (CurrentSelection.Count == 0)
            {
                return;
            }

            List <ISelectable> temp = new List <ISelectable>();

            temp.AddRange(CurrentSelection);

            for (int i = temp.Count - 1; i >= 0; i--)
            {
                temp[i].IsSelected = false;
            }
            CurrentSelection.Clear();

            if (bNotify)
            {
                Notify();
            }
        }
 internal void ClearSelection()
 {
     CurrentSelection.ForEach(item => item.IsSelected = false);
     CurrentSelection.Clear();
 }