public void TestEventListener() { var waitHandle = new ManualResetEvent(false); PipeListener.MkStaticInstance(); PipeListener.staticpipelistener.OnMusicPlay += (songinfo) => { Assert.IsNotNull(songinfo.Album); Assert.IsNotNull(songinfo.AlbumArtBase64); Assert.IsNotNull(songinfo.AlbumArtist); Assert.IsNotNull(songinfo.Title); Assert.IsNotNull(songinfo.TrackCount); Assert.IsNotNull(songinfo.Year); Assert.IsNotNull(songinfo.Composer); songinfo.GetType().GetProperties().ToList().ForEach(itm => { if (itm.GetValue(songinfo) is string str && itm.Name != "AlbumArtBase64") { Console.WriteLine($"{itm.Name} : {str}"); } }); waitHandle.Set(); }; waitHandle.WaitOne(Timeout.Infinite); PipeListener.staticpipelistener.StopPipeListener(); }
protected override void OnStartup(StartupEventArgs e) { //Start Pipe Listener PipeListener.MkStaticInstance(); //Load config if (Core.ConfigStore.ConfigExists()) { Core.ConfigStore.LoadStaticConfig(); Core.ConfigStore.StaticConfig.Theme.CurrentTheme.ApplyTheme(); } else { Core.ConfigStore.StaticConfig.Theme.CurrentTheme.ApplyTheme(); UI.MainWindow.OpenSingletonWindow(); } //Start Auto Tweet AutoTweet.AutoTweetSingleton.InitListner( PipeListener.StaticPipeListener ?? throw new InvalidOperationException(), ConfigStore.StaticConfig); //Init Notify Icon NotifyIconManager.NotifyIconSingleton.InitIcon(); //Check update new UpdateChecker(NotifyIconManager.NotifyIconSingleton).CheckUpdateAsync(); //Start iTunes Plugin Plugin.ITunesPlugin.Start(); }
public void TestImageDecoder() { var waitHandle = new ManualResetEvent(false); PipeListener.MkStaticInstance(); PipeListener.staticpipelistener.OnMusicPlay += (songinfo) => { if (songinfo.IsAlbumArtAvaliable()) { Console.WriteLine($"Image Width : {songinfo.GetAlbumArt().Width}"); Console.WriteLine($"Image Height : {songinfo.GetAlbumArt().Height}"); } Assert.IsTrue(songinfo.AlbumArtBase64.Length == 0 || songinfo.IsAlbumArtAvaliable()); songinfo.GetType().GetProperties().ToList().ForEach(itm => Console.WriteLine($"{itm.Name} : {itm.GetValue(songinfo)}")); waitHandle.Set(); }; waitHandle.WaitOne(Timeout.Infinite); PipeListener.staticpipelistener.StopPipeListener(); }