예제 #1
0
 private async Task <bool> EstablishConnection(IEnumerable <OAuthClientScopeEnum> scopes, string channelName = null)
 {
     return(await this.RunAsyncOperation(async() =>
     {
         return await ChannelSession.ConnectUser(scopes, channelName);
     }));
 }
예제 #2
0
        private async void StreamerLoginButton_Click(object sender, RoutedEventArgs e)
        {
            bool result = false;

            await this.RunAsyncOperation(async() =>
            {
                if (this.ExistingStreamerComboBox.Visibility == Visibility.Visible)
                {
                    if (this.ExistingStreamerComboBox.SelectedIndex >= 0)
                    {
                        StreamerLoginItem loginItem = (StreamerLoginItem)this.ExistingStreamerComboBox.SelectedItem;
                        IChannelSettings setting    = loginItem.Setting;
                        if (setting.Channel.id == 0)
                        {
                            result = await this.NewStreamerLogin();
                        }
                        else
                        {
                            result = await ChannelSession.ConnectUser(setting);
                            if (result)
                            {
                                if (!await ChannelSession.ConnectBot(setting))
                                {
                                    await MessageBoxHelper.ShowMessageDialog("Bot Account failed to authenticate, please re-connect it from the Services section.");
                                }

                                MainWindow window = new MainWindow();
                                this.Hide();
                                window.Show();
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        await MessageBoxHelper.ShowMessageDialog("You must select a Streamer account to log in to");
                    }
                }
                else
                {
                    result = await this.NewStreamerLogin();
                }
            });

            if (!result)
            {
                await MessageBoxHelper.ShowMessageDialog("Unable to authenticate with Mixer, please try again");
            }
        }
예제 #3
0
        private async Task <bool> ExistingSettingLogin(SettingsV3Model setting)
        {
            Result result = await ChannelSession.ConnectUser(setting);

            if (result.Success)
            {
                if (await ChannelSession.InitializeSession())
                {
                    return(true);
                }
            }
            else
            {
                await DialogHelper.ShowMessage(result.Message);
            }
            return(false);
        }
        private async Task <bool> ExistingSettingLogin(IChannelSettings setting)
        {
            bool result = await ChannelSession.ConnectUser(setting);

            if (result)
            {
                if (!await ChannelSession.ConnectBot(setting))
                {
                    await MessageBoxHelper.ShowMessageDialog("Bot Account failed to authenticate, please re-connect it from the Services section.");
                }
            }
            else
            {
                await MessageBoxHelper.ShowMessageDialog("Unable to authenticate with Mixer, please try again");
            }
            return(result);
        }