Skip to content

Commit bd76c4b

Browse files
committed
Add Open Source Support notification
1 parent 4020d52 commit bd76c4b

File tree

8 files changed

+184
-11
lines changed

8 files changed

+184
-11
lines changed

ResXManager.View/Properties/Resources.Designer.cs

Lines changed: 32 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ResXManager.View/Properties/Resources.de.resx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Wollen Sie trotzdem einen neuen Eintrag hinzufügen?</value>
219219
<value>Diagnose</value>
220220
</data>
221221
<data name="DonateButtonToolTip" xml:space="preserve">
222-
<value>Unterstützen Sie die Open-Source Community</value>
222+
<value>Unterstützen sie dieses Projekt mit einer kleinen Spende</value>
223223
</data>
224224
<data name="EditDefaultConfigurationNotification" xml:space="preserve">
225225
<value>Sie bearbeiten die Standardeinstellungen. Wenn sie projektmappenspezifischen Einstellungen bearbeiten möchten öffnen sie eine Projektmappe.</value>
@@ -413,4 +413,22 @@ Z.B. ".* - (?!Migrations)" um EF Migrationsdateien auszublenden.</value>
413413
<data name="Configuration_EmptyValueHandlingHeader" xml:space="preserve">
414414
<value>Behandlung leerer Ressourceneinträge</value>
415415
</data>
416+
<data name="OpenSourceOverlay_Confirmation" xml:space="preserve">
417+
<value>Diesen Hinweis nicht mehr anzeigen.</value>
418+
</data>
419+
<data name="OpenSourceOverlay_Message" xml:space="preserve">
420+
<value>&lt;StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;
421+
&lt;TextBlock FontWeight="Bold" FontSize="20"&gt;
422+
Dies ist ein Open-Source-Projekt.
423+
&lt;/TextBlock&gt;&lt;Decorator Height="10"/&gt;&lt;TextBlock&gt;
424+
Als solches braucht es ihre Unterstützung, um es am Leben zu erhalten und weiteentwickelt werden zu können.
425+
&lt;/TextBlock&gt;&lt;Decorator Height="10"/&gt;&lt;TextBlock&gt;
426+
Der beste Weg, einen Beitrag zu leisten, ist mitzuhelfen &lt;Hyperlink NavigateUri = "https://github.com/tom-englert/ResXResourceManager/issues"&gt; Fehler zu beheben oder neue Funktionen hinzuzufügen.&lt;/Hyperlink&gt;
427+
&lt;/TextBlock&gt;&lt;Decorator Height="10"/&gt;&lt;TextBlock&gt;
428+
Sie können aber auch mit einer &lt;Hyperlink NavigateUri = "https://opencollective.com/resxresourcemanager"&gt;kleinen Spende&lt;/Hyperlink&gt; dazu Beitragen, dass der ResX&amp;#160;Resource&amp;#160;Manager ein großartiges Projekt bleibt, und Sie auch weiterhin bei Ihrer täglichen Arbeit unterstützen kann.
429+
&lt;/TextBlock&gt;&lt;Decorator Height="10"/&gt;&lt;TextBlock&gt;
430+
Ihr ResXManager-Team.
431+
&lt;/TextBlock&gt;
432+
&lt;/StackPanel&gt;</value>
433+
</data>
416434
</root>

ResXManager.View/Properties/Resources.resx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Do you want to add a new entry anyway?</value>
224224
<value>Diagnostics</value>
225225
</data>
226226
<data name="DonateButtonToolTip" xml:space="preserve">
227-
<value>Support the Open Source Community.</value>
227+
<value>Support this project with a donation</value>
228228
</data>
229229
<data name="EditDefaultConfigurationNotification" xml:space="preserve">
230230
<value>Your are editing the default configuration. If you want to change settings that apply only to a specific solution, just open the solution.</value>
@@ -422,4 +422,22 @@ Use e.g. ".* - (?!Migrations)" to hide EF migrations.</value>
422422
<data name="Configuration_EmptyValueHandlingHeader" xml:space="preserve">
423423
<value>Empty resource value handling</value>
424424
</data>
425+
<data name="OpenSourceOverlay_Message" xml:space="preserve">
426+
<value>&lt;StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;
427+
&lt;TextBlock FontWeight="Bold" FontSize="20"&gt;
428+
This is a community driven Open Source project.
429+
&lt;/TextBlock&gt;&lt;Decorator Height="10"/&gt;&lt;TextBlock&gt;
430+
As such it needs your support to keep it alive and evolving.
431+
&lt;/TextBlock&gt;&lt;Decorator Height="10"/&gt;&lt;TextBlock&gt;
432+
The best way to contribute is to help &lt;Hyperlink NavigateUri="https://github.com/tom-englert/ResXResourceManager/issues"&gt;fixing bugs, or adding new features.&lt;/Hyperlink&gt;
433+
&lt;/TextBlock&gt;&lt;Decorator Height="10"/&gt;&lt;TextBlock&gt;
434+
However, if you cannot help with coding, consider to &lt;Hyperlink NavigateUri="https://opencollective.com/resxresourcemanager"&gt;donate a small amount&lt;/Hyperlink&gt; to ensure ResX&amp;#160;Resource&amp;#160;Manager will continue to be a great project that can help you in your daily work.
435+
&lt;/TextBlock&gt;&lt;Decorator Height="10"/&gt;&lt;TextBlock&gt;
436+
Your ResXManager team.
437+
&lt;/TextBlock&gt;
438+
&lt;/StackPanel&gt;</value>
439+
</data>
440+
<data name="OpenSourceOverlay_Confirmation" xml:space="preserve">
441+
<value>Got it - do not show this notification again.</value>
442+
</data>
425443
</root>

ResXManager.View/Properties/Settings.Designer.cs

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ResXManager.View/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
<Setting Name="IsWrapLinesEnabled" Type="System.Boolean" Scope="User">
2727
<Value Profile="(Default)">False</Value>
2828
</Setting>
29+
<Setting Name="IsOpenSourceMessageConfirmed" Type="System.Boolean" Scope="User">
30+
<Value Profile="(Default)">False</Value>
31+
</Setting>
2932
</Settings>
3033
</SettingsFile>

ResXManager.View/Visuals/ResourceView.xaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,21 @@
323323
</MenuItem>
324324
</Menu>
325325
<Separator />
326-
<Button x:Name="LikeButton" ToolTip="{x:Static properties:Resources.LikeButtonToolTip}"
326+
<Button ToolTip="{x:Static properties:Resources.LikeButtonToolTip}"
327327
Tag="https://marketplace.visualstudio.com/items?itemName=TomEnglert.ResXManager#review-details">
328328
<Image SnapsToDevicePixels="True" Source="/ResXManager.View;component/Assets/like.png" />
329329
</Button>
330-
<Button x:Name="HelpButton" ToolTip="{x:Static properties:Resources.HelpButtonToolTip}"
330+
<Button ToolTip="{x:Static properties:Resources.DonateButtonToolTip}"
331+
Tag="https://opencollective.com/resxresourcemanager">
332+
<Grid>
333+
<Ellipse Width="16" Height="16" Fill="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
334+
<TextBlock Text="$" FontWeight="Bold" Foreground="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="1,0,0,2" />
335+
</Grid>
336+
</Button>
337+
<Button ToolTip="{x:Static properties:Resources.HelpButtonToolTip}"
331338
Tag="https://github.com/tom-englert/ResXResourceManager/wiki">
332339
<Grid Width="16" Height="16">
333-
<TextBlock Text="?" FontWeight="Bold" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center" />
340+
<TextBlock Text="?" FontWeight="Bold" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="1,0,0,2" />
334341
</Grid>
335342
</Button>
336343
</ToolBar>

ResXManager.View/Visuals/ShellView.xaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,50 @@
6262
</Button.Style>
6363
<Image SnapsToDevicePixels="True" Stretch="None" Source="/ResXManager.View;component/Assets/btn_donate_SM.gif" />
6464
</Button>
65+
<Grid MouseDown="OpenSourceOverlay_MouseDown" Loaded="OpenSourceOverlay_Loaded">
66+
<Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
67+
Opacity="0.5" />
68+
<Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
69+
Width="600" HorizontalAlignment="Center" VerticalAlignment="Center"
70+
BorderThickness="3" CornerRadius="5"
71+
BorderBrush="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Padding="5">
72+
<Grid>
73+
<StackPanel Margin="15">
74+
<Decorator Loaded="OpenSourceOverlayTextContainer_Loaded">
75+
<Decorator.Resources>
76+
<Style TargetType="TextBlock">
77+
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
78+
<Setter Property="FontSize" Value="16" />
79+
</Style>
80+
<Style TargetType="Hyperlink">
81+
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=NavigateUri}"></Setter>
82+
</Style>
83+
</Decorator.Resources>
84+
<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
85+
<TextBlock FontWeight="Bold" FontSize="20">This is a community driven Open Source project.</TextBlock>
86+
<Decorator Height="10"/>
87+
<TextBlock>As such it needs your support to keep it alive and evolving.</TextBlock>
88+
<Decorator Height="10"/>
89+
<TextBlock>The best way to contribute is to help <Hyperlink NavigateUri="https://github.com/tom-englert/ResXResourceManager/issues">fixing bugs, or adding new features.</Hyperlink></TextBlock>
90+
<Decorator Height="10"/>
91+
<TextBlock>However, if you cannot help with coding, consider to <Hyperlink NavigateUri="https://opencollective.com/resxresourcemanager">donate a small amount</Hyperlink> to ensure ResX Resource Manager will continue to be a great project that can help you in your daily work.</TextBlock>
92+
<Decorator Height="10"/>
93+
<TextBlock>Your ResXManager team.</TextBlock>
94+
</StackPanel>
95+
</Decorator>
96+
<Decorator Height="20" />
97+
<CheckBox Content="{x:Static properties:Resources.OpenSourceOverlay_Confirmation}"
98+
HorizontalAlignment="Left"
99+
IsChecked="{Binding IsOpenSourceMessageConfirmed, Source={x:Static properties:Settings.Default}}" />
100+
</StackPanel>
101+
<Path Width="12" Height="12" Data="M2,2 L10,10 M10,2 L2,10"
102+
HorizontalAlignment="Right" VerticalAlignment="Top"
103+
StrokeThickness="3" Opacity=".5"
104+
Stroke="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"
105+
/>
106+
</Grid>
107+
</Border>
108+
</Grid>
65109
</Grid>
66110

67111
</UserControl>

ResXManager.View/Visuals/ShellView.xaml.cs

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
using System;
44
using System.ComponentModel.Composition;
55
using System.ComponentModel.Composition.Hosting;
6-
using System.Diagnostics.Contracts;
76
using System.Globalization;
7+
using System.IO;
8+
using System.Text;
9+
using System.Windows;
10+
using System.Windows.Controls;
11+
using System.Windows.Input;
812
using System.Windows.Markup;
913

1014
using JetBrains.Annotations;
1115

1216
using tomenglertde.ResXManager.Infrastructure;
1317

18+
using TomsToolbox.Wpf;
1419
using TomsToolbox.Wpf.Composition;
1520

1621
/// <summary>
@@ -24,8 +29,6 @@ public partial class ShellView
2429
[ImportingConstructor]
2530
public ShellView([NotNull] ExportProvider exportProvider)
2631
{
27-
Contract.Requires(exportProvider != null);
28-
2932
try
3033
{
3134
this.SetExportProvider(exportProvider);
@@ -39,5 +42,43 @@ public ShellView([NotNull] ExportProvider exportProvider)
3942
exportProvider.TraceXamlLoaderError(ex);
4043
}
4144
}
45+
46+
private void OpenSourceOverlay_MouseDown([NotNull] object sender, MouseButtonEventArgs e)
47+
{
48+
((Grid)sender).Children.Clear();
49+
}
50+
51+
private void OpenSourceOverlay_Loaded([NotNull] object sender, RoutedEventArgs e)
52+
{
53+
if (Properties.Settings.Default.IsOpenSourceMessageConfirmed)
54+
{
55+
((Grid)sender).Children.Clear();
56+
}
57+
}
58+
59+
private void OpenSourceOverlayTextContainer_Loaded([NotNull] object sender, RoutedEventArgs e)
60+
{
61+
var container = (Decorator)sender;
62+
63+
container.BeginInvoke(() =>
64+
{
65+
if (!container.IsLoaded)
66+
return;
67+
68+
try
69+
{
70+
var xaml = Properties.Resources.OpenSourceOverlay_Message;
71+
72+
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(xaml)))
73+
{
74+
container.Child = (UIElement)XamlReader.Load(stream);
75+
}
76+
}
77+
catch (Exception ex)
78+
{
79+
// just go with the english default
80+
}
81+
});
82+
}
4283
}
4384
}

0 commit comments

Comments
 (0)