Skip to content

Commit 9785a15

Browse files
committed
update msi, notifications, browser opening
1 parent bbfd220 commit 9785a15

16 files changed

+578
-9
lines changed

skiffWindowsApp/Skiff Desktop/App.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
xmlns:local="clr-namespace:Skiff_Desktop"
55
StartupUri="MainWindow.xaml">
66
<Application.Resources>
7-
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="pack://application:,,,/ToastNotifications.Messages;component/Themes/Default.xaml" />
10+
</ResourceDictionary.MergedDictionaries>
11+
</ResourceDictionary>
812
</Application.Resources>
913
</Application>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<core:NotificationDisplayPart x:Class="CustomNotificationsExample.CustomCommand.CustomCommandDisplayPart"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:CustomNotificationsExample.CustomCommand"
7+
xmlns:core="clr-namespace:ToastNotifications.Core;assembly=ToastNotifications"
8+
mc:Ignorable="d"
9+
d:DesignHeight="60" d:DesignWidth="250" Background="WhiteSmoke"
10+
d:DataContext="{d:DesignInstance local:CustomCommandNotification, IsDesignTimeCreatable=False}" >
11+
<Border BorderThickness="1" BorderBrush="LightGray">
12+
<Grid>
13+
<Grid.RowDefinitions>
14+
<RowDefinition />
15+
<RowDefinition />
16+
</Grid.RowDefinitions>
17+
<TextBlock Grid.Row="0" Text="{Binding Message}" FontWeight="Bold" Foreground="Black" />
18+
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
19+
<Button Content="Confirm" Width="60" Margin="2" IsDefault="True" Command="{Binding ConfirmCommand}" />
20+
<Button Content="Decline" Width="60" Margin="2" IsCancel="True" Command="{Binding DeclineCommand}" />
21+
</StackPanel>
22+
</Grid>
23+
</Border>
24+
</core:NotificationDisplayPart>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using ToastNotifications.Core;
2+
3+
namespace CustomNotificationsExample.CustomCommand
4+
{
5+
/// <summary>
6+
/// Interaction logic for CustomCommandDisplayPart.xaml
7+
/// </summary>
8+
public partial class CustomCommandDisplayPart : NotificationDisplayPart
9+
{
10+
public CustomCommandDisplayPart(CustomCommandNotification notification)
11+
{
12+
InitializeComponent();
13+
Bind(notification);
14+
}
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using ToastNotifications;
3+
using ToastNotifications.Core;
4+
5+
namespace CustomNotificationsExample.CustomCommand
6+
{
7+
public static class CustomCommandExtensions
8+
{
9+
public static void ShowCustomCommand(this Notifier notifier,
10+
string message,
11+
Action<CustomCommandNotification> confirmAction,
12+
Action<CustomCommandNotification> declineAction,
13+
MessageOptions messageOptions = null)
14+
{
15+
notifier.Notify(() => new CustomCommandNotification(message, confirmAction, declineAction, messageOptions));
16+
}
17+
}
18+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using CustomNotificationsExample.Utilities;
2+
using System;
3+
using System.ComponentModel;
4+
using System.Runtime.CompilerServices;
5+
using System.Windows.Input;
6+
using ToastNotifications.Core;
7+
8+
namespace CustomNotificationsExample.CustomCommand
9+
{
10+
public class CustomCommandNotification : NotificationBase, INotifyPropertyChanged
11+
{
12+
private CustomCommandDisplayPart _displayPart;
13+
14+
private Action<CustomCommandNotification> _confirmAction;
15+
private Action<CustomCommandNotification> _declineAction;
16+
17+
public ICommand ConfirmCommand { get; set; }
18+
public ICommand DeclineCommand { get; set; }
19+
20+
public CustomCommandNotification(string message,
21+
Action<CustomCommandNotification> confirmAction,
22+
Action<CustomCommandNotification> declineAction,
23+
MessageOptions messageOptions)
24+
: base(message, messageOptions)
25+
{
26+
Message = message;
27+
_confirmAction = confirmAction;
28+
_declineAction = declineAction;
29+
30+
ConfirmCommand = new RelayCommand(x => _confirmAction(this));
31+
DeclineCommand = new RelayCommand(x => _declineAction(this));
32+
}
33+
34+
public override NotificationDisplayPart DisplayPart => _displayPart ?? (_displayPart = new CustomCommandDisplayPart(this));
35+
36+
#region binding properties
37+
38+
private string _message;
39+
40+
public string Message
41+
{
42+
get
43+
{
44+
return _message;
45+
}
46+
set
47+
{
48+
_message = value;
49+
OnPropertyChanged();
50+
}
51+
}
52+
53+
public event PropertyChangedEventHandler PropertyChanged;
54+
55+
protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
56+
{
57+
var handler = PropertyChanged;
58+
if (handler != null)
59+
handler.Invoke(this, new PropertyChangedEventArgs(propertyName));
60+
}
61+
#endregion
62+
}
63+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using ToastNotifications;
3+
using ToastNotifications.Core;
4+
5+
namespace CustomNotificationsExample.CustomInput
6+
{
7+
public static class CustomInputExtensions
8+
{
9+
public static void ShowCustomInput(this Notifier notifier,
10+
string message,
11+
MessageOptions messageOptions = null)
12+
{
13+
notifier.Notify(() => new CustomInputNotification(message, message, messageOptions));
14+
}
15+
}
16+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<core:NotificationDisplayPart x:Class="CustomNotificationsExample.CustomInput.CustomInputDisplayPart"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:core="clr-namespace:ToastNotifications.Core;assembly=ToastNotifications"
7+
xmlns:customInput="clr-namespace:CustomNotificationsExample.CustomInput"
8+
mc:Ignorable="d"
9+
d:DesignHeight="60" d:DesignWidth="250" Background="WhiteSmoke"
10+
d:DataContext="{d:DesignInstance customInput:CustomInputNotification, IsDesignTimeCreatable=False}" >
11+
<Border BorderThickness="1" BorderBrush="LightGray">
12+
<Grid>
13+
<Grid.RowDefinitions>
14+
<RowDefinition />
15+
<RowDefinition />
16+
<RowDefinition />
17+
</Grid.RowDefinitions>
18+
<TextBlock Grid.Row="0" Text="{Binding Message}" FontWeight="Bold" Foreground="Black" />
19+
20+
<TextBox Grid.Row="1" Text="{Binding InputText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
21+
22+
<TextBlock Grid.Row="2" Text="{Binding InputText}" />
23+
</Grid>
24+
</Border>
25+
</core:NotificationDisplayPart>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using ToastNotifications.Core;
2+
3+
namespace CustomNotificationsExample.CustomInput
4+
{
5+
/// <summary>
6+
/// Interaction logic for CustomCommandDisplayPart.xaml
7+
/// </summary>
8+
public partial class CustomInputDisplayPart : NotificationDisplayPart
9+
{
10+
public CustomInputDisplayPart(CustomInputNotification notification)
11+
{
12+
InitializeComponent();
13+
Bind(notification);
14+
}
15+
}
16+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using CustomNotificationsExample.Utilities;
2+
using System;
3+
using System.ComponentModel;
4+
using System.Runtime.CompilerServices;
5+
using System.Windows.Input;
6+
using ToastNotifications.Core;
7+
8+
namespace CustomNotificationsExample.CustomInput
9+
{
10+
public class CustomInputNotification : NotificationBase, INotifyPropertyChanged
11+
{
12+
private CustomInputDisplayPart _displayPart;
13+
14+
public CustomInputNotification(string message, string initialText, MessageOptions messageOptions) : base(message, messageOptions)
15+
{
16+
Message = message;
17+
InputText = initialText;
18+
}
19+
20+
public override NotificationDisplayPart DisplayPart => _displayPart ?? (_displayPart = new CustomInputDisplayPart(this));
21+
22+
#region binding properties
23+
24+
private string _message;
25+
26+
public string Message
27+
{
28+
get
29+
{
30+
return _message;
31+
}
32+
set
33+
{
34+
_message = value;
35+
OnPropertyChanged();
36+
}
37+
}
38+
39+
private string _inputText;
40+
41+
public string InputText
42+
{
43+
get
44+
{
45+
return _inputText;
46+
}
47+
set
48+
{
49+
_inputText = value;
50+
OnPropertyChanged();
51+
}
52+
}
53+
54+
public event PropertyChangedEventHandler PropertyChanged;
55+
56+
protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
57+
{
58+
var handler = PropertyChanged;
59+
if (handler != null)
60+
handler.Invoke(this, new PropertyChangedEventArgs(propertyName));
61+
}
62+
#endregion
63+
}
64+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<core:NotificationDisplayPart x:Class="CustomNotificationsExample.CustomMessage.CustomDisplayPart"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:CustomNotificationsExample.CustomMessage"
7+
xmlns:core="clr-namespace:ToastNotifications.Core;assembly=ToastNotifications"
8+
mc:Ignorable="d" Background="#292929"
9+
Width="360" MinWidth="360" Height="110" ClipToBounds="True"
10+
HorizontalAlignment="Left">
11+
<Grid Margin="12">
12+
<Grid.RowDefinitions>
13+
<RowDefinition Height="Auto" />
14+
<RowDefinition Height="Auto" />
15+
<RowDefinition Height="*" />
16+
</Grid.RowDefinitions>
17+
18+
<!-- Header with logo, app name, and close button -->
19+
<Grid Grid.Row="0" Background="#292929" HorizontalAlignment="Stretch">
20+
<Grid.ColumnDefinitions>
21+
<ColumnDefinition Width="Auto" />
22+
<ColumnDefinition Width="*" />
23+
<ColumnDefinition Width="Auto" />
24+
</Grid.ColumnDefinitions>
25+
26+
<!-- Icon -->
27+
<Image Grid.Column="0" Source="/logo.png" Width="24" Height="24" Margin="0,0,10,0"/>
28+
29+
<!-- App Name -->
30+
<TextBlock Grid.Column="1" Text="Skiff Desktop" VerticalAlignment="Center" FontSize="16" FontWeight="Normal" Foreground="White"
31+
LineHeight="20" TextTrimming="CharacterEllipsis" />
32+
33+
<!-- Close Button -->
34+
<Button Grid.Column="2" Content="" Background="#292929" Foreground="White" BorderThickness="0" Padding="5" Command="{Binding CloseCommand}" />
35+
</Grid>
36+
37+
<!-- Title -->
38+
<TextBlock Grid.Row="1" Text="{Binding Title}" FontWeight="Normal" Foreground="White" FontSize="16" Margin="0,8"
39+
LineHeight="19" TextTrimming="CharacterEllipsis" />
40+
41+
<!-- Message -->
42+
<TextBlock Grid.Row="2" Text="{Binding Message}" FontWeight="Normal" Foreground="#A9A9A9" FontSize="16"
43+
LineHeight="19" TextTrimming="CharacterEllipsis" />
44+
</Grid>
45+
</core:NotificationDisplayPart>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using ToastNotifications.Core;
2+
3+
namespace CustomNotificationsExample.CustomMessage
4+
{
5+
/// <summary>
6+
/// Interaction logic for CustomDisplayPart.xaml
7+
/// </summary>
8+
public partial class CustomDisplayPart : NotificationDisplayPart
9+
{
10+
public CustomDisplayPart(CustomNotification customNotification)
11+
{
12+
InitializeComponent();
13+
Bind(customNotification);
14+
}
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using ToastNotifications;
2+
using ToastNotifications.Core;
3+
4+
namespace CustomNotificationsExample.CustomMessage
5+
{
6+
public static class CustomMessageExtensions
7+
{
8+
public static void ShowCustomMessage(this Notifier notifier,
9+
string title,
10+
string message,
11+
MessageOptions messageOptions = null)
12+
{
13+
notifier.Notify(() => new CustomNotification(title, message, messageOptions));
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)