Skip to content

Commit

Permalink
cosmetic: immediate visual feedback on pressing download button
Browse files Browse the repository at this point in the history
cosmetic: changed history datetime format to 'dd-MM-yyyy HH:mm:ss'
  • Loading branch information
setsumi committed Jun 11, 2022
1 parent 6ba4de6 commit b5488e1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/syosetuDownloader/HistoryWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
DisplayMemberBinding="{Binding New}"
util:GridViewSort.PropertyName="New"/>
<GridViewColumn Header="Last DL"
DisplayMemberBinding="{Binding Date}"
DisplayMemberBinding="{Binding Path=Date, StringFormat='dd-MM-yyyy HH:mm:ss'}"
util:GridViewSort.PropertyName="Date"/>
<GridViewColumn Header="Finished" util:GridViewSort.PropertyName="Finished">
<GridViewColumn.CellTemplate>
Expand Down
42 changes: 28 additions & 14 deletions src/syosetuDownloader/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public partial class MainWindow : Window
Shell32.Shell _shell;
string _exe_dir;
string _dl_dir;
readonly string _version = "2.4.0 plus 11";
readonly string _version = "2.4.0 plus 12";

public Util.GridViewTool.SortInfo sortInfo = new Util.GridViewTool.SortInfo();

Expand Down Expand Up @@ -153,6 +153,29 @@ private void btnDownload_Click(object sender, RoutedEventArgs e)
{
btnHistory.Focus();

Label lb = new Label();
lb.Content = "Preparing...";
lb.Background = Brushes.Gold;
ProgressBar pb = new ProgressBar();
pb.Height = 10;
pb.Tag = 0;
Separator s = new Separator();
s.Height = 5;

_row += 1;
_controls.Add(new Syousetsu.Controls { ID = _row, Label = lb, ProgressBar = pb, Separator = s });

stackPanel1.Children.Add(lb);
stackPanel1.Children.Add(pb);
stackPanel1.Children.Add(s);
scrollViewer1.ScrollToLeftEnd();
scrollViewer1.ScrollToBottom();
scrollViewer1.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);

Application.Current.Dispatcher.InvokeAsync(() => Download(), DispatcherPriority.Background);
}
private void Download()
{
this._link = txtLink.Text;
this._start = txtFrom.Text;
this._end = txtTo.Text;
Expand Down Expand Up @@ -186,20 +209,16 @@ private void btnDownload_Click(object sender, RoutedEventArgs e)


GetFilenameFormat();
_row += 1;

Label lb = new Label();
// set up download progress gui-controls
Label lb = _controls.Last().Label;
lb.Content = Syousetsu.Methods.GetTitle(toc, sc);
lb.Background = Brushes.Transparent;
lb.ToolTip = "Click to open folder";

ProgressBar pb = new ProgressBar();
ProgressBar pb = _controls.Last().ProgressBar;
pb.Maximum = (_end == String.Empty) ? Syousetsu.Methods.GetTotalChapters(toc, sc) : Convert.ToDouble(_end);
pb.ToolTip = "Click to stop download";
pb.Height = 10;
pb.Tag = 0;

Separator s = new Separator();
s.Height = 5;

_start = (_start == String.Empty) ? "1" : _start;
_end = pb.Maximum.ToString();
Expand Down Expand Up @@ -229,14 +248,9 @@ private void btnDownload_Click(object sender, RoutedEventArgs e)
_shell.Explore(System.IO.Path.Combine(_dl_dir, sc.SeriesTitle));
};

stackPanel1.Children.Add(lb);
stackPanel1.Children.Add(pb);
stackPanel1.Children.Add(s);
scrollViewer1.ScrollToLeftEnd();
scrollViewer1.ScrollToBottom();
scrollViewer1.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);

_controls.Add(new Syousetsu.Controls { ID = _row, Label = lb, ProgressBar = pb, Separator = s });
}

private void rbText_Checked(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit b5488e1

Please sign in to comment.