public void Search(string artist, string album, IScriptResults results) { int numberOfResults = 50; results.EstimatedCount = numberOfResults; Random rnd = new Random(); for (int i = 0; i < numberOfResults; i++) { Bitmap thumbnail = new Bitmap(typeof(TestScript), "testThumbnail.jpg"); Bitmap fullSize = new Bitmap(typeof(TestScript), "testFullsize.jpg"); //results.Add(thumbnail, i.ToString(), "notauri", 1000 + rnd.Next(6) * 100, rnd.Next(1, 1600), fullSize, (CoverType)rnd.Next((int)CoverType.Unknown, (int)CoverType.CD + 1)); results.Add(thumbnail, i.ToString(), "notauri", -1, -1, fullSize, (CoverType)rnd.Next((int)CoverType.Unknown, (int)CoverType.CD + 1)); //System.Threading.Thread.Sleep(1000); } }
/* * private class TestWin : System.Windows.Window * { * public TestWin() * { * var a = new System.Windows.Media.Animation.ThicknessAnimation(); * * * } * }*/ public void Search(string artist, string album, IScriptResults results) { /* * var bitmap = new Bitmap(400, 600); * var g = Graphics.FromImage(bitmap); * g.Clear(SystemColors.Window); * g.DrawString("hello\nthere", SystemFonts.DialogFont, SystemBrushes.WindowText, PointF.Empty); * g.Dispose(); * * results.Add(ConvertImageToStream(bitmap), "test", null); * bitmap.Dispose(); * * return; * */ int numberOfResults = 1; results.EstimatedCount = numberOfResults; Random rnd = new Random(); var assembly = GetType().Assembly; try { for (int i = 0; i < numberOfResults; i++) { //results.Add(thumbnail, i.ToString(), "notauri", 1000 + rnd.Next(6) * 100, rnd.Next(1, 1600), fullSize, (CoverType)rnd.Next((int)CoverType.Unknown, (int)CoverType.CD + 1)); results.Add(assembly.GetManifestResourceStream("TestScript.testThumbnail.jpg"), i.ToString(), "notauri", -1, -1, assembly.GetManifestResourceStream("TestScript.testBadImage.jpg"), (CoverType)rnd.Next((int)CoverType.Unknown, (int)CoverType.Booklet + 1), "gif"); System.Threading.Thread.Sleep(1000); } } catch (ThreadAbortException) { System.Diagnostics.Debug.WriteLine("Exception"); } finally { System.Diagnostics.Debug.WriteLine("finished"); } }