Skip to content

Commit

Permalink
sample for issue #72
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafał Łopatka committed Aug 12, 2018
1 parent 6c3d7fd commit 22d4c50
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
<HintPath>..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath>
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.6.5.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MahApps.Metro.1.6.5\lib\net45\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
Expand Down
9 changes: 8 additions & 1 deletion Src/Examples/CustomNotificationsExample/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
xmlns:local="clr-namespace:CustomNotificationsExample"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
mc:Ignorable="d"
Title="MainWindow" Height="90" Width="500">
Title="MainWindow" Height="600" Width="800">
<Grid>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<Button Content="Custom message" Margin="5" Padding="5" Click="CustomMessage_Click"/>
<Button Content="Custom command" Margin="5" Padding="5" Click="CustomCommand_Click"/>
<Button Content="Custom input" Margin="5" Padding="5" Click="CustomInput_Click"/>
<Button Content="MahApps command" Margin="5" Padding="5" Click="MahApps_Click"/>
<Button Content="Show child window" Margin="5" Padding="5" Click="Show_ChildWindow">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="Show child window" Click="Show_ChildWindow" />
</ContextMenu>
</Button.ContextMenu>
</Button>
</StackPanel>
</Grid>
</Controls:MetroWindow>
8 changes: 7 additions & 1 deletion Src/Examples/CustomNotificationsExample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public MainWindow()
_notifier = new Notifier(cfg =>
{
cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(15), MaximumNotificationCount.FromCount(15));
cfg.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 10, 10);
cfg.PositionProvider = new WindowPositionProvider(this, Corner.BottomRight, 10, 10);
cfg.KeyboardEventHandler = new AllowedSourcesInputEventHandler(new []{ typeof(CustomInputDisplayPart) });
});
}
Expand Down Expand Up @@ -59,5 +59,11 @@ private void MahApps_Click(object sender, RoutedEventArgs e)
_notifier.ShowMahAppsNotification("MahApps notification", "This is custom notification with MahApps styles");
}

private void Show_ChildWindow(object sender, RoutedEventArgs e)
{
var childWindow = new MainWindow();
childWindow.ShowActivated = true;
childWindow.Show();
}
}
}
3 changes: 2 additions & 1 deletion Src/Examples/CustomNotificationsExample/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MahApps.Metro" version="1.5.0" targetFramework="net452" />
<package id="ControlzEx" version="3.0.2.4" targetFramework="net452" />
<package id="MahApps.Metro" version="1.6.5" targetFramework="net452" />
</packages>
11 changes: 1 addition & 10 deletions Src/ToastNotifications/Display/NotificationsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,14 @@ public partial class NotificationsWindow : Window
{
private IKeyboardEventHandler _keyboardEventHandler;

public NotificationsWindow()
public NotificationsWindow(Window owner)
{
InitializeComponent();

Loaded += NotificationsWindow_Loaded;
Closing += NotificationsWindow_Closing;

ShowInTaskbar = false;
Visibility = Visibility.Hidden;
}

public NotificationsWindow(Window owner)
{
InitializeComponent();

Loaded += NotificationsWindow_Loaded;
Closing += NotificationsWindow_Closing;

Owner = owner;
}
Expand Down

0 comments on commit 22d4c50

Please sign in to comment.