Exemple #1
0
            public userConextMenu(ChatMessage parent) : base()
            {
                this.Items.Add(new MenuItem()
                {
                    Header = "Open profile"
                });

                if (!FriendList.Exists(parent.Nickname))
                {
                    this.Items.Add(new MenuItem()
                    {
                        Header = "Add to friend list"
                    });
                    ((MenuItem)Items[1]).Click += (o, e) =>
                    {
                        App.FriendList.Add(parent.Nickname);

                        //osu_chat.MainWindow.friends.Add(await osu_chat.MainWindow.GetChatUser(parent.Nickname));
                    };
                }
                else
                {
                    this.Items.Add(new MenuItem()
                    {
                        Header = "Remove from friend list"
                    });
                    ((MenuItem)Items[1]).Click += (o, e) =>
                    {
                        App.FriendList.Remove(parent.Nickname);

                        //osu_chat.MainWindow.friends.Remove(osu_chat.MainWindow.friends.Where(u => u.Nickname == parent.Nickname).First());
                    };
                }

                if (!IgnoreList.Exists(parent.Nickname))
                {
                    this.Items.Add(new MenuItem()
                    {
                        Header = "Add to ignore list"
                    });
                    ((MenuItem)Items[2]).Click += (o, e) =>
                    {
                        IgnoreList.Add(parent.Nickname);

                        //osu_chat.MainWindow.ignoredUser.Add(await osu_chat.MainWindow.GetChatUser(parent.Nickname));
                    };
                }
                else
                {
                    this.Items.Add(new MenuItem()
                    {
                        Header = "Remove from ignore list"
                    });
                    ((MenuItem)Items[2]).Click += (o, e) =>
                    {
                        IgnoreList.Remove(parent.Nickname);
                    };
                }


                ((MenuItem)Items[0]).Click += async(o, e) =>
                {
                    // zameniti na user id
                    Process.Start(string.Format("http://osu.ppy.sh/u/{0}", (await Osu.Api.GetUserAsync(ApiKey, parent.Nickname)).UserId));
                };
            }