Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions App/ViewModels/FileSyncListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public partial class FileSyncListViewModel : ObservableObject
[NotifyPropertyChangedFor(nameof(ShowSessions))]
public partial string? Error { get; set; } = null;

[ObservableProperty] public partial bool OperationInProgress { get; set; } = false;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(CanOpenLocalPath))]
[NotifyPropertyChangedFor(nameof(NewSessionRemoteHostEnabled))]
[NotifyPropertyChangedFor(nameof(NewSessionRemotePathDialogEnabled))]
public partial bool OperationInProgress { get; set; } = false;

[ObservableProperty] public partial IReadOnlyList<SyncSessionViewModel> Sessions { get; set; } = [];

Expand All @@ -60,6 +64,7 @@ public partial class FileSyncListViewModel : ObservableObject

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(NewSessionCreateEnabled))]
[NotifyPropertyChangedFor(nameof(CanOpenLocalPath))]
public partial bool NewSessionLocalPathDialogOpen { get; set; } = false;

[ObservableProperty]
Expand All @@ -80,10 +85,12 @@ public partial class FileSyncListViewModel : ObservableObject
[NotifyPropertyChangedFor(nameof(NewSessionRemotePathDialogEnabled))]
public partial bool NewSessionRemotePathDialogOpen { get; set; } = false;

public bool NewSessionRemoteHostEnabled => AvailableHosts.Count > 0;
public bool CanOpenLocalPath => !NewSessionLocalPathDialogOpen && !OperationInProgress;

public bool NewSessionRemoteHostEnabled => AvailableHosts.Count > 0 && !OperationInProgress;

public bool NewSessionRemotePathDialogEnabled =>
!string.IsNullOrWhiteSpace(NewSessionRemoteHost) && !NewSessionRemotePathDialogOpen;
!string.IsNullOrWhiteSpace(NewSessionRemoteHost) && !NewSessionRemotePathDialogOpen && !OperationInProgress;

[ObservableProperty] public partial string NewSessionStatus { get; set; } = "";

Expand Down
4 changes: 3 additions & 1 deletion App/Views/Pages/FileSyncListMainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,12 @@
Grid.Column="0"
Margin="0,0,5,0"
VerticalAlignment="Stretch"
IsEnabled="{x:Bind ViewModel.OperationInProgress,Converter={StaticResource InverseBoolConverter}, Mode=OneWay}"
Text="{x:Bind ViewModel.NewSessionLocalPath, Mode=TwoWay}" />

<Button
Grid.Column="1"
IsEnabled="{x:Bind ViewModel.NewSessionLocalPathDialogOpen, Converter={StaticResource InverseBoolConverter}, Mode=OneWay}"
IsEnabled="{x:Bind ViewModel.CanOpenLocalPath, Mode=OneWay}"
Command="{x:Bind ViewModel.OpenLocalPathSelectDialogCommand}"
VerticalAlignment="Stretch">

Expand Down Expand Up @@ -350,6 +351,7 @@
Grid.Column="0"
Margin="0,0,5,0"
VerticalAlignment="Stretch"
IsEnabled="{x:Bind ViewModel.NewSessionRemotePathDialogEnabled, Mode=OneWay}"
Text="{x:Bind ViewModel.NewSessionRemotePath, Mode=TwoWay}" />

<Button
Expand Down
Loading