/// <summary> /// Scans a Window's resources and returns it's accent and theme. /// </summary> /// <param name="window">The Window to check.</param> /// <returns></returns> public static Tuple<Theme, Accent> DetectTheme(MahApps.Metro.Controls.MetroWindow window) { if (window == null) throw new ArgumentNullException("window"); Theme currentTheme = Theme.Light; ResourceDictionary themeDictionary = null; Tuple<Theme, Accent> detectedAccentTheme = null; if (DetectThemeFromResources(ref currentTheme, ref themeDictionary, window.Resources)) { detectedAccentTheme = GetThemeFromResources(currentTheme, window.Resources); return new Tuple<Theme, Accent>(detectedAccentTheme.Item1, detectedAccentTheme.Item2); } return null; }
public GridColor(Grid parent, string color, MahApps.Metro.Accent accent) : this(parent, color) { this.accent = accent; }
public static Tweet CreateRetweet(MahApps.Twitter.Models.Tweet s, TwitterContact contact) { contact.UpdateContactWithTwitterUser(s.User, s.Created); var t = new Tweet { ID = s.Id.ToString(), Contact = contact, Text = WebUtility.HtmlDecode(s.Text), Time = s.Created.ToLocalTime(), SourceUri = s.Source.GetSourceURL(), Source = s.Source.GetSourceText(), Favourite = s.Favourited, }; if (s.Coordinates != null && s.Coordinates.Lat != null && s.Coordinates.Long != null) t.Location = new GeoLocation((double) s.Coordinates.Lat, (double) s.Coordinates.Long); if (s.InReplyToStatusId > 0) { t.InReplyToID = s.InReplyToStatusId.ToString(); t.InReplyTo = new Contact {Name = s.InReplyToScreenName}; } return t; }
public ProgressDialogController(MahApps.Metro.Controls.Dialogs.ProgressDialogController wrapped) { _wrapped = wrapped; _wrapped.Canceled += (sender, args) => Canceled?.Invoke(this, EventArgs.Empty); _wrapped.Closed += (sender, args) => Closed?.Invoke(this, EventArgs.Empty); }
public static Tweet CreateTweet(MahApps.Twitter.Models.Tweet s, TwitterContact contact, IMicroblog source) { if (s.RetweetedStatus != null) return CreateRetweet(s, contact); if (contact.ImageUrl != new Uri(s.User.ProfileImageUrl)) contact.SetContactImage(new Uri(s.User.ProfileImageUrl), s.Created); contact.Bio = s.User.Description; contact.Following = s.User.FriendsCount; contact.Followers = s.User.FollowersCount; contact.FullName = s.User.Name; var t = new Tweet { ID = s.Id.ToString(), Contact = contact, Text = WebUtility.HtmlDecode(s.Text), Time = s.Created.ToLocalTime(), SourceUri = s.Source.GetSourceURL(), Source = s.Source.GetSourceText(), Favourite = s.Favourited, Microblog = source, }; if (s.Coordinates != null && s.Coordinates.Lat != null && s.Coordinates.Long != null) t.Location = new GeoLocation((double) s.Coordinates.Lat, (double) s.Coordinates.Long); if (s.InReplyToStatusId > 0) { t.InReplyToID = s.InReplyToStatusId.ToString(); t.InReplyTo = new Contact {Name = s.InReplyToScreenName}; } t.AddParent(source); return t; }