Exemplo n.º 1
0
        public static void Show(
            string clanTag,
            bool addShowFactionInformationMenuEntry)
        {
            var isCurrentClientFaction = clanTag == FactionSystem.ClientCurrentFactionClanTag;

            // create new context menu
            var menuItems = new List <MenuItem>();

            menuItems.Add(
                new MenuItem()
            {
                Header  = CoreStrings.Faction_CopyTag,
                Command = new ActionCommand(
                    () => Api.Client.Core.CopyToClipboard($"[{clanTag}]"))
            });

            if (addShowFactionInformationMenuEntry)
            {
                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Faction_ShowFactionInformation,
                    Command = new ActionCommand(
                        () => FactionDetailsControl.Show(clanTag))
                });
            }

            menuItems.Add(
                new MenuItem()
            {
                Header  = CoreStrings.Faction_PrivateMessageToLeader,
                Command = new ActionCommand(
                    () => FactionSystem.ClientOpenPrivateChatWithFactionLeader(clanTag))
            });

            if (FactionSystem.ClientHasFaction &&
                !isCurrentClientFaction &&
                FactionSystem.SharedIsDiplomacyFeatureAvailable &&
                FactionSystem.ClientHasAccessRight(FactionMemberAccessRights.DiplomacyManagement))
            {
                AddDiplomacyManagementMenuEntries(clanTag, menuItems);
            }

            ClientContextMenuHelper.ShowMenuOnClick("FactionContextMenu", menuItems);
        }