Skip to content

Commit

Permalink
Tweak pausing/clearing console window
Browse files Browse the repository at this point in the history
Relates to #174
  • Loading branch information
canton7 committed Nov 12, 2015
1 parent 0608dd2 commit 5d48332
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/SyncTrayzor/Pages/ConsoleView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
</UserControl.Resources>
<DockPanel>
<DockPanel DockPanel.Dock="Top" LastChildFill="False" Height="27">
<TextBlock DockPanel.Dock="Left" Margin="15,0,0,0" VerticalAlignment="Center" FontWeight="Bold" Text="{l:Loc ConsoleView_Title}"/>
<Button DockPanel.Dock="Right" Padding="0" Margin="5,3" Height="NaN" Command="{s:Action ClearLog}" Content="{l:Loc ConsoleView_ClearButton}"/>
<ToggleButton DockPanel.Dock="Right" Padding="0" Margin="0,3" IsChecked="{Binding LogPaused}" Content="{l:Loc ConsoleView_PauseButton}"/>
<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="5,3" Height="NaN" Command="{s:Action ClearLog}" Content="{l:Loc ConsoleView_ClearButton}"/>
<ToggleButton DockPanel.Dock="Right" Padding="3,0" Margin="0,3" IsChecked="{Binding LogPaused}" Content="{l:Loc ConsoleView_PauseButton}"/>
</DockPanel>
<TextBox ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Expand Down
12 changes: 9 additions & 3 deletions src/SyncTrayzor/Pages/ConsoleViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ public ConsoleViewModel(
this.LogMessages.Dequeue();
}

this.NotifyOfPropertyChange(() => this.LogMessages);
if (!this.LogPaused)
this.NotifyOfPropertyChange(() => this.LogMessages);
};

this.syncThingManager.MessageLogged += (o, e) =>
{
if (!this.LogPaused)
this.logMessagesBuffer.Add(e.LogMessage);
this.logMessagesBuffer.Add(e.LogMessage);
};

this.Bind(s => s.LogPaused, (o, e) =>
{
if (!e.NewValue)
this.NotifyOfPropertyChange(() => this.LogMessages);
});
}

public void ClearLog()
Expand Down

0 comments on commit 5d48332

Please sign in to comment.