Exemple #1
0
        public void ReportClipboardOperation(
            Deck deck, bool isPasted, bool isCollection,
            bool isAppended = false, bool isFromSearchResult = false)
        {
            if (deck == null)
            {
                return;
            }

            var zones            = new[] { Zone.Main, Zone.Side, Zone.Maybe, Zone.SampleHand };
            var cardsCount       = zones.SelectMany(_ => deck.GetZone(_).CountList).Sum();
            var uniqueCardsCount = zones.SelectMany(_ => deck.GetZone(_).Order).ToHashSet().Count;

            string target = isFromSearchResult
                                ? "Search result"
                                : isCollection
                                        ? "Collection"
                                        : "Deck";

            string count = uniqueCardsCount == cardsCount
                                ? $"{cardsCount}"
                                : $"{cardsCount} ({uniqueCardsCount} distinct)";

            string message;

            if (isAppended)
            {
                message = $"Added {count} cards from clipboard to {target}";
            }
            else if (isPasted)
            {
                message = $"Replaced {target} by {count} cards from clipboard";
            }
            else
            {
                message = $"Copied to clipboard {count} cards from {target}";
            }

            string title = $"{(isPasted ? "Paste" : "Copy")} result";

            TooltipController.ShowOneOffTooltip(_dropdownPaste, title, message);
        }