Skip to content

Commit 22c9bcd

Browse files
authored
feat: disabled 'new sync form' when creating a mutagen sync (#110)
Closes: #82
1 parent d6cbf71 commit 22c9bcd

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

‎App/ViewModels/FileSyncListViewModel.cs‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ public partial class FileSyncListViewModel : ObservableObject
4848
[NotifyPropertyChangedFor(nameof(ShowSessions))]
4949
publicpartialstring?Error{get;set;}=null;
5050

51-
[ObservableProperty]publicpartialboolOperationInProgress{get;set;}=false;
51+
[ObservableProperty]
52+
[NotifyPropertyChangedFor(nameof(CanOpenLocalPath))]
53+
[NotifyPropertyChangedFor(nameof(NewSessionRemoteHostEnabled))]
54+
[NotifyPropertyChangedFor(nameof(NewSessionRemotePathDialogEnabled))]
55+
publicpartialboolOperationInProgress{get;set;}=false;
5256

5357
[ObservableProperty]publicpartialIReadOnlyList<SyncSessionViewModel>Sessions{get;set;}=[];
5458

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

6165
[ObservableProperty]
6266
[NotifyPropertyChangedFor(nameof(NewSessionCreateEnabled))]
67+
[NotifyPropertyChangedFor(nameof(CanOpenLocalPath))]
6368
publicpartialboolNewSessionLocalPathDialogOpen{get;set;}=false;
6469

6570
[ObservableProperty]
@@ -80,10 +85,12 @@ public partial class FileSyncListViewModel : ObservableObject
8085
[NotifyPropertyChangedFor(nameof(NewSessionRemotePathDialogEnabled))]
8186
publicpartialboolNewSessionRemotePathDialogOpen{get;set;}=false;
8287

83-
publicboolNewSessionRemoteHostEnabled=>AvailableHosts.Count>0;
88+
publicboolCanOpenLocalPath=>!NewSessionLocalPathDialogOpen&&!OperationInProgress;
89+
90+
publicboolNewSessionRemoteHostEnabled=>AvailableHosts.Count>0&&!OperationInProgress;
8491

8592
publicboolNewSessionRemotePathDialogEnabled=>
86-
!string.IsNullOrWhiteSpace(NewSessionRemoteHost)&&!NewSessionRemotePathDialogOpen;
93+
!string.IsNullOrWhiteSpace(NewSessionRemoteHost)&&!NewSessionRemotePathDialogOpen&&!OperationInProgress;
8794

8895
[ObservableProperty]publicpartialstringNewSessionStatus{get;set;}="";
8996

‎App/Views/Pages/FileSyncListMainPage.xaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,12 @@
318318
Grid.Column="0"
319319
Margin="0,0,5,0"
320320
VerticalAlignment="Stretch"
321+
IsEnabled="{x:Bind ViewModel.OperationInProgress,Converter={StaticResource InverseBoolConverter}, Mode=OneWay}"
321322
Text="{x:Bind ViewModel.NewSessionLocalPath, Mode=TwoWay}" />
322323

323324
<Button
324325
Grid.Column="1"
325-
IsEnabled="{x:Bind ViewModel.NewSessionLocalPathDialogOpen, Converter={StaticResource InverseBoolConverter}, Mode=OneWay}"
326+
IsEnabled="{x:Bind ViewModel.CanOpenLocalPath, Mode=OneWay}"
326327
Command="{x:Bind ViewModel.OpenLocalPathSelectDialogCommand}"
327328
VerticalAlignment="Stretch">
328329

@@ -350,6 +351,7 @@
350351
Grid.Column="0"
351352
Margin="0,0,5,0"
352353
VerticalAlignment="Stretch"
354+
IsEnabled="{x:Bind ViewModel.NewSessionRemotePathDialogEnabled, Mode=OneWay}"
353355
Text="{x:Bind ViewModel.NewSessionRemotePath, Mode=TwoWay}" />
354356

355357
<Button

0 commit comments

Comments
(0)