public MusicInfoDisplay() { this.InitializeComponent(); _vm = Ioc.Default.GetRequiredService <MusicInfoViewModel>(); WeakReferenceMessenger.Default.Register <MusicInfoDisplay, string, string>(this, "MediaPlayer", (ctor, mes) => { string[] split = mes.Split(':'); string key = split[0]; string value = split[1]; var time = TimeSpan.FromMinutes(double.Parse(value)); if (key == "PositionChangedBySystem") { ctor.MyScrollSubtitlePreview.Refresh(time); } if (key == "PositionChangedByUser") { ctor.MyScrollSubtitlePreview.Reposition(time); } }); WeakReferenceMessenger.Default.Register <MusicInfoDisplay, string, string>(this, nameof(MusicInfoDisplay), (ctor, mes) => { if (mes == "RequestReposition") { var player = Ioc.Default.GetRequiredService <MediaPlayer>(); MyScrollSubtitlePreview.Reposition(player.PlaybackSession.Position); } }); }
public MusicInfoPage() { this.InitializeComponent(); _vm = Ioc.Default.GetRequiredService <MusicInfoViewModel>(); }