Skip to content

Commit

Permalink
Closing progress window when exit.
Browse files Browse the repository at this point in the history
Wrapping copy text.
GetDuplicates: fixed bug.
  • Loading branch information
anovik committed Dec 27, 2023
1 parent 9ea046f commit ee7b018
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 16 deletions.
13 changes: 11 additions & 2 deletions src/SmartCommander/Assets/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/SmartCommander/Assets/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="OperationInProgress" xml:space="preserve">
<value>Operation in Progress:</value>
</data>
<data name="Options" xml:space="preserve">
<value>Options</value>
</data>
Expand Down
12 changes: 7 additions & 5 deletions src/SmartCommander/SmartCommander.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
<ItemGroup>
<Content Include="Assets\main.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Assets\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<!--This helps with theme dll-s trimming.
If you will publish your application in self-contained mode with p:PublishTrimmed=true and it will use Fluent theme Default theme will be trimmed from the output and vice versa.
Expand All @@ -40,11 +47,6 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<AvaloniaResource Update="Assets\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</AvaloniaResource>
<EmbeddedResource Update="Assets\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
Expand Down
2 changes: 1 addition & 1 deletion src/SmartCommander/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static internal List<string> GetDuplicates(List<FileViewModel> selectedItems, st

foreach (var item in selectedItems)
{
string targetFilePath = Path.Combine(destpath, item.Name);
string targetFilePath = Path.Combine(destpath, Path.GetFileName(item.FullName));
if (item.IsFolder)
{
EnumerateDuplicates(item.FullName, targetFilePath, ref duplicates);
Expand Down
2 changes: 1 addition & 1 deletion src/SmartCommander/Views/CopyMoveWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Margin="10" Text="{Binding CopyText}"></TextBlock>
<TextBlock Margin="10" Text="{Binding CopyText}" TextWrapping="Wrap"></TextBlock>
<TextBlock Margin="10" Grid.Row="1" Text="{Binding Directory}"></TextBlock>
<StackPanel Margin="10" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Margin="5" Command="{Binding OKCommand}" CommandParameter="{Binding $parent[Window]}"
Expand Down
12 changes: 8 additions & 4 deletions src/SmartCommander/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI;
using SmartCommander.Models;
Expand All @@ -13,11 +14,15 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
public MainWindow()
{
Opened += OnOpened;
InitializeComponent();
InitializeComponent();

this.WhenActivated(d => d(ViewModel!.ShowCopyDialog.RegisterHandler(DoShowCopyDialogAsync)));
this.WhenActivated(d => d(ViewModel!.ShowOptionsDialog.RegisterHandler(DoShowOptionsDialogAsync)));


Closing += (s, e) =>
{
_progressWindow.Close();
};
}

private async Task DoShowCopyDialogAsync(InteractionContext<CopyMoveViewModel, CopyMoveViewModel?> interaction)
Expand Down Expand Up @@ -77,8 +82,7 @@ private void OnOpened(object? sender, EventArgs e)
}

private void View_ProgressRequest(object? sender, int e)
{
// TODO: hangs after closing
{
if (e == 0)
{
_progressWindow.Show();
Expand Down
3 changes: 2 additions & 1 deletion src/SmartCommander/Views/ProgressWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaToDecorationsHint="True"
Topmost="True"
xmlns:assets="clr-namespace:SmartCommander.Assets"
x:Class="SmartCommander.Views.ProgressWindow">
<StackPanel Margin="20">
<TextBlock>Operation in Progress:</TextBlock>
<TextBlock Text="{x:Static assets:Resources.OperationInProgress}"></TextBlock>
<ProgressBar Margin="20" Height="20" Name="progressBar"
Minimum="0" Maximum="100"
ShowProgressText="True"/>
Expand Down
3 changes: 1 addition & 2 deletions src/SmartCommander/Views/ProgressWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ namespace SmartCommander.Views
public partial class ProgressWindow : Window
{
public ProgressWindow()
{
// TODO: move Operation in Progress to resources
{
InitializeComponent();
}

Expand Down

0 comments on commit ee7b018

Please sign in to comment.