Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Show Notifications Option #192

Merged
Merged
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
3 changes: 3 additions & 0 deletions src/Papercut.UI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
<setting name="MessagePaths" serializeAs="String">
<value>%ApplicationData%\Changemaker Studios\Papercut SMTP;%ApplicationData%\Papercut;%BaseDirectory%\Incoming;%DataDirectory%\Incoming</value>
</setting>
<setting name="ShowNotifications" serializeAs="String">
<value>True</value>
</setting>
</Papercut.Properties.Settings>
</userSettings>
<runtime>
Expand Down
7 changes: 5 additions & 2 deletions src/Papercut.UI/AppLayer/UiCommands/UiCommandHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ public void ShowOptionWindow()

public void ShowBalloonTip(int timeout, string tipTitle, string tipText, ToolTipIcon toolTipIcon)
{
var command = new ShowBalloonTipCommand(timeout, tipTitle, tipText, toolTipIcon);
this._onShowBalloonTip.OnNext(command);
if (Papercut.Properties.Settings.Default.ShowNotifications)
{
var command = new ShowBalloonTipCommand(timeout, tipTitle, tipText, toolTipIcon);
this._onShowBalloonTip.OnNext(command);
}
}

protected override void Dispose(bool disposing)
Expand Down
14 changes: 13 additions & 1 deletion src/Papercut.UI/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Papercut.UI/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
<Setting Name="MessagePaths" Type="System.String" Scope="User">
<Value Profile="(Default)">%ApplicationData%\Changemaker Studios\Papercut SMTP;%ApplicationData%\Papercut;%BaseDirectory%\Incoming;%DataDirectory%\Incoming</Value>
</Setting>
<Setting Name="ShowNotifications" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
12 changes: 12 additions & 0 deletions src/Papercut.UI/ViewModels/OptionsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public class OptionsViewModel : Screen
private ThemeColor _themeColor;

string _windowTitle = WindowTitleDefault;

private bool _showNotifications;

public OptionsViewModel(IMessageBus messageBus, ThemeColorRepository themeColorRepository)
{
Expand Down Expand Up @@ -155,6 +157,16 @@ public bool MinimizeToTray
}
}

public bool ShowNotifications
{
get => this._showNotifications;
set
{
this._showNotifications = value;
this.NotifyOfPropertyChange(() => this.ShowNotifications);
}
}

public bool StartMinimized
{
get => this._startMinimized;
Expand Down
4 changes: 3 additions & 1 deletion src/Papercut.UI/Views/OptionsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
mc:Ignorable="d"
d:DataContext="{x:Type ViewModels:OptionsViewModel}"
Title="{Binding WindowTitle}" Width="313" Height="290" Icon="/Papercut;component/App.ico"
Title="{Binding WindowTitle}" Width="313" Height="310" Icon="/Papercut;component/App.ico"
WindowStyle="ToolWindow"
ResizeMode="NoResize"
ShowIconOnTitleBar="false" WindowStartupLocation="CenterOwner"
Expand All @@ -36,6 +36,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Margin="0,2,0,29" Grid.RowSpan="2">IP Address:</Label>
<Label Grid.Column="0" Grid.Row="1" Margin="0,2,10,0" Grid.RowSpan="3">Port:</Label>
Expand All @@ -48,6 +49,7 @@
<CheckBox Grid.Column="1" Grid.Row="4" Margin="5,0,5,-116" Name="RunOnStartup" VerticalAlignment="Bottom"
Content="Run on startup" Grid.ColumnSpan="2" Height="18" />
<CheckBox Grid.Row="4" Margin="5,0,5,-47" Name="StartMinimized" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Height="18" Grid.Column="1">Start minimized</CheckBox>
<CheckBox Grid.Row="5" Margin="5,0,5,-139" Name="ShowNotifications" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Height="18" Grid.Column="1">Show Notifications</CheckBox>
<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>
<ComboBox Grid.Column="1" Grid.Row="4" Margin="2.4,2.6,0,7.4"
x:Name="SortOrders" SelectedItem="{Binding MessageListSortOrder}" HorizontalAlignment="Left" Width="170" Grid.ColumnSpan="2">
Expand Down