Browse Source

Remove drop file tests

pull/5/head
Ionite 1 year ago
parent
commit
c112ea3375
No known key found for this signature in database
  1. 7
      StabilityMatrix/CheckpointManagerPage.xaml
  2. 51
      StabilityMatrix/CheckpointManagerPage.xaml.cs

7
StabilityMatrix/CheckpointManagerPage.xaml

@ -48,14 +48,9 @@
<DataTemplate DataType="{x:Type models:CheckpointFolder}" x:Key="CheckpointFolderGridDataTemplate">
<Expander
AllowDrop="True"
Drop="FolderCard_OnDrop"
Header="{Binding Title}"
IsExpanded="True"
Margin="8"
PreviewDragEnter="FolderCard_OnPreviewDragEnter"
PreviewDragLeave="FolderCard_OnPreviewDragLeave"
PreviewDragOver="FolderCard_OnPreviewDragOver"
PreviewDrop="FolderCard_OnPreviewDrop">
Margin="8">
<ui:VirtualizingGridView
ItemTemplate="{StaticResource CheckpointFileDataTemplate}"
ItemsSource="{Binding CheckpointFiles}"

51
StabilityMatrix/CheckpointManagerPage.xaml.cs

@ -20,57 +20,6 @@ public partial class CheckpointManagerPage : Page
DataContext = viewModel;
}
private void FolderCard_OnPreviewDrop(object sender, DragEventArgs e)
{
Debug.WriteLine($"PreviewDrop: {sender}, {e}");
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
var files = e.Data.GetData(DataFormats.FileDrop) as string[];
var firstFile = files?[0];
// Make title by title casing the file name
var title = System.IO.Path.GetFileNameWithoutExtension(firstFile);
title = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(title!);
viewModel.CheckpointFolders[0].CheckpointFiles.Add(new()
{
Title = title,
FileName = firstFile!,
});
}
}
private void FolderCard_OnDrop(object sender, DragEventArgs e)
{
Debug.WriteLine($"Drop: {sender}, {e}");
}
private void FolderCard_OnPreviewDragOver(object sender, DragEventArgs e)
{
Debug.WriteLine($"PreviewDragOver: {sender}, {e}");
}
private void FolderCard_OnPreviewDragLeave(object sender, DragEventArgs e)
{
var senderCard = (CardExpander) sender;
senderCard.Header = "Stable Diffusion";
Debug.WriteLine($"PreviewDragLeave: {sender}, {e}");
}
private void FolderCard_OnPreviewDragEnter(object sender, DragEventArgs e)
{
var senderCard = (CardExpander) sender;
senderCard.Header = "Drag here to add a checkpoint";
// Apply a hover-over effect
senderCard.Effect = new DropShadowEffect
{
Color = Colors.Black,
Direction = 0,
ShadowDepth = 0,
Opacity = 0.5,
BlurRadius = 10
};
Debug.WriteLine($"PreviewDragEnter: {sender}, {e}");
}
private async void CheckpointManagerPage_OnLoaded(object sender, RoutedEventArgs e)
{
await viewModel.OnLoaded();

Loading…
Cancel
Save