void LastFm_MySessionChanged() { Dispatcher.Invoke(new Action(() => { usr.Text = "Username: "******"Real name: " + LastFm.GetRealName(); })); }
public Scrobbler() { InitializeComponent(); SupportSkinner.SetSkin(this); InvalidateVisual(); LastFm.MySessionChanged += LastFm_MySessionChanged; usr.Text = "Username: "******"Real name: " + LastFm.GetRealName(); }
public override void Draw(DrawingContext dc) { if (Player.Instance.Wave == null) { return; } var imb = new ImageBrush(Bitmap.GetImage(Main.MyPath() + "\\dbak.ee")); imb.Stretch = Stretch.UniformToFill; dc.DrawRectangle(imb, new Pen(null, 0), new Rect(0, 0, BlinkG.ActualWidth, BlinkG.ActualHeight)); double w = (BlinkG.ActualWidth / 2) - 50 - (200); double h = (BlinkG.ActualHeight / 2) - 100; //transparent rect dc.DrawRectangle(new SolidColorBrush(Color.FromArgb(90, 0, 0, 0)), new Pen(new SolidColorBrush(Color.FromArgb(10, 0, 0, 0)), 0), new Rect(0, h, BlinkG.ActualWidth, 200)); //Image ImageSource img1 = mw.AlbArt.Source; if (img1 == null) { img1 = mw.ArtistArt.Source; } var imr = new Rect(new Point(w, h), new Size(200, 200)); dc.DrawImage(img1, imr); var tpfs = mw.FontFamily; var tpfu = tpfs.GetTypefaces().First(); var tpf = new Typeface("Segoe UI Light"); //title if (Core.CoreMain.CurrentTrack != null && Core.CoreMain.CurrentTrack.Title != null && !Player.Instance.NetStreamingConfigsLoaded) { var ft = new FormattedText(Core.CoreMain.CurrentTrack.Title, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 45, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 65; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2, (base.BlinkG.ActualHeight) / 2 - 80)); //artist ft = new FormattedText(Core.CoreMain.CurrentTrack.Artist, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 25, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 - 30)); //album ft = new FormattedText(Core.CoreMain.CurrentTrack.Album, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 16, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 + 4)); //user if (!string.IsNullOrEmpty(LastFm.GetRealName()) && Properties.Settings.Default.Scrobble) { ft = new FormattedText("\uef55 ", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, tpfu, 14, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 + 82)); ft = new FormattedText(LastFm.GetRealName(), CultureInfo.InvariantCulture, FlowDirection.LeftToRight, tpf, 12, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 25, (base.BlinkG.ActualHeight) / 2 + 80)); } } if (Player.Instance.NetStreamingConfigsLoaded && CoreMain.CurrentNetStreamTrack != null) { var ft = new FormattedText(Core.CoreMain.CurrentNetStreamTrack.Title, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 45, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 65; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2, (base.BlinkG.ActualHeight) / 2 - 80)); //artist ft = new FormattedText(((!String.IsNullOrEmpty(CoreMain.CurrentNetStreamTrack.Artist) ? CoreMain.CurrentNetStreamTrack.Artist : CoreMain.CurrentNetStreamTrack.Bitrate.ToString())), CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 25, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 - 30)); //album ft = new FormattedText("Radio", CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 16, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 + 4)); } }