-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[director] Binding ScorePreviewer.IsPreviewing. Fixed audio playback …
…when form is being closed.
- Loading branch information
Showing
9 changed files
with
179 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.DependencyProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Windows; | ||
|
||
namespace DereTore.Applications.StarlightDirector.UI.Controls { | ||
partial class ScorePreviewer { | ||
|
||
public bool IsPreviewing { | ||
get { | ||
if (CheckAccess()) { | ||
return (bool)GetValue(IsPreviewingProperty); | ||
} else { | ||
if (_getIsPreviewing == null) { | ||
_getIsPreviewing = () => (bool)GetValue(IsPreviewingProperty); | ||
} | ||
return (bool)Dispatcher.Invoke(_getIsPreviewing); | ||
} | ||
} | ||
internal set { | ||
if (CheckAccess()) { | ||
SetValue(IsPreviewingProperty, value); | ||
} else { | ||
if (_setIsPreviewing == null) { | ||
_setIsPreviewing = v => SetValue(IsPreviewingProperty, v); | ||
} | ||
Dispatcher.Invoke(_setIsPreviewing, value); | ||
} | ||
} | ||
} | ||
|
||
public static readonly DependencyProperty IsPreviewingProperty = DependencyProperty.Register(nameof(IsPreviewing), typeof(bool), typeof(ScorePreviewer), | ||
new PropertyMetadata(false, OnIsPreviewingChanged)); | ||
|
||
private static void OnIsPreviewingChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { | ||
var previewer = (ScorePreviewer)obj; | ||
previewer._isPreviewing = (bool)e.NewValue; | ||
} | ||
|
||
private Func<bool> _getIsPreviewing; | ||
private Action<bool> _setIsPreviewing; | ||
|
||
} | ||
} |
Oops, something went wrong.