Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions SampleUserControlLibrary/SampleUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ public string SubscriptionKey
set;
}

public string AzureEnvironment
{
get;
set;
}

public SampleScenarios()
{
InitializeComponent();
Expand Down
5 changes: 5 additions & 0 deletions SampleUserControlLibrary/SubscriptionKeyPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
<Button Click="SaveKey_Click" Margin="5, 0, 0, 0" Padding="5, 0, 5, 0" VerticalAlignment="Center" >Save Key</Button>
<Button Click="DeleteKey_Click" Margin="5, 0, 0, 0" Padding="5, 0, 5, 0" VerticalAlignment="Center" >Delete Key</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top">
<Label VerticalAlignment="Center">Azure Environment:</Label>
<RadioButton GroupName="Environment" Margin="5, 0, 0, 0" Padding="5, 0, 5, 0" VerticalAlignment="Center" IsChecked="True" Checked="RadioButton_Checked">Global Azure</RadioButton>
<RadioButton GroupName="Environment" Margin="5, 0, 0, 0" Padding="5, 0, 5, 0" VerticalAlignment="Center" Checked="RadioButton_Checked">Mooncake - China Azure</RadioButton>
</StackPanel>
</StackPanel>
</Grid>
</Page>
29 changes: 29 additions & 0 deletions SampleUserControlLibrary/SubscriptionKeyPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public partial class SubscriptionKeyPage : Page, INotifyPropertyChanged
private readonly string _defaultSubscriptionKeyPromptMessage = "Paste your subscription key here to start";

private static string s_subscriptionKey;
private static string s_environment;

private SampleScenarios _sampleScenarios;
public SubscriptionKeyPage(SampleScenarios sampleScenarios)
Expand Down Expand Up @@ -78,6 +79,23 @@ public string SubscriptionKey
}
}

/// <summary>
/// Get or sets Azure Environment
/// </summary>
public string AzureEnvironment
{
get
{
return s_environment;
}

set
{
s_environment = value;
_sampleScenarios.AzureEnvironment = s_environment;
}
}

/// <summary>
/// Implement INotifyPropertyChanged interface
/// </summary>
Expand Down Expand Up @@ -186,5 +204,16 @@ private void GetKeyButton_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.microsoft.com/cognitive-services/en-us/sign-up");
}

private void RadioButton_Checked(object sender, RoutedEventArgs e)
{
var button = sender as RadioButton;

if (button.Content != null)
{
// s_environment = button.Content.ToString().ToLower();
AzureEnvironment = button.Content.ToString().ToLower();
}
}
}
}