add Screenshot Demo
This commit is contained in:
1 parent
46b1297aa7
commit
4113f9d814
23 files changed
+187
-41
No files matched your search
@@ -0,0 +1,10 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.ScreenshotDemoCtl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<hc:TransitioningContentControl>
|
||||
<Button Content="{x:Static langs:Lang.StartScreenshot}" Command="hc:ControlCommands.StartScreenshot"/>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class ScreenshotDemoCtl : IDisposable
|
||||
{
|
||||
public ScreenshotDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
Screenshot.Snapped += Screenshot_Snapped;
|
||||
}
|
||||
|
||||
private void Screenshot_Snapped(object sender, FunctionEventArgs<ImageSource> e)
|
||||
{
|
||||
new HandyControl.Controls.Window
|
||||
{
|
||||
Content = new Image
|
||||
{
|
||||
Source = e.Info,
|
||||
Stretch = Stretch.None
|
||||
},
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen
|
||||
}.ShowDialog();
|
||||
}
|
||||
|
||||
public void Dispose() => Screenshot.Snapped -= Screenshot_Snapped;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user