Skip to content

Commit 17be61c

Browse files
authored
Merge pull request #192 from richardlawley/addshownotificaions
Thank you for your PR! This looks good to go.
2 parents 5bc0c5e + b9228b4 commit 17be61c

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

src/Papercut.UI/App.config

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
<setting name="LoggingPaths" serializeAs="String">
5959
<value>%ApplicationData%\Changemaker Studios\Papercut SMTP;%ApplicationData%\Papercut;%BaseDirectory%\Logs;%AppDataDirectory%\Logs</value>
6060
</setting>
61+
<setting name="ShowNotifications" serializeAs="String">
62+
<value>True</value>
63+
</setting>
6164
</Papercut.Properties.Settings>
6265
</userSettings>
6366
<runtime>

src/Papercut.UI/AppLayer/UiCommands/UiCommandHub.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ public void ShowOptionWindow()
6868

6969
public void ShowBalloonTip(int timeout, string tipTitle, string tipText, ToolTipIcon toolTipIcon)
7070
{
71-
var command = new ShowBalloonTipCommand(timeout, tipTitle, tipText, toolTipIcon);
72-
this._onShowBalloonTip.OnNext(command);
71+
if (Papercut.Properties.Settings.Default.ShowNotifications)
72+
{
73+
var command = new ShowBalloonTipCommand(timeout, tipTitle, tipText, toolTipIcon);
74+
this._onShowBalloonTip.OnNext(command);
75+
}
7376
}
7477

7578
protected override void Dispose(bool disposing)

src/Papercut.UI/Properties/Settings.Designer.cs

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Papercut.UI/Properties/Settings.settings

+3
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,8 @@
5050
<Setting Name="LoggingPaths" Type="System.String" Scope="User">
5151
<Value Profile="(Default)">%ApplicationData%\Changemaker Studios\Papercut SMTP;%ApplicationData%\Papercut;%BaseDirectory%\Logs;%AppDataDirectory%\Logs</Value>
5252
</Setting>
53+
<Setting Name="ShowNotifications" Type="System.Boolean" Scope="User">
54+
<Value Profile="(Default)">True</Value>
55+
</Setting>
5356
</Settings>
5457
</SettingsFile>

src/Papercut.UI/ViewModels/OptionsViewModel.cs

+12
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ public class OptionsViewModel : Screen
6464
private ThemeColor _themeColor;
6565

6666
string _windowTitle = WindowTitleDefault;
67+
68+
private bool _showNotifications;
6769

6870
public OptionsViewModel(IMessageBus messageBus, ThemeColorRepository themeColorRepository)
6971
{
@@ -155,6 +157,16 @@ public bool MinimizeToTray
155157
}
156158
}
157159

160+
public bool ShowNotifications
161+
{
162+
get => this._showNotifications;
163+
set
164+
{
165+
this._showNotifications = value;
166+
this.NotifyOfPropertyChange(() => this.ShowNotifications);
167+
}
168+
}
169+
158170
public bool StartMinimized
159171
{
160172
get => this._startMinimized;

src/Papercut.UI/Views/OptionsView.xaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
1212
mc:Ignorable="d"
1313
d:DataContext="{x:Type ViewModels:OptionsViewModel}"
14-
Title="{Binding WindowTitle}" Width="313" Height="290" Icon="/Papercut;component/App.ico"
14+
Title="{Binding WindowTitle}" Width="313" Height="310" Icon="/Papercut;component/App.ico"
1515
WindowStyle="ToolWindow"
1616
ResizeMode="NoResize"
1717
ShowIconOnTitleBar="false" WindowStartupLocation="CenterOwner"
@@ -36,6 +36,7 @@
3636
<RowDefinition Height="Auto" />
3737
<RowDefinition Height="Auto" />
3838
<RowDefinition Height="Auto" />
39+
<RowDefinition Height="Auto" />
3940
</Grid.RowDefinitions>
4041
<Label Grid.Column="0" Grid.Row="0" Margin="0,2,0,29" Grid.RowSpan="2">IP Address:</Label>
4142
<Label Grid.Column="0" Grid.Row="1" Margin="0,2,10,0" Grid.RowSpan="3">Port:</Label>
@@ -48,6 +49,7 @@
4849
<CheckBox Grid.Column="1" Grid.Row="4" Margin="5,0,5,-116" Name="RunOnStartup" VerticalAlignment="Bottom"
4950
Content="Run on startup" Grid.ColumnSpan="2" Height="18" />
5051
<CheckBox Grid.Row="4" Margin="5,0,5,-47" Name="StartMinimized" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Height="18" Grid.Column="1">Start minimized</CheckBox>
52+
<CheckBox Grid.Row="5" Margin="5,0,5,-139" Name="ShowNotifications" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Height="18" Grid.Column="1">Show Notifications</CheckBox>
5153
<CheckBox Grid.Column="1" Grid.Row="4" Margin="5,0,5,-93" Name="MinimizeOnClose" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Height="18">Minimize on close</CheckBox>
5254
<ComboBox Grid.Column="1" Grid.Row="4" Margin="2.4,2.6,0,7.4"
5355
x:Name="SortOrders" SelectedItem="{Binding MessageListSortOrder}" HorizontalAlignment="Left" Width="170" Grid.ColumnSpan="2">

0 commit comments

Comments
 (0)