Ejemplo 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);
        }
Ejemplo n.º 2
0
        private void MouseUpHandler(object sender, MouseEventArgs e)
        {
            if (!this.IsHitTestVisible)
            {
                return;
            }

            var menuItems     = new List <MenuItem>();
            var chatEntryFrom = this.viewModel.ChatEntry.From;

            var canMentionOrSendPrivateMessage =
                this.viewModel.VisibilityCanMentionOrSendPrivateMessage == Visibility.Visible;

            if (canMentionOrSendPrivateMessage)
            {
                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Chat_MessageMenu_Mention,
                    Command = this.viewModel.CommandMention
                });
            }

            menuItems.Add(
                new MenuItem()
            {
                Header  = CoreStrings.Copy,
                Command = this.viewModel.CommandCopy
            });

            if (!string.IsNullOrEmpty(this.viewModel.ChatEntry.From))
            {
                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Chat_MessageMenu_CopyName,
                    Command = this.viewModel.CommandCopyName
                });
            }

            if (canMentionOrSendPrivateMessage)
            {
                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Chat_MessageMenu_PrivateMessage,
                    Command = this.viewModel.CommandOpenPrivateChat
                });
            }

            if (PartySystem.ClientCanInvite(chatEntryFrom))
            {
                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Chat_MessageMenu_InviteToParty,
                    Command = this.viewModel.CommandInviteToParty
                });
            }

            if (FactionSystem.ClientCanInviteToFaction(chatEntryFrom))
            {
                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Faction_InviteToFaction,
                    Command = this.viewModel.CommandInviteToFaction
                });
            }

            if (this.viewModel.VisibilityCanBlock == Visibility.Visible)
            {
                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Chat_MessageMenu_Block,
                    Command = this.viewModel.CommandToggleBlock
                });

                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Chat_MessageMenu_Report,
                    Command = this.viewModel.CommandReport
                });
            }

            if (this.viewModel.VisibilityCanUnblock == Visibility.Visible)
            {
                menuItems.Add(
                    new MenuItem()
                {
                    Header  = CoreStrings.Chat_MessageMenu_Unblock,
                    Command = this.viewModel.CommandToggleBlock
                });
            }

            ClientContextMenuHelper.ShowMenuOnClick(this, menuItems);
        }