mirror of
https://github.com/chylex/Backup-Essentials.git
synced 2025-06-02 15:34:06 +02:00
Added Drag&Drop events
This commit is contained in:
parent
e4191482e6
commit
0e9e1f2611
BackupEssentials
@ -7,7 +7,7 @@
|
|||||||
xmlns:custom="clr-namespace:BackupEssentials.Controls"
|
xmlns:custom="clr-namespace:BackupEssentials.Controls"
|
||||||
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
|
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
|
||||||
mc:Ignorable="d" x:Class="BackupEssentials.MainWindow"
|
mc:Ignorable="d" x:Class="BackupEssentials.MainWindow"
|
||||||
Title="Backup" Height="600" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="CanResizeWithGrip" Background="#FF000000" AllowsTransparency="True" AllowDrop="True" MinWidth="800" MinHeight="600">
|
Title="Backup" Height="600" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="CanResizeWithGrip" Background="#FF000000" AllowsTransparency="True" AllowDrop="True" MinWidth="800" MinHeight="600" DragEnter="OnDragEnter" DragLeave="OnDragLeave" Drop="OnDragDrop">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<Style TargetType="ResizeGrip">
|
<Style TargetType="ResizeGrip">
|
||||||
<Setter Property="Margin" Value="2"/>
|
<Setter Property="Margin" Value="2"/>
|
||||||
|
@ -17,6 +17,8 @@ namespace BackupEssentials{
|
|||||||
private new Rect RestoreBounds = new Rect();
|
private new Rect RestoreBounds = new Rect();
|
||||||
private bool IsMaximized = false;
|
private bool IsMaximized = false;
|
||||||
|
|
||||||
|
private string[] DropData = null;
|
||||||
|
|
||||||
public MainWindow(){
|
public MainWindow(){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@ -91,6 +93,24 @@ namespace BackupEssentials{
|
|||||||
ShowPage(GetType().Assembly.GetType("BackupEssentials."+btn.ClickPage,false));
|
ShowPage(GetType().Assembly.GetType("BackupEssentials."+btn.ClickPage,false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDragEnter(object sender, System.Windows.DragEventArgs e){
|
||||||
|
if (DropData == null && e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop))DropData = e.Data.GetData(System.Windows.DataFormats.FileDrop) as string[];
|
||||||
|
else e.Effects = System.Windows.DragDropEffects.None;
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDragLeave(object sender, System.Windows.DragEventArgs e){
|
||||||
|
DropData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDragDrop(object sender, System.Windows.DragEventArgs e){
|
||||||
|
if (DropData != null){
|
||||||
|
// TODO display backup page
|
||||||
|
DropData = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ShowPage(Type pageType){
|
public void ShowPage(Type pageType){
|
||||||
ShowPage(pageType,null);
|
ShowPage(pageType,null);
|
||||||
}
|
}
|
||||||
@ -104,7 +124,9 @@ namespace BackupEssentials{
|
|||||||
|
|
||||||
if (!page.AllowDrop){
|
if (!page.AllowDrop){
|
||||||
page.AllowDrop = true;
|
page.AllowDrop = true;
|
||||||
// TODO handle events
|
page.DragEnter += new System.Windows.DragEventHandler(OnDragEnter);
|
||||||
|
page.DragLeave += new System.Windows.DragEventHandler(OnDragLeave);
|
||||||
|
page.Drop += new System.Windows.DragEventHandler(OnDragDrop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user