namespace QuikDawEditor.EditingClasses; public class Marker : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } private double _timePosMs; public double timePosMs { get { return _timePosMs; } set { _timePosMs = value; NotifyPropertyChanged(nameof(timePosMs)); NotifyPropertyChanged(nameof(markerMargin)); NotifyPropertyChanged(nameof(DispString)); } } public Thickness markerMargin { get { return new Thickness(MsecToPixelsZoomed(timePosMs), 0, 0, 0); } } private string _Name; public string Name { get { return _Name; } set { _Name = value; NotifyPropertyChanged(nameof(Name)); } } private double _widthMs = 1000; // GetNearestSnapMs(editingProject.BeatsPerMeasure * 4 * MillisecondsPerBeat, editingProject.CurrentSnapTo); public double widthMs { get { return Math.Truncate(_widthMs); } set { _widthMs = Math.Truncate(value); NotifyPropertyChanged(nameof(widthPixels)); NotifyPropertyChanged(nameof(DispString)); } } public double widthPixels { get { return MsecToPixelsZoomed(widthMs); } } public void UpdateMarker() { NotifyPropertyChanged(nameof(markerMargin)); NotifyPropertyChanged(nameof(widthPixels)); } public string DispString { get { return TimeSpan.FromMilliseconds(timePosMs).ToString().Substring(0, 8) + "-" + TimeSpan.FromMilliseconds(timePosMs + widthMs).ToString().Substring(0, 8) + " " + Name; } } private string _markerBackground = "#FFFFFFFF"; public string markerBackground { get { return _markerBackground; } set { _markerBackground = value; NotifyPropertyChanged(nameof(markerBackground)); } } }