Skip to content

Commit

Permalink
history: open novel folder
Browse files Browse the repository at this point in the history
  • Loading branch information
setsumi committed Jul 7, 2023
1 parent d989bd2 commit d106685
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/syosetuDownloader/HistoryWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@
<CommandBinding Command="local:CustomCommands.Batch" Executed="BatchCommand_Executed" CanExecute="FavoriteCommand_CanExecute"/>
<CommandBinding Command="local:CustomCommands.Close" Executed="CloseCommand_Executed"/>
<CommandBinding Command="local:CustomCommands.Finished" Executed="FinishedCommand_Executed" CanExecute="FavoriteCommand_CanExecute"/>
<CommandBinding Command="local:CustomCommands.Folder" Executed="FolderCommand_Executed" CanExecute="FavoriteCommand_CanExecute"/>
</Window.CommandBindings>
<Grid>
<Button Content="Favorite" HorizontalAlignment="Center" Margin="-385,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Favorite" ToolTip="Toggle Favorite (F2)"/>
<Button Content="Update" HorizontalAlignment="Center" Margin="-275,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Update" ToolTip="Check for Updates (F5)"/>
<Button Content="Rename" HorizontalAlignment="Center" Margin="-165,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Rename" ToolTip="Rename novel title (also download folder) (F6)"/>
<Button Content="Delete" HorizontalAlignment="Center" Margin="-55,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Remove" ToolTip="Remove history item to Recycle Bin (F8)"/>
<Button Content="Finished" HorizontalAlignment="Center" Margin="55,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Finished" ToolTip="Toggle Finished (F10)"/>
<Button Content="Select" HorizontalAlignment="Center" Margin="165,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Select" ToolTip="Choose to Download (Enter)"/>
<Button Content="Batch" HorizontalAlignment="Center" Margin="275,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Batch" ToolTip="Automatic Batch Download (Alt+Enter)"/>
<Button Content="Web" HorizontalAlignment="Center" Margin="385,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Web" ToolTip="Open Web Site (Ctrl+Enter)"/>
<Button Content="Favorite" HorizontalAlignment="Center" Margin="-440,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Favorite" ToolTip="Toggle Favorite (F2)"/>
<Button Content="Update" HorizontalAlignment="Center" Margin="-330,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Update" ToolTip="Check for Updates (F5)"/>
<Button Content="Rename" HorizontalAlignment="Center" Margin="-220,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Rename" ToolTip="Rename Novel Title (also download folder) (F6)"/>
<Button Content="Delete" HorizontalAlignment="Center" Margin="-110,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Remove" ToolTip="Remove History Item to Recycle Bin (F8)"/>
<Button Content="Finished" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Finished" ToolTip="Toggle Finished (F10)"/>
<Button Content="Select" HorizontalAlignment="Center" Margin="110,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Select" ToolTip="Choose to Download (Enter)"/>
<Button Content="Batch" HorizontalAlignment="Center" Margin="220,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Batch" ToolTip="Automatic Batch Download (Alt+Enter)"/>
<Button Content="Web" HorizontalAlignment="Center" Margin="330,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Web" ToolTip="Open Web Site (Ctrl+Enter)"/>
<Button Content="Folder" HorizontalAlignment="Center" Margin="440,0,0,0" VerticalAlignment="Top" Width="50" Height="23" HorizontalContentAlignment="Center" Command="local:CustomCommands.Folder" ToolTip="Open Novel Folder (F12)"/>
<ListView x:Name="viewHistoryList" FontSize="13"
Background="Transparent"
IsSynchronizedWithCurrentItem="True"
Expand Down
19 changes: 19 additions & 0 deletions src/syosetuDownloader/HistoryWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -248,6 +249,17 @@ private void FinishedCommand_Executed(object sender, ExecutedRoutedEventArgs e)
}
}

private void FolderCommand_Executed(object sender, ExecutedRoutedEventArgs e)
{
var item = GetCurrentItem();
var psi = new ProcessStartInfo
{
FileName = DownloadFolder + Path.DirectorySeparatorChar + item.Title,
UseShellExecute = true
};
Process.Start(psi);
}

//private void OnPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
//{
// Point point = Mouse.GetPosition(viewHistoryList);
Expand Down Expand Up @@ -350,6 +362,13 @@ public static class CustomCommands
typeof(CustomCommands),
new InputGestureCollection() { new KeyGesture(Key.F10, ModifierKeys.None) }
);
public static readonly RoutedUICommand Folder = new RoutedUICommand
(
"Folder",
"Folder",
typeof(CustomCommands),
new InputGestureCollection() { new KeyGesture(Key.F12, ModifierKeys.None) }
);
}

public class FavoriteBooleanConverter : IValueConverter
Expand Down

0 comments on commit d106685

Please sign in to comment.