Browse Source

Make pause/resume clearer on syncthing console

Antony Male 9 years ago
parent
commit
c915d7e54d

+ 2 - 1
src/SyncTrayzor/Pages/ConsoleView.xaml

@@ -17,7 +17,8 @@
             <TextBlock DockPanel.Dock="Left" Margin="10,0,0,0" VerticalAlignment="Center" FontWeight="Bold" Text="{l:Loc ConsoleView_Title}"/>
             <Button DockPanel.Dock="Right" Padding="3,0" Margin="0,3,5,3" Height="NaN" Command="{s:Action ShowSettings}" Content="{l:Loc ConsoleView_SettingsButton}"/>
             <Button DockPanel.Dock="Right" Padding="3,0" Margin="0,3,5,3" Height="NaN" Command="{s:Action ClearLog}" Content="{l:Loc ConsoleView_ClearButton}"/>
-            <ToggleButton DockPanel.Dock="Right" Padding="3,0" Margin="0,3,5,3" IsChecked="{Binding LogPaused}" Content="{l:Loc ConsoleView_PauseButton}"/>
+            <Button DockPanel.Dock="Right" Padding="3,0" Margin="0,3,5,3" Height="NaN" Command="{s:Action PauseLog}" Content="{l:Loc ConsoleView_PauseButton}" Visibility="{Binding LogPaused, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}"/>
+            <Button DockPanel.Dock="Right" Padding="3,0" Margin="0,3,5,3" Height="NaN" Command="{s:Action ResumeLog}" Content="{l:Loc ConsoleView_ResumeButton}" Visibility="{Binding LogPaused, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"/>
         </DockPanel>
         <TextBox ScrollViewer.VerticalScrollBarVisibility="Auto"
                  ScrollViewer.HorizontalScrollBarVisibility="Auto"

+ 13 - 8
src/SyncTrayzor/Pages/ConsoleViewModel.cs

@@ -36,12 +36,6 @@ namespace SyncTrayzor.Pages
             this.logMessagesBuffer.Delivered += this.LogMessageDelivered;
 
             this.syncthingManager.MessageLogged += this.SyncthingMessageLogged;
-
-            this.Bind(s => s.LogPaused, (o, e) =>
-            {
-                if (!e.NewValue)
-                    this.NotifyOfPropertyChange(() => this.LogMessages);
-            });
         }
 
         private void LogMessageDelivered(object sender, BufferDeliveredEventArgs<string> e)
@@ -54,7 +48,7 @@ namespace SyncTrayzor.Pages
             }
 
             if (!this.LogPaused)
-                this.NotifyOfPropertyChange(() => this.LogMessages);
+                this.NotifyOfPropertyChange(nameof(this.LogMessages));
         }
 
         private void SyncthingMessageLogged(object sender, MessageLoggedEventArgs e)
@@ -65,7 +59,7 @@ namespace SyncTrayzor.Pages
         public void ClearLog()
         {
             this.LogMessages.Clear();
-            this.NotifyOfPropertyChange(() => this.LogMessages);
+            this.NotifyOfPropertyChange(nameof(this.LogMessages));
         }
 
         public void ShowSettings()
@@ -75,6 +69,17 @@ namespace SyncTrayzor.Pages
             this.windowManager.ShowDialog(vm);
         }
 
+        public void PauseLog()
+        {
+            this.LogPaused = true;
+        }
+
+        public void ResumeLog()
+        {
+            this.LogPaused = false;
+            this.NotifyOfPropertyChange(nameof(this.LogMessages));
+        }
+
         public void Dispose()
         {
             this.syncthingManager.MessageLogged -= this.SyncthingMessageLogged;

+ 9 - 0
src/SyncTrayzor/Properties/Resources.Designer.cs

@@ -384,6 +384,15 @@ namespace SyncTrayzor.Properties {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to Resume.
+        /// </summary>
+        public static string ConsoleView_ResumeButton {
+            get {
+                return ResourceManager.GetString("ConsoleView_ResumeButton", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to Settings.
         /// </summary>

+ 3 - 0
src/SyncTrayzor/Properties/Resources.resx

@@ -904,4 +904,7 @@ Do you want to restart SyncTrayzor now?</value>
     <value>Browse</value>
     <comment>Shown on a button next to the 'Folder Path' input in Syncthing's UI</comment>
   </data>
+  <data name="ConsoleView_ResumeButton" xml:space="preserve">
+    <value>Resume</value>
+  </data>
 </root>