Skip to content

Commit bc7c512

Browse files
Adjusted Input View and UWP-Text-Template
1 parent 04ef961 commit bc7c512

5 files changed

Lines changed: 22 additions & 13 deletions

File tree

EventHub.RestClientGenerator/Styles/Label.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
33
<Style TargetType="Label">
44
<Setter Property="Foreground" Value="#DDDDDD"/>
5+
<Setter Property="VerticalAlignment" Value="Center"/>
56
</Style>
67
</ResourceDictionary>

EventHub.RestClientGenerator/UwpTextTemplate/EventHubClientTemplate.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ public virtual string TransformText()
3030
{
3131
this.Write("using System;\r\nusing System.Net.Http;\r\nusing System.Text;\r\nusing System.Threading" +
3232
".Tasks;\r\n\r\nnamespace YourNamespace\r\n{\r\n public class EventHubClient\r\n {\r\n c" +
33-
"onst string SharedAccessSignature = ");
33+
"onst string SharedAccessSignature = \"");
3434

3535
#line 15 "D:\temp2\EventHub.RestClientGenerator\EventHub.RestClientGenerator\UwpTextTemplate\EventHubClientTemplate.tt"
3636
this.Write(this.ToStringHelper.ToStringWithCulture(SharedAccessSignature));
3737

3838
#line default
3939
#line hidden
40-
this.Write(";\r\n const string Url = ");
40+
this.Write("\";\r\n const string EventHubRestUri = \"");
4141

4242
#line 16 "D:\temp2\EventHub.RestClientGenerator\EventHub.RestClientGenerator\UwpTextTemplate\EventHubClientTemplate.tt"
4343
this.Write(this.ToStringHelper.ToStringWithCulture(EventHubRestUri));
4444

4545
#line default
4646
#line hidden
47-
this.Write(@"
47+
this.Write(@""";
4848
public async Task<bool> PostDataAsync(string jsonObjectToSend)
4949
{
5050
var httpClient = new HttpClient();
@@ -54,7 +54,7 @@ public async Task<bool> PostDataAsync(string jsonObjectToSend)
5454
var content = new StringContent(jsonObjectToSend, Encoding.UTF8, ""application/json"");
5555
content.Headers.Add(""ContentType"", ""application/json"");
5656
57-
var result = await httpClient.PostAsync(url, content);
57+
var result = await httpClient.PostAsync(EventHubRestUri, content);
5858
5959
return result.IsSuccessStatusCode;
6060
}

EventHub.RestClientGenerator/UwpTextTemplate/EventHubClientTemplate.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ namespace YourNamespace
1212
{
1313
public class EventHubClient
1414
{
15-
const string SharedAccessSignature = <#=SharedAccessSignature#>;
16-
const string Url = <#=EventHubRestUri#>
15+
const string SharedAccessSignature = "<#=SharedAccessSignature#>";
16+
const string EventHubRestUri = "<#=EventHubRestUri#>";
1717
public async Task<bool> PostDataAsync(string jsonObjectToSend)
1818
{
1919
var httpClient = new HttpClient();
@@ -23,7 +23,7 @@ namespace YourNamespace
2323
var content = new StringContent(jsonObjectToSend, Encoding.UTF8, "application/json");
2424
content.Headers.Add("ContentType", "application/json");
2525

26-
var result = await httpClient.PostAsync(url, content);
26+
var result = await httpClient.PostAsync(EventHubRestUri, content);
2727

2828
return result.IsSuccessStatusCode;
2929
}

EventHub.RestClientGenerator/View/InputView.xaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,21 @@
2121
</Grid.ColumnDefinitions>
2222
<TextBlock Grid.ColumnSpan="5" Text="Input" Background="#007ACC" Foreground="White" FontWeight="Bold" Padding="5"/>
2323

24-
<Label Grid.Row="1" Content="Event Hub Connection String"/>
24+
<Label Grid.Row="1">
25+
<TextBlock>Event Hub<LineBreak/>Connection String</TextBlock></Label>
2526
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Text="{Binding ConnectionString,UpdateSourceTrigger=PropertyChanged}" Height="50" TextWrapping="Wrap"/>
2627

27-
<Label Grid.Row="2" Content="Device name (optional)"/>
28-
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding PublisherName,UpdateSourceTrigger=PropertyChanged}" />
29-
30-
<Label Grid.Row="2" Grid.Column="2" Content="Token Lifetime"/>
31-
<DockPanel Grid.Row="2" Grid.Column="3">
28+
<Label Grid.Row="2" Content="Token Lifetime"/>
29+
<DockPanel Grid.Row="2" Grid.Column="1">
3230
<ComboBox DockPanel.Dock="Right" Margin="5" Background="Black"
3331
ItemsSource="{Binding TokenLifeTimeUnits}"
3432
SelectedItem="{Binding TokenLifeTimeUnit,Mode=TwoWay}" Width="70"/>
3533
<TextBox Text="{Binding TokenLifeTime,UpdateSourceTrigger=PropertyChanged}" />
3634
</DockPanel>
35+
36+
37+
<Label Grid.Row="2" Grid.Column="2" Content="Publisher/Device name (optional)"/>
38+
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding PublisherName,UpdateSourceTrigger=PropertyChanged}" />
39+
3740
</Grid>
3841
</UserControl>

EventHub.RestClientGenerator/ViewModel/MainViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ private void GenerateOutput()
134134
ConnectionDetails = null;
135135
_connectionString = "";
136136
OnPropertyChanged(nameof(ConnectionString));
137+
if(_errorsByPropertyName.ContainsKey(nameof(ConnectionString)))
138+
{
139+
_errorsByPropertyName.Remove(nameof(ConnectionString));
140+
OnErrorsChanged(nameof(ConnectionString));
141+
}
137142
}
138143
else
139144
{

0 commit comments

Comments
 (0)