Example #1
0
        private void UserEditButton_Click(object sender, RoutedEventArgs e)
        {
            Button               button   = (Button)sender;
            UserDataModel        userData = (UserDataModel)button.DataContext;
            UserDataEditorWindow window   = new UserDataEditorWindow(userData);

            window.Closed += Window_Closed;
            window.Show();
        }
Example #2
0
        public static async Task ShowUserDialog(UserViewModel user)
        {
            if (user != null && !user.IsAnonymous)
            {
                object result = await DialogHelper.ShowCustom(new UserDialogControl(user));

                if (result != null)
                {
                    UserDialogResult dialogResult = EnumHelper.GetEnumValueFromString <UserDialogResult>(result.ToString());
                    switch (dialogResult)
                    {
                    case UserDialogResult.Purge:
                        await ChannelSession.Services.Chat.PurgeUser(user);

                        break;

                    case UserDialogResult.Timeout1:
                        await ChannelSession.Services.Chat.TimeoutUser(user, 60);

                        break;

                    case UserDialogResult.Timeout5:
                        await ChannelSession.Services.Chat.TimeoutUser(user, 300);

                        break;

                    case UserDialogResult.Ban:
                        if (await DialogHelper.ShowConfirmation(string.Format(Resources.BanUserPrompt, user.FullDisplayName)))
                        {
                            await ChannelSession.Services.Chat.BanUser(user);
                        }
                        break;

                    case UserDialogResult.Unban:
                        await ChannelSession.Services.Chat.UnbanUser(user);

                        break;

                    case UserDialogResult.PromoteToMod:
                        if (await DialogHelper.ShowConfirmation(string.Format(Resources.PromoteUserPrompt, user.FullDisplayName)))
                        {
                            await ChannelSession.Services.Chat.ModUser(user);
                        }
                        break;

                    case UserDialogResult.DemoteFromMod:
                        if (await DialogHelper.ShowConfirmation(string.Format(Resources.DemoteUserPrompt, user.FullDisplayName)))
                        {
                            await ChannelSession.Services.Chat.UnmodUser(user);
                        }
                        break;

                    case UserDialogResult.ChannelPage:
                        ProcessHelper.LaunchLink(user.ChannelLink);
                        break;

                    case UserDialogResult.EditUser:
                        UserDataEditorWindow window = new UserDataEditorWindow(user.Data);
                        await Task.Delay(100);

                        window.Show();
                        await Task.Delay(100);

                        window.Focus();
                        break;

                    case UserDialogResult.Close:
                    default:
                        // Just close
                        break;
                    }
                }
            }
        }
Example #3
0
        public static async Task ShowUserDialog(UserViewModel user)
        {
            if (user != null && !user.IsAnonymous)
            {
                object result = await DialogHelper.ShowCustom(new UserDialogControl(user));

                if (result != null)
                {
                    UserDialogResult dialogResult = EnumHelper.GetEnumValueFromString <UserDialogResult>(result.ToString());
                    switch (dialogResult)
                    {
                    case UserDialogResult.Purge:
                        await ChannelSession.Services.Chat.PurgeUser(user);

                        break;

                    case UserDialogResult.Timeout1:
                        await ChannelSession.Services.Chat.TimeoutUser(user, 60);

                        break;

                    case UserDialogResult.Timeout5:
                        await ChannelSession.Services.Chat.TimeoutUser(user, 300);

                        break;

                    case UserDialogResult.Ban:
                        if (await DialogHelper.ShowConfirmation(string.Format("This will ban the user {0} from this channel. Are you sure?", user.DisplayName)))
                        {
                            await ChannelSession.Services.Chat.BanUser(user);
                        }
                        break;

                    case UserDialogResult.Unban:
                        await ChannelSession.Services.Chat.UnbanUser(user);

                        break;

                    case UserDialogResult.Follow:
                        await ChannelSession.TwitchUserConnection.FollowUser(ChannelSession.TwitchUserNewAPI, user.GetTwitchNewAPIUserModel());

                        break;

                    case UserDialogResult.Unfollow:
                        await ChannelSession.TwitchUserConnection.UnfollowUser(ChannelSession.TwitchUserNewAPI, user.GetTwitchNewAPIUserModel());

                        break;

                    case UserDialogResult.PromoteToMod:
                        if (await DialogHelper.ShowConfirmation(string.Format("This will promote the user {0} to a moderator of this channel. Are you sure?", user.DisplayName)))
                        {
                            await ChannelSession.Services.Chat.ModUser(user);
                        }
                        break;

                    case UserDialogResult.DemoteFromMod:
                        if (await DialogHelper.ShowConfirmation(string.Format("This will demote the user {0} from a moderator of this channel. Are you sure?", user.DisplayName)))
                        {
                            await ChannelSession.Services.Chat.UnmodUser(user);
                        }
                        break;

                    case UserDialogResult.ChannelPage:
                        ProcessHelper.LaunchLink(user.ChannelLink);
                        break;

                    case UserDialogResult.EditUser:
                        UserDataModel userData = ChannelSession.Settings.GetUserData(user.ID);
                        if (userData != null)
                        {
                            UserDataEditorWindow window = new UserDataEditorWindow(userData);
                            await Task.Delay(100);

                            window.Show();
                            await Task.Delay(100);

                            window.Focus();
                        }
                        break;

                    case UserDialogResult.Close:
                    default:
                        // Just close
                        break;
                    }
                }
            }
        }
Example #4
0
        private async Task ShowUserDialog(UserViewModel user)
        {
            if (user != null && !user.IsAnonymous)
            {
                UserDialogResult result = await MessageBoxHelper.ShowUserDialog(user);

                switch (result)
                {
                case UserDialogResult.Purge:
                    await ChannelSession.Chat.PurgeUser(user.UserName);

                    break;

                case UserDialogResult.Timeout1:
                    await ChannelSession.Chat.TimeoutUser(user.UserName, 60);

                    break;

                case UserDialogResult.Timeout5:
                    await ChannelSession.Chat.TimeoutUser(user.UserName, 300);

                    break;

                case UserDialogResult.Ban:
                    if (await MessageBoxHelper.ShowConfirmationDialog(string.Format("This will ban the user {0} from this channel. Are you sure?", user.UserName)))
                    {
                        await ChannelSession.Chat.BanUser(user);
                    }
                    break;

                case UserDialogResult.Unban:
                    await ChannelSession.Chat.UnBanUser(user);

                    break;

                case UserDialogResult.Follow:
                    ExpandedChannelModel channelToFollow = await ChannelSession.Connection.GetChannel(user.UserName);

                    await ChannelSession.Connection.Follow(channelToFollow, ChannelSession.User);

                    break;

                case UserDialogResult.Unfollow:
                    ExpandedChannelModel channelToUnfollow = await ChannelSession.Connection.GetChannel(user.UserName);

                    await ChannelSession.Connection.Unfollow(channelToUnfollow, ChannelSession.User);

                    break;

                case UserDialogResult.PromoteToMod:
                    if (await MessageBoxHelper.ShowConfirmationDialog(string.Format("This will promote the user {0} to a moderator of this channel. Are you sure?", user.UserName)))
                    {
                        await ChannelSession.Chat.ModUser(user);
                    }
                    break;

                case UserDialogResult.DemoteFromMod:
                    if (await MessageBoxHelper.ShowConfirmationDialog(string.Format("This will demote the user {0} from a moderator of this channel. Are you sure?", user.UserName)))
                    {
                        await ChannelSession.Chat.UnModUser(user);
                    }
                    break;

                case UserDialogResult.MixerPage:
                    Process.Start($"https://mixer.com/{user.UserName}");
                    break;

                case UserDialogResult.EditUser:
                    UserDataEditorWindow window = new UserDataEditorWindow(ChannelSession.Settings.UserData[user.ID]);
                    await Task.Delay(100);

                    window.Show();
                    await Task.Delay(100);

                    window.Focus();
                    break;

                case UserDialogResult.Close:
                default:
                    // Just close
                    break;
                }
            }
        }