コード例 #1
0
        private async void LogInBotButton_Click(object sender, RoutedEventArgs e)
        {
            bool result = await this.groupBoxControl.window.RunAsyncOperation(async() =>
            {
                TestStreamSettingsModel testStreamSettings = await ChannelSession.Connection.GetTestStreamSettings(ChannelSession.Channel);
                if (testStreamSettings != null && testStreamSettings.isActive.GetValueOrDefault())
                {
                    if (!await MessageBoxHelper.ShowConfirmationDialog("Because test stream settings are enabled, your bot account will not be able to connect correctly. You will need to disable Test Streams in order to use your bot account for things such a chat messages & whispers. Are you sure you still wish to connect it?"))
                    {
                        return(false);
                    }
                }
                return(await ChannelSession.ConnectBot());
            });

            if (!result)
            {
                await MessageBoxHelper.ShowMessageDialog("Unable to authenticate Bot with Mixer. Please ensure you approved access for the application in a timely manner.");
            }
            else
            {
                this.NewBotLoginGrid.Visibility = Visibility.Collapsed;
                this.ExistingBotGrid.Visibility = Visibility.Visible;

                this.BotLoggedInNameTextBlock.Text = ChannelSession.BotUser.username;
                if (!string.IsNullOrEmpty(ChannelSession.BotUser.avatarUrl))
                {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                    this.BotProfileAvatar.SetUserAvatarUrl(ChannelSession.BotUser.id);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                }

                this.SetCompletedIcon(visible: true);
            }
        }
コード例 #2
0
        public void GetTestStreamSettings()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                PrivatePopulatedUserModel user = await connection.Users.GetCurrentUser();

                Assert.IsNotNull(user);
                Assert.IsTrue(user.id > 0);

                TestStreamSettingsModel testStreamSettings = await connection.TestStreams.GetSettings(user.channel);

                Assert.IsNotNull(testStreamSettings);
                Assert.IsTrue(testStreamSettings.id > 0);
            });
        }
コード例 #3
0
 /// <summary>
 /// Updates the test stream settings for the specified channel.
 /// </summary>
 /// <param name="channel">The channel to update test stream settings for</param>
 /// <param name="settings">The test stream settings to set for the channel</param>
 /// <returns>The updated test stream settings for the specified channel</returns>
 public async Task <TestStreamSettingsModel> UpdateSettings(ChannelModel channel, TestStreamSettingsModel settings)
 {
     Validator.ValidateVariable(channel, "channel");
     Validator.ValidateVariable(settings, "settings");
     return(await this.PutAsync <TestStreamSettingsModel>("testStreams/" + channel.id, this.CreateContentFromObject(settings)));
 }