├── SocialStream ├── wix-app-icon.ico ├── Fonts │ └── segoeuil.ttf ├── Resources │ ├── icon.png │ ├── Audio │ │ ├── Audio.xgs │ │ ├── Audio.xsb │ │ ├── Audio.xwb │ │ └── Samples │ │ │ ├── adminPanel_open.wav │ │ │ ├── streamItem_close.wav │ │ │ ├── streamItem_flip.wav │ │ │ ├── streamItem_tapDown.wav │ │ │ └── streamItem_tapRelease.wav │ ├── AdminBackground.png │ ├── WindowBackground.png │ ├── WindowBackground_Vertical.png │ └── Converters.xaml ├── Properties │ ├── AssemblyInfo.cs │ └── DesignTimeResources.xaml ├── SocialStream.xml ├── App.xaml ├── Service References │ └── MicrosoftTagService │ │ ├── SocialStream.MicrosoftTagService.Tag.datasource │ │ ├── Reference.svcmap │ │ ├── Service1.xsd │ │ └── configuration.svcinfo ├── Helpers │ ├── ImageLoaderOptions.cs │ ├── ScatterFlip.cs │ ├── VisualEnumerable.cs │ ├── SurfaceState.cs │ ├── VisualTree.cs │ ├── TouchChangedEvents.cs │ └── Audio.cs ├── Controls │ ├── BackgroundImage.xaml │ ├── RiverItemVisibilityInfo.cs │ ├── AdminIndicatorLight.xaml │ ├── BackgroundImage.xaml.cs │ ├── UserSourceRoutedEventArgs.cs │ ├── RiverItemHistoryInfo.cs │ ├── RiverContent │ │ ├── SmallImage.xaml.cs │ │ ├── SmallNews.xaml.cs │ │ ├── SmallImage.xaml │ │ ├── SmallTweet.xaml.cs │ │ ├── LargeTweet.xaml.cs │ │ ├── SmallNews.xaml │ │ └── SmallTweet.xaml │ ├── AdminIndicatorLight.xaml.cs │ └── CloseTimer.cs ├── NativeMethods.cs ├── Converters │ ├── TitleCaseConverter.cs │ ├── BooleanConverter.cs │ ├── VisibilityConverter.cs │ ├── RelativeTimeConverter.cs │ └── MultiVisibilityConverter.cs ├── SurfaceWindow.xaml └── MouseTouchDevice.cs ├── SocialStream.ConfigTool ├── wix-app-icon.ico ├── Fonts │ ├── SegoeWP.ttf │ ├── SegoeWP-Bold.ttf │ └── SegoeWP-Light.ttf ├── Resources │ ├── BannerTop.png │ └── BannerBottom.png ├── CustomDictionary.xml ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ └── Settings.Designer.cs ├── Command │ ├── CancelCommand.cs │ ├── SaveCommand.cs │ ├── AddNewsBanCommand.cs │ ├── AddFlickrBanCommand.cs │ ├── AddNewsQueryCommand.cs │ ├── AddTwitterBanCommand.cs │ ├── AddFacebookBanCommand.cs │ ├── AddFlickrQueryCommand.cs │ ├── AddTwitterQueryCommand.cs │ ├── AddFacebookQueryCommand.cs │ ├── SetAutoScrollDirectionCommand.cs │ ├── RemoveNewsBanCommand.cs │ ├── RemoveFlickrBanCommand.cs │ ├── RemoveNewsQueryCommand.cs │ ├── RemoveTwitterBanCommand.cs │ ├── RemoveFacebookBanCommand.cs │ ├── RemoveFlickrQueryCommand.cs │ ├── RemoveTwitterQueryCommand.cs │ ├── RemoveFacebookQueryCommand.cs │ ├── SetEnableContentResizing.cs │ ├── SetProfanityFilterCommand.cs │ ├── SetDistributeContentEvenlyCommand.cs │ ├── LoadDefaultsCommand.cs │ ├── SetDisplayFbContentFromOthersCommand.cs │ └── SetBackgroundImagePathCommand.cs ├── App.xaml ├── Controls │ ├── MicrosoftTagEditor.xaml.cs │ ├── GeneralEditor.xaml.cs │ ├── ProfanityEditor.xaml.cs │ ├── MicrosoftTagEditor.xaml │ ├── NewsEditor.xaml.cs │ ├── FlickrEditor.xaml.cs │ └── TwitterEditor.xaml.cs ├── app.manifest ├── Settings.StyleCop ├── MainWindow.xaml ├── VO │ └── BindableStringVO.cs ├── app.config ├── MainWindow.xaml.cs ├── Helpers │ ├── BindableBase.cs │ └── VisualEnumerables.cs ├── Validators │ ├── IsValidQueryStringRule.cs │ ├── IsValidUriRule.cs │ ├── IsValidDoubleRule.cs │ ├── IsValidTimeSpanValueRule.cs │ ├── IsValidDateRule.cs │ ├── IsValidSizeRule.cs │ ├── IsValidHexValueRule.cs │ └── IsValidHexColorRule.cs ├── Converters │ ├── DoubleToPercentageConverter.cs │ ├── HexStringToLongConverter.cs │ ├── BooleanConverter.cs │ ├── IsEqualConverter.cs │ └── VisibilityConverter.cs ├── App.xaml.cs └── GlobalSuppressions.cs ├── FeedProcessor ├── packages.config ├── CustomDictionary.xml ├── Enums │ ├── RetrievalOrder.cs │ ├── ContentType.cs │ ├── SourceType.cs │ └── BlockReason.cs ├── FeedItems │ ├── StatusFeedItem.cs │ └── NewsFeedItem.cs ├── Contracts │ ├── TwitterJsonUser.cs │ └── TwitterJsonStatus.cs ├── GotNewFeedItemEventArgs.cs ├── SourceStatusUpdatedEventArgs.cs ├── Net │ ├── AsyncWebResultEventArgs.cs │ └── AsyncWebRequest.cs ├── CachePurgeEventArgs.cs ├── Settings.StyleCop ├── Feeds │ ├── FlickrGroupFeed.cs │ ├── FlickrUserFeed.cs │ └── TwitterUserFeed.cs ├── Properties │ └── AssemblyInfo.cs ├── GlobalSuppressions.cs └── FeedItem.cs ├── packages ├── Facebook.6.0.16 │ ├── lib │ │ ├── sl5 │ │ │ └── Facebook.dll │ │ ├── WinRT │ │ │ └── Facebook.dll │ │ ├── net45 │ │ │ └── Facebook.dll │ │ ├── net35-client │ │ │ └── Facebook.dll │ │ ├── net40-client │ │ │ └── Facebook.dll │ │ └── sl4-windowsphone71 │ │ │ └── Facebook.dll │ ├── Facebook.6.0.16.nupkg │ └── readme.txt └── repositories.config ├── SocialStream.Installer ├── Resources │ ├── wix-banner.jpg │ ├── wix-intro.jpg │ └── wix-app-icon.ico └── SocialStream.Installer.wixproj ├── .gitattributes ├── README.md ├── XAMLConverter └── HtmlTokenType.cs └── .gitignore /SocialStream/wix-app-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/wix-app-icon.ico -------------------------------------------------------------------------------- /SocialStream/Fonts/segoeuil.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Fonts/segoeuil.ttf -------------------------------------------------------------------------------- /SocialStream/Resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/icon.png -------------------------------------------------------------------------------- /SocialStream.ConfigTool/wix-app-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.ConfigTool/wix-app-icon.ico -------------------------------------------------------------------------------- /SocialStream/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /SocialStream/Resources/Audio/Audio.xgs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/Audio/Audio.xgs -------------------------------------------------------------------------------- /SocialStream/Resources/Audio/Audio.xsb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/Audio/Audio.xsb -------------------------------------------------------------------------------- /SocialStream/Resources/Audio/Audio.xwb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/Audio/Audio.xwb -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Fonts/SegoeWP.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.ConfigTool/Fonts/SegoeWP.ttf -------------------------------------------------------------------------------- /SocialStream/Resources/AdminBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/AdminBackground.png -------------------------------------------------------------------------------- /FeedProcessor/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SocialStream/Resources/WindowBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/WindowBackground.png -------------------------------------------------------------------------------- /packages/Facebook.6.0.16/lib/sl5/Facebook.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/packages/Facebook.6.0.16/lib/sl5/Facebook.dll -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Fonts/SegoeWP-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.ConfigTool/Fonts/SegoeWP-Bold.ttf -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Fonts/SegoeWP-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.ConfigTool/Fonts/SegoeWP-Light.ttf -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Resources/BannerTop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.ConfigTool/Resources/BannerTop.png -------------------------------------------------------------------------------- /SocialStream.Installer/Resources/wix-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.Installer/Resources/wix-banner.jpg -------------------------------------------------------------------------------- /SocialStream.Installer/Resources/wix-intro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.Installer/Resources/wix-intro.jpg -------------------------------------------------------------------------------- /packages/Facebook.6.0.16/Facebook.6.0.16.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/packages/Facebook.6.0.16/Facebook.6.0.16.nupkg -------------------------------------------------------------------------------- /packages/Facebook.6.0.16/lib/WinRT/Facebook.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/packages/Facebook.6.0.16/lib/WinRT/Facebook.dll -------------------------------------------------------------------------------- /packages/Facebook.6.0.16/lib/net45/Facebook.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/packages/Facebook.6.0.16/lib/net45/Facebook.dll -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Resources/BannerBottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.ConfigTool/Resources/BannerBottom.png -------------------------------------------------------------------------------- /SocialStream.Installer/Resources/wix-app-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream.Installer/Resources/wix-app-icon.ico -------------------------------------------------------------------------------- /SocialStream/Resources/WindowBackground_Vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/WindowBackground_Vertical.png -------------------------------------------------------------------------------- /packages/Facebook.6.0.16/lib/net35-client/Facebook.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/packages/Facebook.6.0.16/lib/net35-client/Facebook.dll -------------------------------------------------------------------------------- /packages/Facebook.6.0.16/lib/net40-client/Facebook.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/packages/Facebook.6.0.16/lib/net40-client/Facebook.dll -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SocialStream/Resources/Audio/Samples/adminPanel_open.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/Audio/Samples/adminPanel_open.wav -------------------------------------------------------------------------------- /SocialStream/Resources/Audio/Samples/streamItem_close.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/Audio/Samples/streamItem_close.wav -------------------------------------------------------------------------------- /SocialStream/Resources/Audio/Samples/streamItem_flip.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/Audio/Samples/streamItem_flip.wav -------------------------------------------------------------------------------- /SocialStream/Resources/Audio/Samples/streamItem_tapDown.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/Audio/Samples/streamItem_tapDown.wav -------------------------------------------------------------------------------- /packages/Facebook.6.0.16/lib/sl4-windowsphone71/Facebook.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/packages/Facebook.6.0.16/lib/sl4-windowsphone71/Facebook.dll -------------------------------------------------------------------------------- /SocialStream/Resources/Audio/Samples/streamItem_tapRelease.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimulant/SocialStream/HEAD/SocialStream/Resources/Audio/Samples/streamItem_tapRelease.wav -------------------------------------------------------------------------------- /SocialStream.ConfigTool/CustomDictionary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | flickr 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FeedProcessor/CustomDictionary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | flickr 6 | 7 | 8 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /SocialStream/Properties/DesignTimeResources.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/CancelCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace SocialStream.ConfigTool.Command 4 | { 5 | /// 6 | /// Called when the cancel button is clicked. 7 | /// 8 | internal static class CancelCommand 9 | { 10 | /// 11 | /// Exits the app. 12 | /// 13 | internal static void Execute() 14 | { 15 | Application.Current.Shutdown(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/SaveCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using SocialStream.ConfigTool.Model; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to save settings to disk. 8 | /// 9 | internal static class SaveCommand 10 | { 11 | /// 12 | /// Save settings to disk. 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.Save(); 17 | Application.Current.Shutdown(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/AddNewsBanCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to add an item to the NewsBans list 8 | /// 9 | internal static class AddNewsBanCommand 10 | { 11 | /// 12 | /// Adds a new blank item to NewsBans 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.NewsBans.Add(new BindableStringVO()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FeedProcessor/Enums/RetrievalOrder.cs: -------------------------------------------------------------------------------- 1 | namespace FeedProcessor.Enums 2 | { 3 | /// 4 | /// Defines the order in which items are retrieved from the feed processor. 5 | /// 6 | public enum RetrievalOrder 7 | { 8 | /// 9 | /// Items will be displayed in roughly chronological order. Whenever a new item arrives, it will be displayed as soon as possible. 10 | /// 11 | Chronological, 12 | 13 | /// 14 | /// Items will be displayed randomly. 15 | /// 16 | Random 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/AddFlickrBanCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to add an item to the FlickrBans list 8 | /// 9 | internal static class AddFlickrBanCommand 10 | { 11 | /// 12 | /// Adds a new blank item to FlickrBans 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.FlickrBans.Add(new BindableStringVO()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/AddNewsQueryCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to add a query to the NewsQueries list 8 | /// 9 | internal static class AddNewsQueryCommand 10 | { 11 | /// 12 | /// Adds a blank query to NewsQueries 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.NewsQueries.Add(new BindableStringVO()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/AddTwitterBanCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to add an item to the TwitterBans list 8 | /// 9 | internal static class AddTwitterBanCommand 10 | { 11 | /// 12 | /// Adds a new blank item to TwitterBans 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.TwitterBans.Add(new BindableStringVO()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/AddFacebookBanCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to add an item to the FacebookBans list 8 | /// 9 | internal static class AddFacebookBanCommand 10 | { 11 | /// 12 | /// Adds a new blank item to FacebookBans 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.FacebookBans.Add(new BindableStringVO()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/AddFlickrQueryCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to add a query to the FlickQueries list 8 | /// 9 | internal static class AddFlickrQueryCommand 10 | { 11 | /// 12 | /// Adds a blank query to FlickrQueries 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.FlickrQueries.Add(new BindableStringVO()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/AddTwitterQueryCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to add a query to the TwitterQueries list 8 | /// 9 | internal static class AddTwitterQueryCommand 10 | { 11 | /// 12 | /// Adds a blank query to TwitterQueries 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.TwitterQueries.Add(new BindableStringVO()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/AddFacebookQueryCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to add a query to the FacebookQueries list 8 | /// 9 | internal static class AddFacebookQueryCommand 10 | { 11 | /// 12 | /// Adds a blank query to FacebookQueries 13 | /// 14 | internal static void Execute() 15 | { 16 | AppState.Instance.FacebookQueries.Add(new BindableStringVO()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Controls/MicrosoftTagEditor.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | 5 | namespace SocialStream.ConfigTool.Controls 6 | { 7 | /// 8 | /// Interaction logic for MicrosoftTagEditor.xaml 9 | /// 10 | public partial class MicrosoftTagEditor : UserControl 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public MicrosoftTagEditor() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream/SocialStream.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Social Stream 5 | View the latest from Twitter, Flickr, and news feeds. 6 | %PROGRAMFILES%\Social Stream for Microsoft Surface\SocialStream.exe 7 | 8 | %PROGRAMFILES%\Social Stream for Microsoft Surface\Resources\icon.png 9 | 10 | -------------------------------------------------------------------------------- /SocialStream/Resources/Converters.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /FeedProcessor/Enums/ContentType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FeedProcessor.Enums 4 | { 5 | /// 6 | /// Different types of content that a feed item can describe. 7 | /// 8 | [Flags] 9 | public enum ContentType 10 | { 11 | /// 12 | /// The item is an image. 13 | /// 14 | Image = 1, 15 | 16 | /// 17 | /// The item is a status message. 18 | /// 19 | Status = 2, 20 | 21 | /// 22 | /// The item is a news post. 23 | /// 24 | News = 4 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/SetAutoScrollDirectionCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | 3 | namespace SocialStream.ConfigTool.Command 4 | { 5 | /// 6 | /// Called to set the AutoScrollDirection 7 | /// 8 | internal static class SetAutoScrollDirectionCommand 9 | { 10 | /// 11 | /// Sets the SetAutoScrollDirectionCommand property. 12 | /// 13 | /// The Direction. 14 | internal static void Execute(int Direction) 15 | { 16 | AppState.Instance.AutoScrollDirection = Direction; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/RemoveNewsBanCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to remove a query from the NewsBans list 8 | /// 9 | internal static class RemoveNewsBanCommand 10 | { 11 | /// 12 | /// Removes the specified item from NewsBans 13 | /// 14 | /// The query. 15 | internal static void Execute(BindableStringVO query) 16 | { 17 | AppState.Instance.NewsBans.Remove(query); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/RemoveFlickrBanCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to remove a query from the FlickrBans list 8 | /// 9 | internal static class RemoveFlickrBanCommand 10 | { 11 | /// 12 | /// Removes the specified item from FlickrBans 13 | /// 14 | /// The query. 15 | internal static void Execute(BindableStringVO query) 16 | { 17 | AppState.Instance.FlickrBans.Remove(query); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/RemoveNewsQueryCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to remove a query from the NewsQueries list 8 | /// 9 | internal static class RemoveNewsQueryCommand 10 | { 11 | /// 12 | /// Removes the specified item from NewsQueries 13 | /// 14 | /// The query. 15 | internal static void Execute(BindableStringVO query) 16 | { 17 | AppState.Instance.NewsQueries.Remove(query); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/RemoveTwitterBanCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to remove a query from the TwitterBans list 8 | /// 9 | internal static class RemoveTwitterBanCommand 10 | { 11 | /// 12 | /// Removes the specified item from TwitterBans 13 | /// 14 | /// The query. 15 | internal static void Execute(BindableStringVO query) 16 | { 17 | AppState.Instance.TwitterBans.Remove(query); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/RemoveFacebookBanCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to remove a query from the FacebookBans list 8 | /// 9 | internal static class RemoveFacebookBanCommand 10 | { 11 | /// 12 | /// Removes the specified item from FacebookBans 13 | /// 14 | /// The query. 15 | internal static void Execute(BindableStringVO query) 16 | { 17 | AppState.Instance.FacebookBans.Remove(query); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/RemoveFlickrQueryCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to remove a query from the FlickrQueries list 8 | /// 9 | internal static class RemoveFlickrQueryCommand 10 | { 11 | /// 12 | /// Removes the specified item from FlickrQueries 13 | /// 14 | /// The query. 15 | internal static void Execute(BindableStringVO query) 16 | { 17 | AppState.Instance.FlickrQueries.Remove(query); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/RemoveTwitterQueryCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to remove a query from the TwitterQueries list 8 | /// 9 | internal static class RemoveTwitterQueryCommand 10 | { 11 | /// 12 | /// Removes the specified item from TwitterQueries 13 | /// 14 | /// The query. 15 | internal static void Execute(BindableStringVO query) 16 | { 17 | AppState.Instance.TwitterQueries.Remove(query); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/RemoveFacebookQueryCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | using SocialStream.ConfigTool.VO; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to remove a query from the FacebookQueries list 8 | /// 9 | internal static class RemoveFacebookQueryCommand 10 | { 11 | /// 12 | /// Removes the specified item from FacebookQueries 13 | /// 14 | /// The query. 15 | internal static void Execute(BindableStringVO query) 16 | { 17 | AppState.Instance.FacebookQueries.Remove(query); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | False 8 | 9 | 10 | 11 | 12 | False 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /SocialStream/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /FeedProcessor/Enums/SourceType.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace FeedProcessor.Enums 3 | { 4 | /// 5 | /// Different types of sources that a news item can come from. 6 | /// 7 | public enum SourceType 8 | { 9 | /// 10 | /// The item came from Flickr. 11 | /// 12 | Flickr, 13 | 14 | /// 15 | /// The item came from twitter. 16 | /// 17 | Twitter, 18 | 19 | /// 20 | /// The item came from a news feed. 21 | /// 22 | News, 23 | 24 | /// 25 | /// The item came from Facebook. 26 | /// 27 | Facebook 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/SetEnableContentResizing.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | 3 | namespace SocialStream.ConfigTool.Command 4 | { 5 | /// 6 | /// Called to set whether to enable content resizing 7 | /// 8 | internal static class SetEnableContentResizingCommand 9 | { 10 | /// 11 | /// Sets the EnableContentResizing property. 12 | /// 13 | /// if set to true [enable content resizing]. 14 | internal static void Execute(bool enableContentResizing) 15 | { 16 | AppState.Instance.EnableContentResizing = enableContentResizing; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream/Service References/MicrosoftTagService/SocialStream.MicrosoftTagService.Tag.datasource: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | SocialStream.MicrosoftTagService.Tag, Service References.MicrosoftTagService.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/SetProfanityFilterCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | 3 | namespace SocialStream.ConfigTool.Command 4 | { 5 | /// 6 | /// Called to set whether the profanity filter is enabled 7 | /// 8 | internal static class SetProfanityFilterCommand 9 | { 10 | /// 11 | /// Sets the IsSafeSearchEnabled property. 12 | /// 13 | /// if set to true [is profanity filter enabled]. 14 | internal static void Execute(bool isProfanityFilterEnabled) 15 | { 16 | AppState.Instance.IsProfanityFilterEnabled = isProfanityFilterEnabled; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FeedProcessor/FeedItems/StatusFeedItem.cs: -------------------------------------------------------------------------------- 1 | using FeedProcessor.Enums; 2 | 3 | namespace FeedProcessor.FeedItems 4 | { 5 | /// 6 | /// Represents a feed item whose content is a status message. 7 | /// 8 | public class StatusFeedItem : FeedItem 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public StatusFeedItem() 14 | { 15 | ContentType = ContentType.Status; 16 | } 17 | 18 | /// 19 | /// Gets or sets the status message. 20 | /// 21 | /// The status message. 22 | public string Status { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/SetDistributeContentEvenlyCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | 3 | namespace SocialStream.ConfigTool.Command 4 | { 5 | /// 6 | /// Called to set whether or not to distribute content evenly. 7 | /// 8 | internal static class SetDistributeContentEvenlyCommand 9 | { 10 | /// 11 | /// Sets the DistributeContentEvenly property. 12 | /// 13 | /// if set to true [distribute content evenly]. 14 | internal static void Execute(bool distributeContentEvenly) 15 | { 16 | AppState.Instance.DistributeContentEvenly = distributeContentEvenly; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/LoadDefaultsCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using SocialStream.ConfigTool.Model; 3 | using SocialStream.ConfigTool.Properties; 4 | 5 | namespace SocialStream.ConfigTool.Command 6 | { 7 | /// 8 | /// Called to load default config values. 9 | /// 10 | internal static class LoadDefaultsCommand 11 | { 12 | /// 13 | /// Loads the default config values. 14 | /// 15 | internal static void Execute() 16 | { 17 | if (MessageBox.Show(Resources.DefaultsConfirmation, string.Empty, MessageBoxButton.OKCancel) == MessageBoxResult.OK) 18 | { 19 | AppState.Instance.LoadDefaults(); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SocialStream/Helpers/ImageLoaderOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SocialStream.Helpers 4 | { 5 | /// 6 | /// Options to pass to the background worker to tell it how to load the image. 7 | /// 8 | internal class ImageLoaderOptions 9 | { 10 | /// 11 | /// Gets or sets the URI to load. 12 | /// 13 | /// The URI to load. 14 | public Uri Uri { get; set; } 15 | 16 | /// 17 | /// Gets or sets the width to decode the image to. If -1, use the natural size of the image. 18 | /// 19 | /// The width to decode the image to. If -1, use the natural size of the image. 20 | public int DecodePixelWidth { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /FeedProcessor/Contracts/TwitterJsonUser.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace FeedProcessor.Contracts 4 | { 5 | /// 6 | /// A datacontract for deserializing users from twitter. 7 | /// 8 | [DataContract] 9 | public class TwitterJsonUser 10 | { 11 | /// 12 | /// Gets or sets the user's screen name. 13 | /// 14 | /// The screen_name. 15 | [DataMember] 16 | public string screen_name { get; set; } 17 | 18 | /// 19 | /// Gets or sets the url to the user's profile image. 20 | /// 21 | /// The profile_image_url. 22 | [DataMember] 23 | public string profile_image_url { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/SetDisplayFbContentFromOthersCommand.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.ConfigTool.Model; 2 | 3 | namespace SocialStream.ConfigTool.Command 4 | { 5 | /// 6 | /// Called to set whether to display content from other users on a facebook page 7 | /// 8 | internal static class SetDisplayFbContentFromOthersCommand 9 | { 10 | /// 11 | /// Sets the DisplayFbContentFromOthers property. 12 | /// 13 | /// if set to true [display fb content from others]. 14 | internal static void Execute(bool displayFbContentFromOthers) 15 | { 16 | AppState.Instance.DisplayFbContentFromOthers = displayFbContentFromOthers; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FeedProcessor/GotNewFeedItemEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace FeedProcessor 7 | { 8 | /// 9 | /// The EventArgs object passed along with the Feed.GotNewFeedItem event. 10 | /// 11 | internal class GotNewFeedItemEventArgs : EventArgs 12 | { 13 | /// 14 | /// The new feed item. 15 | /// 16 | internal readonly FeedItem FeedItem; 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// The new feed item. 22 | internal GotNewFeedItemEventArgs(FeedItem feedItem) 23 | { 24 | FeedItem = feedItem; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SocialStream 2 | ============ 3 | 4 | The Social Stream application is a "river of news" for Windows 7 touch screens (including the SUR40 product) which displays an endless stream of items from any Twitter, Flickr, and RSS feeds that have been configured. Content orients to the user when activated, and each item can be flipped over to reveal a Microsoft Tag on the back, which lets a visitor take the content with them outside of the venue. The app can be easily styled of match the brand of an event or venue, and administrators can remove objectionable content with no hassle. 5 | 6 | Installer: 7 | http://stimulant.io/products/ 8 | 9 | Blog post: 10 | http://stimulant.io/wp/index.php/blog/2011/09/microsoft-surface-live-stream/ 11 | 12 | Video: 13 | http://vimeo.com/15205677 14 | 15 | Microsoft Code Gallery: 16 | http://code.msdn.microsoft.com/Social-Stream-solution-b5f5b653 -------------------------------------------------------------------------------- /SocialStream/Controls/BackgroundImage.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /XAMLConverter/HtmlTokenType.cs: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | // 3 | // File: HtmlTokenType.cs 4 | // 5 | // Copyright (C) Microsoft Corporation. All rights reserved. 6 | // 7 | // Description: Definition of token types supported by HtmlLexicalAnalyzer 8 | // 9 | //--------------------------------------------------------------------------- 10 | 11 | namespace HTMLConverter 12 | { 13 | /// 14 | /// types of lexical tokens for html-to-xaml converter 15 | /// 16 | internal enum HtmlTokenType 17 | { 18 | OpeningTagStart, 19 | ClosingTagStart, 20 | TagEnd, 21 | EmptyTagEnd, 22 | EqualSign, 23 | Name, 24 | Atom, // any attribute value not in quotes 25 | Text, //text content when accepting text 26 | Comment, 27 | EOF, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /FeedProcessor/Enums/BlockReason.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace FeedProcessor.Enums 3 | { 4 | /// 5 | /// Reasons an item can be blocked from the feed. 6 | /// 7 | public enum BlockReason 8 | { 9 | /// 10 | /// The item is not blocked. 11 | /// 12 | None, 13 | 14 | /// 15 | /// The item is blocked due to profanity. 16 | /// 17 | Profanity, 18 | 19 | /// 20 | /// The item is blocked due to a negative keyword match. 21 | /// 22 | Keyword, 23 | 24 | /// 25 | /// The item is blocked due to a negative author match. 26 | /// 27 | Author, 28 | 29 | /// 30 | /// The item is blocked due to a negative URI match. 31 | /// 32 | Uri 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /FeedProcessor/SourceStatusUpdatedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace FeedProcessor 7 | { 8 | /// 9 | /// The EventArgs object passed along with the Processor.SourceStatusUpdated event. 10 | /// 11 | internal class SourceStatusUpdatedEventArgs : EventArgs 12 | { 13 | /// 14 | /// Whether or not the source is up. 15 | /// 16 | internal readonly bool IsSourceUp; 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// if set to true, the source is active. 22 | internal SourceStatusUpdatedEventArgs(bool isSourceUp) 23 | { 24 | IsSourceUp = isSourceUp; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/VO/BindableStringVO.cs: -------------------------------------------------------------------------------- 1 | using SocialStream.Helpers; 2 | 3 | namespace SocialStream.ConfigTool.VO 4 | { 5 | /// 6 | /// Enables change events for a single string field 7 | /// 8 | public class BindableStringVO : BindableBase 9 | { 10 | /// 11 | /// Backing store for StringValue. 12 | /// 13 | private string _StringValue = string.Empty; 14 | 15 | /// 16 | /// Gets or sets the StringValue. 17 | /// 18 | /// The query. 19 | public string StringValue 20 | { 21 | get 22 | { 23 | return _StringValue; 24 | } 25 | 26 | set 27 | { 28 | _StringValue = value; 29 | NotifyPropertyChanged("StringValue"); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverItemVisibilityInfo.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace SocialStream.Controls 3 | { 4 | /// 5 | /// Indicates whether an item should be visible, and whether or not it's in the looping part of the river. The looping part is the 6 | /// portion of the screen which is past the last column of the GridLayout. 7 | /// 8 | internal struct RiverItemVisibilityInfo 9 | { 10 | /// 11 | /// Gets or sets a value indicating whether this instance is visible. 12 | /// 13 | /// 14 | /// true if this instance is visible; otherwise, false. 15 | /// 16 | public bool IsVisible { get; set; } 17 | 18 | /// 19 | /// Gets or sets a value indicating whether this instance is looping. 20 | /// 21 | /// 22 | /// true if this instance is looping; otherwise, false. 23 | /// 24 | public bool IsLooping { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 5 12 | 13 | 14 | 10 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Command/SetBackgroundImagePathCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Surface.Presentation; 2 | using SocialStream.ConfigTool.Model; 3 | 4 | namespace SocialStream.ConfigTool.Command 5 | { 6 | /// 7 | /// Called to set the path of one of the background images. 8 | /// 9 | internal static class SetBackgroundImagePathCommand 10 | { 11 | /// 12 | /// Sets the path of one of the background images. 13 | /// 14 | /// The orientation. 15 | /// The path to the image file. 16 | internal static void Execute(Tilt orientation, string path) 17 | { 18 | if (orientation == Tilt.Vertical) 19 | { 20 | AppState.Instance.VerticalBackgroundPath = path; 21 | } 22 | else if (orientation == Tilt.Horizontal) 23 | { 24 | AppState.Instance.HorizontalBackgroundPath = path; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | using System.Windows; 10 | 11 | [assembly: AssemblyTitle("Social Stream for Microsoft® Surface® Configuration Tool")] 12 | [assembly: AssemblyDescription("")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("Microsoft")] 15 | [assembly: AssemblyProduct("Social Stream for Microsoft® Surface® Configuration Tool")] 16 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | [assembly: ComVisible(false)] 20 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] 21 | [assembly: AssemblyVersion("2.0.624.0")] 22 | [assembly: AssemblyFileVersion("2.0.624.0")] -------------------------------------------------------------------------------- /SocialStream/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SocialStream 5 | { 6 | /// 7 | /// Native methods. 8 | /// 9 | internal static class NativeMethods 10 | { 11 | /// 12 | /// The DeleteObject function deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid. 13 | /// 14 | /// A handle to a logical pen, brush, font, bitmap, region, or palette. 15 | /// If the function succeeds, the return value is nonzero. If the specified handle is not valid or is currently selected into a DC, the return value is zero. 16 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Interoperability", "CA1414:MarkBooleanPInvokeArgumentsWithMarshalAs", Justification = "Adding this attribute causes an error."), DllImport("gdi32.dll")] 17 | internal static extern bool DeleteObject(IntPtr hObject); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FeedProcessor/Net/AsyncWebResultEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | 4 | namespace FeedProcessor.Net 5 | { 6 | /// 7 | /// The EventArgs object passed in the AsyncWebRequest.Result event. 8 | /// 9 | internal class AsyncWebResultEventArgs : EventArgs 10 | { 11 | /// 12 | /// The response from the web service. 13 | /// 14 | internal readonly string Response; 15 | 16 | /// 17 | /// The status code from the web service. 18 | /// 19 | internal readonly HttpStatusCode Status; 20 | 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The response from the web service. 25 | /// The status code from the web service. 26 | internal AsyncWebResultEventArgs(string response, HttpStatusCode status) 27 | { 28 | Response = response; 29 | Status = status; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SocialStream/Controls/AdminIndicatorLight.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /FeedProcessor/CachePurgeEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace FeedProcessor 5 | { 6 | /// 7 | /// The EventArgs object passed along with the Processor.CachePurged event. 8 | /// 9 | public class CachePurgeEventArgs : EventArgs 10 | { 11 | /// 12 | /// Backing store for ValidData 13 | /// 14 | private readonly ReadOnlyCollection _validData; 15 | 16 | /// 17 | /// Gets the data remaining in the processor's cache. 18 | /// 19 | public ReadOnlyCollection ValidData 20 | { 21 | get { return _validData; } 22 | } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// The data remaining in the processor's cache. 28 | public CachePurgeEventArgs(ReadOnlyCollection validData) 29 | : base() 30 | { 31 | _validData = validData; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | using System.ComponentModel; 8 | using System.Windows; 9 | 10 | namespace SocialStream.ConfigTool 11 | { 12 | /// 13 | /// Interaction logic for the main window. 14 | /// 15 | public partial class MainWindow : Window 16 | { 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | public MainWindow() 21 | { 22 | Title = Properties.Resources.ProductName + " " + Properties.Resources.ConfigTool; 23 | 24 | if (!DesignerProperties.GetIsInDesignMode(this)) 25 | { 26 | // Allows for a big d:DesignHeight in Blend for easier editing. 27 | Height = 700; 28 | } 29 | 30 | InitializeComponent(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SocialStream/Controls/BackgroundImage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using System.Windows.Media; 3 | using Microsoft.Surface.Presentation; 4 | using Microsoft.Surface.Presentation.Input; 5 | 6 | namespace SocialStream.Controls 7 | { 8 | /// 9 | /// Interaction logic for BackgroundImage.xaml 10 | /// 11 | public partial class BackgroundImage : UserControl 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public BackgroundImage() 17 | { 18 | InitializeComponent(); 19 | 20 | InteractiveSurface.PrimarySurfaceDevice.TiltChanged += (sender, e) => UpdateBackground(); 21 | UpdateBackground(); 22 | } 23 | 24 | /// 25 | /// Updates the background image according to the tilt of the surface device. 26 | /// 27 | private void UpdateBackground() 28 | { 29 | _LayoutRoot.Background = Resources[InteractiveSurface.PrimarySurfaceDevice.Tilt == Tilt.Vertical ? "VerticalBackground" : "HorizontalBackground"] as ImageBrush; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.1 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SocialStream.ConfigTool.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /FeedProcessor/Contracts/TwitterJsonStatus.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace FeedProcessor.Contracts 4 | { 5 | /// 6 | /// A datacontract for deserializing a status message from twitter. 7 | /// 8 | [DataContract] 9 | public class TwitterJsonStatus 10 | { 11 | /// 12 | /// Gets or sets the date the tweet was posted. 13 | /// 14 | /// The created_at. 15 | [DataMember] 16 | public string created_at { get; set; } 17 | 18 | /// 19 | /// Gets or sets the user. 20 | /// 21 | /// The user. 22 | [DataMember] 23 | public TwitterJsonUser user { get; set; } 24 | 25 | /// 26 | /// Gets or sets the text of the tweet. 27 | /// 28 | /// The text. 29 | [DataMember] 30 | public string text { get; set; } 31 | 32 | /// 33 | /// Gets or sets the id of the twwet. 34 | /// 35 | /// The id. 36 | [DataMember] 37 | public string id { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SocialStream/Controls/UserSourceRoutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace SocialStream.Controls 4 | { 5 | /// 6 | /// A RoutedEventArgs type which allows the specification of a custom source object. 7 | /// 8 | public class UserSourceRoutedEventArgs : RoutedEventArgs 9 | { 10 | /// 11 | /// Backing store for UserSource. 12 | /// 13 | private DependencyObject _userSource; 14 | 15 | /// 16 | /// Gets the custom source object. 17 | /// 18 | /// The custom source object. 19 | public DependencyObject UserSource 20 | { 21 | get { return _userSource; } 22 | } 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// The routed event. 28 | /// The custom source object. 29 | public UserSourceRoutedEventArgs(RoutedEvent routedEvent, DependencyObject source) 30 | : base(routedEvent) 31 | { 32 | _userSource = source; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Controls/GeneralEditor.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | using SocialStream.ConfigTool.Command; 5 | 6 | namespace SocialStream.ConfigTool.Controls 7 | { 8 | /// 9 | /// Interaction logic for GeneralEditor.xaml 10 | /// 11 | public partial class GeneralEditor : UserControl 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public GeneralEditor() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | /// 22 | /// Handles the Checked event of the Radio control. 23 | /// 24 | /// The source of the event. 25 | /// The instance containing the event data. 26 | private void Radio_Checked(object sender, RoutedEventArgs e) 27 | { 28 | RadioButton radio = sender as RadioButton; 29 | if (!radio.IsLoaded) 30 | { 31 | return; 32 | } 33 | 34 | SetEnableContentResizingCommand.Execute(bool.Parse(radio.Tag.ToString())); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Controls/ProfanityEditor.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | using SocialStream.ConfigTool.Command; 5 | 6 | namespace SocialStream.ConfigTool.Controls 7 | { 8 | /// 9 | /// Interaction logic for ProfanityEditor.xaml 10 | /// 11 | public partial class ProfanityEditor : UserControl 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public ProfanityEditor() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | /// 22 | /// Handles the Checked event of the Radio control. 23 | /// 24 | /// The source of the event. 25 | /// The instance containing the event data. 26 | private void Radio_Checked(object sender, RoutedEventArgs e) 27 | { 28 | RadioButton radio = sender as RadioButton; 29 | if (!radio.IsLoaded) 30 | { 31 | return; 32 | } 33 | 34 | SetProfanityFilterCommand.Execute(bool.Parse(radio.Tag.ToString())); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /FeedProcessor/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | False 8 | 9 | 10 | 11 | 12 | False 13 | 14 | 15 | 16 | 17 | False 18 | 19 | 20 | 21 | 22 | False 23 | 24 | 25 | 26 | 27 | False 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Helpers/BindableBase.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | using System.ComponentModel; 8 | 9 | namespace SocialStream.Helpers 10 | { 11 | /// 12 | /// Base class for anything implementing INotifyPropertyChanged. 13 | /// 14 | public abstract class BindableBase : INotifyPropertyChanged 15 | { 16 | #region INotifyPropertyChanged Members 17 | 18 | /// 19 | /// Occurs when a property value changes. 20 | /// 21 | public event PropertyChangedEventHandler PropertyChanged; 22 | 23 | /// 24 | /// Utility method for firing the PropertyChanged event. 25 | /// 26 | /// Name of the property. 27 | protected void NotifyPropertyChanged(string propertyName) 28 | { 29 | if (PropertyChanged != null) 30 | { 31 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 32 | } 33 | } 34 | 35 | #endregion 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /FeedProcessor/FeedItems/NewsFeedItem.cs: -------------------------------------------------------------------------------- 1 | using FeedProcessor.Enums; 2 | 3 | namespace FeedProcessor.FeedItems 4 | { 5 | /// 6 | /// Represnets a feed item coming from an RSS or ATOM news feed. 7 | /// 8 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "NewsFeed", Justification = "We like it this way.")] 9 | public class NewsFeedItem : FeedItem 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | public NewsFeedItem() 15 | { 16 | ContentType = ContentType.News; 17 | } 18 | 19 | /// 20 | /// Gets or sets the title of the post. 21 | /// 22 | /// The title of the post. 23 | public string Title { get; set; } 24 | 25 | /// 26 | /// Gets or sets the summary of the post. 27 | /// 28 | /// The summary of the post. 29 | public string Summary { get; set; } 30 | 31 | /// 32 | /// Gets or sets the body of the post. This can contain HTML. 33 | /// 34 | /// The body of the post. 35 | public string Body { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Validators/IsValidQueryStringRule.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Linq; 3 | using System.Windows.Controls; 4 | 5 | namespace SocialStream.ConfigTool.Validators 6 | { 7 | /// 8 | /// A validation rule for category namees. 9 | /// 10 | public class IsValidQueryStringRule : ValidationRule 11 | { 12 | /// 13 | /// When overridden in a derived class, performs validation checks on a value. 14 | /// 15 | /// The value from the binding target to check. 16 | /// The culture to use in this rule. 17 | /// 18 | /// A object. 19 | /// 20 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 21 | { 22 | string val = value as string; 23 | if (val == null || string.IsNullOrWhiteSpace(val)) 24 | { 25 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.QueryStringEmpty); 26 | } 27 | 28 | if (val.Contains(',')) 29 | { 30 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.QueryStringComma); 31 | } 32 | 33 | return ValidationResult.ValidResult; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Validators/IsValidUriRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | 5 | namespace SocialStream.ConfigTool.Validators 6 | { 7 | /// 8 | /// A validation rule for a Uri. 9 | /// 10 | public class IsValidUriRule : ValidationRule 11 | { 12 | /// 13 | /// When overridden in a derived class, performs validation checks on a value. 14 | /// 15 | /// The value from the binding target to check. 16 | /// The culture to use in this rule. 17 | /// 18 | /// A object. 19 | /// 20 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 21 | { 22 | string val = value as string; 23 | 24 | if (val == null || string.IsNullOrWhiteSpace(val)) 25 | { 26 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.UriError); 27 | } 28 | 29 | if (Uri.IsWellFormedUriString(val, UriKind.Absolute)) 30 | { 31 | return ValidationResult.ValidResult; 32 | } 33 | else 34 | { 35 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.UriError); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /FeedProcessor/Feeds/FlickrGroupFeed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace FeedProcessor.Feeds 5 | { 6 | /// 7 | /// Handles the request and processing of Flickr images which are specified by group names. 8 | /// 9 | internal class FlickrGroupFeed : FlickrSearchFeed 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | /// The flickr API key. 15 | /// The requested polling interval. 16 | /// The minimum allowed date of a returned item. 17 | internal FlickrGroupFeed(string flickrApiKey, TimeSpan pollInterval, DateTime minDate) 18 | : base(flickrApiKey, TimeSpan.FromMilliseconds(Math.Max(pollInterval.TotalMilliseconds, MinPollingInterval.TotalMilliseconds)), minDate) 19 | { 20 | } 21 | 22 | /// 23 | /// Builds the query that is passed to the feed service. 24 | /// 25 | /// The query URI. 26 | internal override Uri BuildQuery() 27 | { 28 | return new Uri(string.Format(CultureInfo.InvariantCulture, "http://api.flickr.com/services/rest/?method=flickr.groups.pools.getPhotos&api_key={0}&page=1&sort=date-posted-desc&per_page={1}&extras=icon_server,description,date_upload,date_taken,owner_name,path_alias&group_id={2}", FlickrApiKey, PageSize, Query)); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /FeedProcessor/Feeds/FlickrUserFeed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace FeedProcessor.Feeds 5 | { 6 | /// 7 | /// Handles the request and processing of Flickr images which are specified by user names. 8 | /// 9 | internal class FlickrUserFeed : FlickrSearchFeed 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | /// The flickr API key. 15 | /// The requested polling interval. 16 | /// The minimum allowed date of a returned item. 17 | internal FlickrUserFeed(string flickrApiKey, TimeSpan pollInterval, DateTime minDate) 18 | : base(flickrApiKey, TimeSpan.FromMilliseconds(Math.Max(pollInterval.TotalMilliseconds, MinPollingInterval.TotalMilliseconds)), minDate) 19 | { 20 | } 21 | 22 | /// 23 | /// Builds the query that is passed to the feed service. 24 | /// 25 | /// The query URI. 26 | internal override Uri BuildQuery() 27 | { 28 | return new Uri(string.Format(CultureInfo.InvariantCulture, "http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key={0}&page=1&sort=date-posted-desc&per_page={1}&extras=icon_server,description,date_upload,date_taken,owner_name,path_alias&user_id={2}", FlickrApiKey, PageSize, Query)); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /FeedProcessor/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FeedProcessor")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("FeedProcessor")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e308ee88-8848-4bcd-a811-ffb8c2eedbaf")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Validators/IsValidDoubleRule.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Windows.Controls; 3 | 4 | namespace SocialStream.ConfigTool.Validators 5 | { 6 | /// 7 | /// A validation rule for a double. 8 | /// 9 | public class IsValidDoubleRule : ValidationRule 10 | { 11 | /// 12 | /// When overridden in a derived class, performs validation checks on a value. 13 | /// 14 | /// The value from the binding target to check. 15 | /// The culture to use in this rule. 16 | /// 17 | /// A object. 18 | /// 19 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 20 | { 21 | string val = value as string; 22 | 23 | if (val == null || string.IsNullOrWhiteSpace(val)) 24 | { 25 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.NumberError); 26 | } 27 | 28 | double parsed; 29 | if (double.TryParse(val, NumberStyles.Float, CultureInfo.InvariantCulture, out parsed)) 30 | { 31 | return ValidationResult.ValidResult; 32 | } 33 | else 34 | { 35 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.NumberError); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverItemHistoryInfo.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace SocialStream.Controls 3 | { 4 | /// 5 | /// Describes the state of a river item in the past, allowing that state to be restored when the user scrolls the river. 6 | /// 7 | internal class RiverItemHistoryInfo 8 | { 9 | /// 10 | /// Gets or sets the river item definition, which defines the size and position of the element in the river. 11 | /// 12 | /// The river item definition, which defines the size and position of the element in the river. 13 | public RiverItemState State { get; set; } 14 | 15 | /// 16 | /// Gets or sets a value indicating how many loops that the river's grid had made at this point in the history. 17 | /// 18 | /// The value indicating how many loops that the river's grid had made at this point in the history. 19 | public int Grid { get; set; } 20 | 21 | /// 22 | /// Gets or sets the data that the river item was rendering on this page. 23 | /// 24 | /// The data that the river item was rendering on this page. 25 | public object Data { get; set; } 26 | 27 | /// 28 | /// Gets or sets the orientation that the river item was rotated to on this page. 29 | /// 30 | /// The orientation that the river item was rotated to on this page. 31 | public double Orientation { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Validators/IsValidTimeSpanValueRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | 5 | namespace SocialStream.ConfigTool.Validators 6 | { 7 | /// 8 | /// A validation rule for a hex number. 9 | /// 10 | public class IsValidTimeSpanValueRule : ValidationRule 11 | { 12 | /// 13 | /// When overridden in a derived class, performs validation checks on a value. 14 | /// 15 | /// The value from the binding target to check. 16 | /// The culture to use in this rule. 17 | /// 18 | /// A object. 19 | /// 20 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 21 | { 22 | string val = value as string; 23 | 24 | if (val == null || string.IsNullOrWhiteSpace(val)) 25 | { 26 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.TimeSpanError); 27 | } 28 | 29 | TimeSpan parsed; 30 | if (TimeSpan.TryParse(val, CultureInfo.InvariantCulture, out parsed)) 31 | { 32 | return ValidationResult.ValidResult; 33 | } 34 | else 35 | { 36 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.TimeSpanError); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Validators/IsValidDateRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | 5 | namespace SocialStream.ConfigTool.Validators 6 | { 7 | /// 8 | /// A validation rule for a hex number. 9 | /// 10 | public class IsValidDateTimeValueRule : ValidationRule 11 | { 12 | /// 13 | /// When overridden in a derived class, performs validation checks on a value. 14 | /// 15 | /// The value from the binding target to check. 16 | /// The culture to use in this rule. 17 | /// 18 | /// A object. 19 | /// 20 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 21 | { 22 | string val = value as string; 23 | 24 | if (val == null || string.IsNullOrWhiteSpace(val)) 25 | { 26 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.DateTimeError); 27 | } 28 | 29 | DateTime parsed; 30 | if (DateTime.TryParse(val, CultureInfo.InvariantCulture, DateTimeStyles.None, out parsed)) 31 | { 32 | return ValidationResult.ValidResult; 33 | } 34 | else 35 | { 36 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.DateTimeError); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Validators/IsValidSizeRule.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace SocialStream.ConfigTool.Validators 6 | { 7 | /// 8 | /// A validation rule for a size. 9 | /// 10 | public class IsValidSizeRule : ValidationRule 11 | { 12 | /// 13 | /// When overridden in a derived class, performs validation checks on a value. 14 | /// 15 | /// The value from the binding target to check. 16 | /// The culture to use in this rule. 17 | /// 18 | /// A object. 19 | /// 20 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Really do want all exceptions.")] 21 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 22 | { 23 | string val = value as string; 24 | 25 | if (val == null || string.IsNullOrWhiteSpace(val)) 26 | { 27 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.SizeError); 28 | } 29 | 30 | try 31 | { 32 | Size.Parse(val); 33 | return ValidationResult.ValidResult; 34 | } 35 | catch 36 | { 37 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.SizeError); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverContent/SmallImage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using FeedProcessor.FeedItems; 6 | 7 | namespace SocialStream.Controls.RiverContent 8 | { 9 | /// 10 | /// A river item which shows the small version of image feed items. 11 | /// 12 | public partial class SmallImage : UserControl 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public SmallImage() 18 | { 19 | InitializeComponent(); 20 | 21 | if (DesignerProperties.GetIsInDesignMode(this)) 22 | { 23 | return; 24 | } 25 | 26 | SizeChanged += (sender, e) => _posted.Visibility = _author.Visibility = ActualWidth > 100 ? Visibility.Visible : Visibility.Collapsed; 27 | Unloaded += (sender, e) => Image.ImageLoaded -= Image_ImageLoaded; 28 | } 29 | 30 | /// 31 | /// Handles the ImageLoaded event of the Image control. 32 | /// 33 | /// The source of the event. 34 | /// The instance containing the event data. 35 | private void Image_ImageLoaded(object sender, EventArgs e) 36 | { 37 | Image.ImageLoaded -= Image_ImageLoaded; 38 | if (Image.BitmapImage != null) 39 | { 40 | (DataContext as ImageFeedItem).ThumbnailSize = new Size(Image.BitmapImage.PixelWidth, Image.BitmapImage.PixelHeight); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SocialStream/Helpers/ScatterFlip.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace SocialStream.Helpers 4 | { 5 | /// 6 | /// Provides a "Flipped" attached property, used on flipping ScatterViewItems. 7 | /// 8 | public static class ScatterFlip 9 | { 10 | #region IsFlipped 11 | 12 | /// 13 | /// Gets the value of the IsFlipped attached property. 14 | /// 15 | /// The element from which to read the property value. 16 | /// The value of the IsFlipped attached property. 17 | public static bool GetIsFlipped(DependencyObject obj) 18 | { 19 | if (obj == null) 20 | { 21 | return false; 22 | } 23 | 24 | return (bool)obj.GetValue(IsFlippedProperty); 25 | } 26 | 27 | /// 28 | /// Sets the value of the IsFlipped attached property. 29 | /// 30 | /// The element on which to set the IsFlipped attached property. 31 | /// The property value to set. 32 | public static void SetIsFlipped(DependencyObject obj, bool value) 33 | { 34 | if (obj == null) 35 | { 36 | return; 37 | } 38 | 39 | obj.SetValue(IsFlippedProperty, value); 40 | } 41 | 42 | /// 43 | /// Identifies the IsFlipped attached property. 44 | /// 45 | public static readonly DependencyProperty IsFlippedProperty = DependencyProperty.RegisterAttached("IsFlipped", typeof(bool), typeof(ScatterFlip), new UIPropertyMetadata(false)); 46 | 47 | #endregion 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Validators/IsValidHexValueRule.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | using System.Globalization; 8 | using System.Windows.Controls; 9 | 10 | namespace SocialStream.ConfigTool.Validators 11 | { 12 | /// 13 | /// A validation rule for a hex number. 14 | /// 15 | public class IsValidHexValueRule : ValidationRule 16 | { 17 | /// 18 | /// When overridden in a derived class, performs validation checks on a value. 19 | /// 20 | /// The value from the binding target to check. 21 | /// The culture to use in this rule. 22 | /// 23 | /// A object. 24 | /// 25 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 26 | { 27 | string val = value as string; 28 | 29 | if (val == null || string.IsNullOrWhiteSpace(val)) 30 | { 31 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.HexError); 32 | } 33 | 34 | long parsed; 35 | if (long.TryParse(val, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out parsed)) 36 | { 37 | return ValidationResult.ValidResult; 38 | } 39 | else 40 | { 41 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.HexError); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SocialStream/Controls/AdminIndicatorLight.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace SocialStream.Controls 6 | { 7 | /// 8 | /// Interaction logic for AdminIndicatorLight.xaml 9 | /// 10 | public partial class AdminIndicatorLight : UserControl 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public AdminIndicatorLight() 16 | { 17 | InitializeComponent(); 18 | 19 | if (DesignerProperties.GetIsInDesignMode(this)) 20 | { 21 | return; 22 | } 23 | 24 | UpdateIsOn(); 25 | } 26 | 27 | #region IsOn 28 | 29 | /// 30 | /// Gets or sets a value indicating whether this instance is on. 31 | /// 32 | /// true if this instance is on; otherwise, false. 33 | public bool IsOn 34 | { 35 | get { return (bool)GetValue(IsOnProperty); } 36 | set { SetValue(IsOnProperty, value); } 37 | } 38 | 39 | /// 40 | /// Identifies the IsOn dependency property. 41 | /// 42 | public static readonly DependencyProperty IsOnProperty = DependencyProperty.Register("IsOn", typeof(bool), typeof(AdminIndicatorLight), new PropertyMetadata(false, (sender, e) => (sender as AdminIndicatorLight).UpdateIsOn())); 43 | 44 | /// 45 | /// Updates the visual state when IsOn changes. 46 | /// 47 | private void UpdateIsOn() 48 | { 49 | VisualStateManager.GoToState(this, IsOn ? OnState.Name : OffState.Name, true); 50 | } 51 | 52 | #endregion 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Validators/IsValidHexColorRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | 5 | namespace SocialStream.ConfigTool.Validators 6 | { 7 | /// 8 | /// A validation rule for a hex number. 9 | /// 10 | public class IsValidHexColorRule : ValidationRule 11 | { 12 | /// 13 | /// When overridden in a derived class, performs validation checks on a value. 14 | /// 15 | /// The value from the binding target to check. 16 | /// The culture to use in this rule. 17 | /// 18 | /// A object. 19 | /// 20 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 21 | { 22 | string val = value as string; 23 | 24 | if (val == null || string.IsNullOrWhiteSpace(val)) 25 | { 26 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.HexColorError); 27 | } 28 | 29 | if (val.Length < 9 || !val.StartsWith("#", StringComparison.OrdinalIgnoreCase)) 30 | { 31 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.HexColorError); 32 | } 33 | 34 | long parsed; 35 | string numpart = val.Replace("#", string.Empty); 36 | if (long.TryParse(numpart, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out parsed)) 37 | { 38 | return ValidationResult.ValidResult; 39 | } 40 | else 41 | { 42 | return new ValidationResult(false, SocialStream.ConfigTool.Properties.Resources.HexColorError); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /FeedProcessor/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | // 6 | // To add a suppression to this file, right-click the message in the 7 | // Error List, point to "Suppress Message(s)", and click 8 | // "In Project Suppression File". 9 | // You do not need to add suppressions to this file manually. 10 | 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")] 12 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "FeedProcessor")] 13 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "FeedProcessor.Enums")] 14 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "FeedProcessor.FeedItems")] 15 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")] 16 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames", Scope = "type", Target = "FeedProcessor.Enums.ContentType")] 17 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "FeedProcessor.Contracts")] 18 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Username", Scope = "member", Target = "FeedProcessor.Processor.#.ctor(System.String,System.TimeSpan,System.String,System.String,System.TimeSpan,System.DateTime)")] 19 | -------------------------------------------------------------------------------- /SocialStream/Helpers/VisualEnumerable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Windows; 4 | using System.Windows.Media; 5 | 6 | namespace SocialStream.Helpers 7 | { 8 | /// 9 | /// Helper methods for enumerating the visual children of a given root element. 10 | /// 11 | public static class VisualEnumerable 12 | { 13 | /// 14 | /// Gets the Visual Tree filtered by Type for a DependencyObject with that DependencyObject as the root. 15 | /// http://petermcg.wordpress.com/2009/03/04/linq-to-visual-tree-beta/ 16 | /// 17 | /// The type to search for. 18 | /// The root element of the search. 19 | /// The search results. 20 | public static IEnumerable GetVisualOfType(this DependencyObject element) 21 | { 22 | return GetVisualTree(element).Where(t => t.GetType() == typeof(T) || t.GetType().IsSubclassOf(typeof(T))).Cast(); 23 | } 24 | 25 | /// 26 | /// Gets the Visual Tree for a DependencyObject with that DependencyObject as the root. 27 | /// http://petermcg.wordpress.com/2009/03/04/linq-to-visual-tree-beta/ 28 | /// 29 | /// The root element of the search. 30 | /// The search results. 31 | public static IEnumerable GetVisualTree(this DependencyObject element) 32 | { 33 | int childrenCount = VisualTreeHelper.GetChildrenCount(element); 34 | 35 | for (int i = 0; i < childrenCount; i++) 36 | { 37 | var visualChild = VisualTreeHelper.GetChild(element, i); 38 | 39 | yield return visualChild; 40 | 41 | foreach (var visualChildren in GetVisualTree(visualChild)) 42 | { 43 | yield return visualChildren; 44 | } 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /packages/Facebook.6.0.16/readme.txt: -------------------------------------------------------------------------------- 1 | # Facebook C# SDK 2 | The Facebook C# SDK helps .Net developers build web, desktop, Silverlight, Windows Phone and Windows Metro Style applications that integrate with Facebook. 3 | 4 | [Like us on Facebook at our official page](http://facebook.com/csharpsdk) or [Follow us on twitter @chsarpsdk](http://twitter.com/csharpsdk). 5 | 6 | ## NuGet 7 | 8 | Install-Package Facebook 9 | 10 | *Binaries for Facebook C# SDK are only distributed via nuget. For those using older versions of Visual Studio that 11 | does not support NuGet Package Manager, please download the command line version of NuGet.exe and run the following 12 | command.* 13 | 14 | nuget install facebook 15 | 16 | If you would like to get an older version of the the binaries please use the following command. 17 | 18 | nuget install facebook -v 5.4.1 19 | 20 | ## Documentation 21 | You can find the documentation for this project at [http://csharpsdk.org](http://csharpsdk.org). 22 | 23 | ## Help and Support 24 | Use [facebook.stackoverflow.com](http://facebook.stackoverflow.com) for help and support. We answer questions there regularly. Use the tags '[facebook-c#-sdk](http://stackoverflow.com/questions/tagged/facebook-c%23-sdk)' and '[facebook](http://stackoverflow.com/questions/tagged/facebook)' plus any other tags that are relevant. If you have a feature request or bug create an issue. 25 | 26 | [Facebook Platform Status](https://developers.facebook.com/live_status) 27 | 28 | [Facebook Change Log](https://developers.facebook.com/docs/changelog/) 29 | 30 | ## Features 31 | * NuGet Packages Available (Facebook) 32 | * Compatible with all Facebook Graph and REST API methods. 33 | * Supports Facebook’s most current authentication systems. 34 | * Sample applications and documentation are provided to get you started quickly. 35 | 36 | ## Supported Platforms 37 | * .NET 3.5 (Client Profile and Full Profile) 38 | * .NET 4.0 (Client Profile and Full Profile) 39 | * .NET 4.5 Beta (Visual Studio 11 Beta) 40 | * Windows 8 Metro Style Applications - WinRT (Windows 8 Consumer Preview) 41 | * Silverlight 5 42 | * Windows Phone 7.1 (Mango) 43 | 44 | 45 | -------------------------------------------------------------------------------- /SocialStream/Converters/TitleCaseConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Threading; 4 | using System.Windows.Data; 5 | 6 | namespace SocialStream.Converters 7 | { 8 | /// 9 | /// Convert the given value to title case. 10 | /// 11 | public class TitleCaseConverter : IValueConverter 12 | { 13 | /// 14 | /// Converts a value. 15 | /// 16 | /// The value produced by the binding source. 17 | /// The type of the binding target property. 18 | /// The converter parameter to use. 19 | /// The culture to use in the converter. 20 | /// 21 | /// A converted value. If the method returns null, the valid null value is used. 22 | /// 23 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | if (value == null) 26 | { 27 | return string.Empty; 28 | } 29 | 30 | if (culture == null) 31 | { 32 | culture = Thread.CurrentThread.CurrentUICulture; 33 | } 34 | 35 | return culture.TextInfo.ToTitleCase(value.ToString()); 36 | } 37 | 38 | /// 39 | /// Converts a value. 40 | /// 41 | /// The value that is produced by the binding target. 42 | /// The type to convert to. 43 | /// The converter parameter to use. 44 | /// The culture to use in the converter. 45 | /// 46 | /// A converted value. If the method returns null, the valid null value is used. 47 | /// 48 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 49 | { 50 | throw new NotSupportedException(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /FeedProcessor/FeedItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FeedProcessor.Enums; 3 | 4 | namespace FeedProcessor 5 | { 6 | /// 7 | /// Represents an item in a feed. 8 | /// 9 | public abstract class FeedItem 10 | { 11 | /// 12 | /// Gets or sets the source URI of the item. 13 | /// 14 | /// The source URI of the item. 15 | public Uri Uri { get; set; } 16 | 17 | /// 18 | /// Gets or sets the date on which the item was published. 19 | /// 20 | /// The date on which the item was published. 21 | public DateTime Date { get; set; } 22 | 23 | /// 24 | /// Gets or sets the author of the item. 25 | /// 26 | /// The author of the item. 27 | public string Author { get; set; } 28 | 29 | /// 30 | /// Gets or sets the URI to the author's avatar image. 31 | /// 32 | /// The URI to the author's avatar image. 33 | public Uri AvatarUri { get; set; } 34 | 35 | /// 36 | /// Gets or sets the type of the source. 37 | /// 38 | /// The type of the source. 39 | public SourceType SourceType { get; set; } 40 | 41 | /// 42 | /// Gets or sets the type of the content. 43 | /// 44 | /// The type of the content. 45 | public ContentType ContentType { get; set; } 46 | 47 | /// 48 | /// Gets or sets the reason this item is blocked from the results. 49 | /// 50 | /// The reason this item is blocked from the results. 51 | public BlockReason BlockReason { get; set; } 52 | 53 | /// 54 | /// Gets or sets the unique ID provided by the web service for this item. 55 | /// 56 | /// The unique ID provided by the web service for this item. 57 | public string ServiceId { get; set; } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SocialStream/Service References/MicrosoftTagService/Reference.svcmap: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | true 6 | 7 | false 8 | true 9 | false 10 | 11 | 12 | true 13 | Auto 14 | true 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Converters/DoubleToPercentageConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace SocialStream.ConfigTool.Converters 6 | { 7 | /// 8 | /// Convert between a hex string and a long. 9 | /// 10 | public class DoubleToPercentageConverter : IValueConverter 11 | { 12 | /// 13 | /// Converts a value. 14 | /// 15 | /// The value produced by the binding source. 16 | /// The type of the binding target property. 17 | /// The converter parameter to use. 18 | /// The culture to use in the converter. 19 | /// 20 | /// A converted value. If the method returns null, the valid null value is used. 21 | /// 22 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | if (value == null) 25 | { 26 | return string.Empty; 27 | } 28 | 29 | double percentVal; 30 | if (!double.TryParse(value.ToString(), out percentVal)) 31 | { 32 | return string.Empty; 33 | } 34 | 35 | percentVal *= 100; 36 | 37 | return Math.Round(percentVal).ToString(CultureInfo.InvariantCulture) + "%"; 38 | } 39 | 40 | /// 41 | /// Converts a value. 42 | /// 43 | /// The value that is produced by the binding target. 44 | /// The type to convert to. 45 | /// The converter parameter to use. 46 | /// The culture to use in the converter. 47 | /// 48 | /// A converted value. If the method returns null, the valid null value is used. 49 | /// 50 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 51 | { 52 | throw new NotImplementedException(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SocialStream/Converters/BooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace SocialStream.Converters 7 | { 8 | /// 9 | /// Convert most values to a boolean. Pass any parameter to flip the behavior. 10 | /// 11 | public class BooleanConverter : IValueConverter 12 | { 13 | /// 14 | /// Use a VisibilityConverter to do the actual conversion. 15 | /// 16 | private static VisibilityConverter _visibilityConverter; 17 | 18 | /// 19 | /// Converts a value. 20 | /// 21 | /// The value produced by the binding source. 22 | /// The type of the binding target property. 23 | /// The converter parameter to use. 24 | /// The culture to use in the converter. 25 | /// 26 | /// A converted value. If the method returns null, the valid null value is used. 27 | /// 28 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | if (_visibilityConverter == null) 31 | { 32 | _visibilityConverter = new VisibilityConverter(); 33 | } 34 | 35 | return (Visibility)_visibilityConverter.Convert(value, targetType, parameter, culture) == Visibility.Visible; 36 | } 37 | 38 | /// 39 | /// Converts a value. 40 | /// 41 | /// The value that is produced by the binding target. 42 | /// The type to convert to. 43 | /// The converter parameter to use. 44 | /// The culture to use in the converter. 45 | /// 46 | /// A converted value. If the method returns null, the valid null value is used. 47 | /// 48 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 49 | { 50 | throw new NotSupportedException(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /SocialStream/SurfaceWindow.xaml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SocialStream/Helpers/SurfaceState.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Microsoft.Win32; 3 | 4 | namespace SocialStream.Helpers 5 | { 6 | /// 7 | /// Helper properties for getting info about the current Surface environment. 8 | /// 9 | internal static class SurfaceState 10 | { 11 | /// 12 | /// The key which stores whether or not the system is running in single application mode. 13 | /// 14 | private const string ShellRegKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Surface\v1.0\Shell"; 15 | 16 | /// 17 | /// Gets a value indicating whether the app is running in Single Application Mode. 18 | /// 19 | /// 20 | /// true if the app is running in Single Application Mode; otherwise, false. 21 | /// 22 | public static bool IsInSingleAppMode 23 | { 24 | get 25 | { 26 | bool isInSingleAppMode = false; 27 | object singleAppMode = Registry.GetValue(ShellRegKey, "SingleAppMode", null); 28 | if (singleAppMode != null) 29 | { 30 | isInSingleAppMode = int.Parse(singleAppMode.ToString(), CultureInfo.InvariantCulture) == 1; 31 | } 32 | 33 | return isInSingleAppMode; 34 | } 35 | } 36 | 37 | /// 38 | /// Gets a value indicating whether the Surface unit is in User Mode. 39 | /// 40 | /// 41 | /// true if the Surface unit is in User Mode; otherwise, false. 42 | /// 43 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Useful as an example.")] 44 | public static bool IsInUserMode 45 | { 46 | get 47 | { 48 | bool isInUserMode = false; 49 | object userMode = Registry.GetValue(ShellRegKey, "TableMode", null); 50 | if (userMode != null) 51 | { 52 | isInUserMode = int.Parse(userMode.ToString(), CultureInfo.InvariantCulture) == 2; 53 | } 54 | 55 | return isInUserMode; 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SocialStream/Helpers/VisualTree.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace SocialStream.Helpers 5 | { 6 | /// 7 | /// Helper methods to find a visual child or parent of a given type. 8 | /// 9 | public static class VisualTree 10 | { 11 | /// 12 | /// Finds a visual child of a given type. 13 | /// http://msdn.microsoft.com/en-us/library/bb613579.aspx 14 | /// 15 | /// The type to search for. 16 | /// The object at the root of the tree to search. 17 | /// The visual child. 18 | public static T FindVisualChild(this DependencyObject obj) 19 | where T : DependencyObject 20 | { 21 | for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) 22 | { 23 | DependencyObject child = VisualTreeHelper.GetChild(obj, i); 24 | if (child != null && child is T) 25 | { 26 | return (T)child; 27 | } 28 | else 29 | { 30 | T childOfChild = FindVisualChild(child); 31 | if (childOfChild != null) 32 | { 33 | return childOfChild; 34 | } 35 | } 36 | } 37 | 38 | return null; 39 | } 40 | 41 | /// 42 | /// Finds a visual parent of a given type. 43 | /// http://msdn.microsoft.com/en-us/library/bb613579.aspx 44 | /// 45 | /// The type to search for. 46 | /// The object at the root of the tree to search. 47 | /// The visual parent. 48 | public static T FindVisualParent(this DependencyObject obj) 49 | where T : DependencyObject 50 | { 51 | DependencyObject parent = VisualTreeHelper.GetParent(obj); 52 | while (parent != null) 53 | { 54 | T typed = parent as T; 55 | if (typed != null) 56 | { 57 | return typed; 58 | } 59 | 60 | parent = VisualTreeHelper.GetParent(parent); 61 | } 62 | 63 | return null; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Converters/HexStringToLongConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace SocialStream.ConfigTool.Converters 6 | { 7 | /// 8 | /// Convert between a hex string and a long. 9 | /// 10 | public class HexStringToLongConverter : IValueConverter 11 | { 12 | /// 13 | /// Converts a value. 14 | /// 15 | /// The value produced by the binding source. 16 | /// The type of the binding target property. 17 | /// The converter parameter to use. 18 | /// The culture to use in the converter. 19 | /// 20 | /// A converted value. If the method returns null, the valid null value is used. 21 | /// 22 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | try 25 | { 26 | return ((long)value).ToString("X", CultureInfo.InvariantCulture); 27 | } 28 | catch 29 | { 30 | throw new NotSupportedException(Properties.Resources.HexError); 31 | } 32 | } 33 | 34 | /// 35 | /// Converts a value. 36 | /// 37 | /// The value that is produced by the binding target. 38 | /// The type to convert to. 39 | /// The converter parameter to use. 40 | /// The culture to use in the converter. 41 | /// 42 | /// A converted value. If the method returns null, the valid null value is used. 43 | /// 44 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 45 | { 46 | if (value == null) 47 | { 48 | throw new NotSupportedException(Properties.Resources.HexError); 49 | } 50 | 51 | try 52 | { 53 | return long.Parse(value.ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture); 54 | } 55 | catch 56 | { 57 | throw new NotSupportedException(Properties.Resources.HexError); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Converters/BooleanConverter.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Globalization; 9 | using System.Windows; 10 | using System.Windows.Data; 11 | 12 | namespace SocialStream.ConfigTool.Converters 13 | { 14 | /// 15 | /// Like VisibilityConverter, but returns a boolean. 16 | /// 17 | public class BooleanConverter : IValueConverter 18 | { 19 | /// 20 | /// Modifies the source data before passing it to the target for display in the UI. 21 | /// 22 | /// The source data being passed to the target. 23 | /// The of data expected by the target dependency property. 24 | /// An optional parameter to be used in the converter logic. 25 | /// The culture of the conversion. 26 | /// 27 | /// The value to be passed to the target dependency property. 28 | /// 29 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 30 | { 31 | return (Visibility)new VisibilityConverter().Convert(value, targetType, parameter, culture) == Visibility.Visible ? true : false; 32 | } 33 | 34 | /// 35 | /// Modifies the target data before passing it to the source object. This method is called only in bindings. 36 | /// 37 | /// The target data being passed to the source. 38 | /// The of data expected by the source object. 39 | /// An optional parameter to be used in the converter logic. 40 | /// The culture of the conversion. 41 | /// 42 | /// The value to be passed to the source object. 43 | /// 44 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 45 | { 46 | throw new NotSupportedException(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SocialStream/Service References/MicrosoftTagService/Service1.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | *_i.c 48 | *_p.c 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.vspscc 63 | .builds 64 | *.dotCover 65 | 66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 67 | #packages/ 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | 80 | # ReSharper is a .NET coding add-in 81 | _ReSharper* 82 | 83 | # Installshield output folder 84 | [Ee]xpress 85 | 86 | # DocProject is a documentation generator add-in 87 | DocProject/buildhelp/ 88 | DocProject/Help/*.HxT 89 | DocProject/Help/*.HxC 90 | DocProject/Help/*.hhc 91 | DocProject/Help/*.hhk 92 | DocProject/Help/*.hhp 93 | DocProject/Help/Html2 94 | DocProject/Help/html 95 | 96 | # Click-Once directory 97 | publish 98 | 99 | # Others 100 | [Bb]in 101 | [Oo]bj 102 | sql 103 | TestResults 104 | *.Cache 105 | ClientBin 106 | stylecop.* 107 | ~$* 108 | *.dbmdl 109 | Generated_Code #added for RIA/Silverlight projects 110 | 111 | # Backup & report files from converting an old project file to a newer 112 | # Visual Studio version. Backup files are not needed, because we have git ;-) 113 | _UpgradeReport_Files/ 114 | Backup*/ 115 | UpgradeLog*.XML 116 | 117 | 118 | 119 | ############ 120 | ## Windows 121 | ############ 122 | 123 | # Windows image file caches 124 | Thumbs.db 125 | 126 | # Folder config file 127 | Desktop.ini 128 | 129 | 130 | ############# 131 | ## Python 132 | ############# 133 | 134 | *.py[co] 135 | 136 | # Packages 137 | *.egg 138 | *.egg-info 139 | dist 140 | build 141 | eggs 142 | parts 143 | bin 144 | var 145 | sdist 146 | develop-eggs 147 | .installed.cfg 148 | 149 | # Installer logs 150 | pip-log.txt 151 | 152 | # Unit test / coverage reports 153 | .coverage 154 | .tox 155 | 156 | #Translations 157 | *.mo 158 | 159 | #Mr Developer 160 | .mr.developer.cfg 161 | 162 | # Mac crap 163 | .DS_Store 164 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverContent/SmallNews.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Data; 5 | using Microsoft.Surface.Presentation.Controls; 6 | 7 | namespace SocialStream.Controls.RiverContent 8 | { 9 | /// 10 | /// A river item which shows the small version of news feed items. 11 | /// 12 | public partial class SmallNews : UserControl 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public SmallNews() 18 | { 19 | InitializeComponent(); 20 | 21 | if (DesignerProperties.GetIsInDesignMode(this)) 22 | { 23 | return; 24 | } 25 | 26 | // Bind to the parent SVI to show a pressed state. 27 | Binding binding = new Binding() 28 | { 29 | Path = new PropertyPath(ScatterViewItem.IsContainerActiveProperty), 30 | RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(ScatterViewItem), 1) 31 | }; 32 | 33 | BindingOperations.SetBinding(this, IsPressedProperty, binding); 34 | } 35 | 36 | #region IsPressed 37 | 38 | /// 39 | /// Gets or sets a value indicating whether this instance is pressed. 40 | /// 41 | /// 42 | /// true if this instance is pressed; otherwise, false. 43 | /// 44 | public bool IsPressed 45 | { 46 | get { return (bool)GetValue(IsPressedProperty); } 47 | set { SetValue(IsPressedProperty, value); } 48 | } 49 | 50 | /// 51 | /// Backing store for IsPressed. 52 | /// 53 | public static readonly DependencyProperty IsPressedProperty = DependencyProperty.Register("IsPressed", typeof(bool), typeof(SmallNews), new PropertyMetadata(false, IsPressedPropertyChanged)); 54 | 55 | /// 56 | /// Fires when IsPressed changes. 57 | /// 58 | /// The sender. 59 | /// The instance containing the event data. 60 | private static void IsPressedPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 61 | { 62 | (sender as SmallNews).UpdateIsPressed(); 63 | } 64 | 65 | /// 66 | /// Shows the pressed state. 67 | /// 68 | private void UpdateIsPressed() 69 | { 70 | VisualStateManager.GoToState(this, IsPressed ? IsPressedState.Name : NotPressedState.Name, true); 71 | } 72 | 73 | #endregion 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverContent/SmallImage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverContent/SmallTweet.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Data; 5 | using Microsoft.Surface.Presentation.Controls; 6 | 7 | namespace SocialStream.Controls.RiverContent 8 | { 9 | /// 10 | /// A river item which shows the small version of tweet feed items. 11 | /// 12 | public partial class SmallTweet : UserControl 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public SmallTweet() 18 | { 19 | InitializeComponent(); 20 | 21 | if (DesignerProperties.GetIsInDesignMode(this)) 22 | { 23 | return; 24 | } 25 | 26 | // Bind to the parent SVI to show a pressed state. 27 | Binding binding = new Binding() 28 | { 29 | Path = new PropertyPath(ScatterViewItem.IsContainerActiveProperty), 30 | RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(ScatterViewItem), 1) 31 | }; 32 | 33 | BindingOperations.SetBinding(this, IsPressedProperty, binding); 34 | } 35 | 36 | #region IsPressed 37 | 38 | /// 39 | /// Gets or sets a value indicating whether this instance is pressed. 40 | /// 41 | /// 42 | /// true if this instance is pressed; otherwise, false. 43 | /// 44 | public bool IsPressed 45 | { 46 | get { return (bool)GetValue(IsPressedProperty); } 47 | set { SetValue(IsPressedProperty, value); } 48 | } 49 | 50 | /// 51 | /// Backing store for IsPressed. 52 | /// 53 | public static readonly DependencyProperty IsPressedProperty = DependencyProperty.Register("IsPressed", typeof(bool), typeof(SmallTweet), new PropertyMetadata(false, IsPressedPropertyChanged)); 54 | 55 | /// 56 | /// Fires when IsPressed changes. 57 | /// 58 | /// The sender. 59 | /// The instance containing the event data. 60 | private static void IsPressedPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 61 | { 62 | (sender as SmallTweet).UpdateIsPressed(); 63 | } 64 | 65 | /// 66 | /// Shows the pressed state. 67 | /// 68 | private void UpdateIsPressed() 69 | { 70 | VisualStateManager.GoToState(this, IsPressed ? IsPressedState.Name : NotPressedState.Name, true); 71 | } 72 | 73 | #endregion 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Controls/MicrosoftTagEditor.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Helpers/VisualEnumerables.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Windows; 4 | using System.Windows.Media; 5 | 6 | namespace SocialStream.ConfigTool.Helpers 7 | { 8 | /// 9 | /// Provides methods for iterating through the visual tree with LINQ. 10 | /// 11 | public static class VisualEnumerable 12 | { 13 | /// 14 | /// Gets the Visual Tree filtered by Type for a DependencyObject with that DependencyObject as the root. 15 | /// http://petermcg.wordpress.com/2009/03/04/linq-to-visual-tree-beta/ 16 | /// 17 | /// The type of element to retrieve. 18 | /// The element. 19 | /// The matching elements. 20 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "It's ok here.")] 21 | public static IEnumerable GetVisualOfType(this DependencyObject element) 22 | { 23 | return GetVisualTree(element).Where(t => t.GetType() == typeof(T)).Cast(); 24 | } 25 | 26 | /// 27 | /// Gets the Visual Tree filtered by Type for a DependencyObject with that DependencyObject as the root. 28 | /// http://petermcg.wordpress.com/2009/03/04/linq-to-visual-tree-beta/ 29 | /// 30 | /// The type of element to retrieve. 31 | /// The element. 32 | /// The matching elements. 33 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "It's ok here.")] 34 | public static IEnumerable GetVisualOfBaseType(this DependencyObject element) 35 | { 36 | return GetVisualTree(element).Where(t => t.GetType().IsSubclassOf(typeof(T))).Cast(); 37 | } 38 | 39 | /// 40 | /// Gets the Visual Tree for a DependencyObject with that DependencyObject as the root. 41 | /// http://petermcg.wordpress.com/2009/03/04/linq-to-visual-tree-beta/ 42 | /// 43 | /// The root element. 44 | /// The matching elements. 45 | public static IEnumerable GetVisualTree(this DependencyObject element) 46 | { 47 | int childrenCount = VisualTreeHelper.GetChildrenCount(element); 48 | 49 | for (int i = 0; i < childrenCount; i++) 50 | { 51 | var visualChild = VisualTreeHelper.GetChild(element, i); 52 | 53 | yield return visualChild; 54 | 55 | foreach (var visualChildren in GetVisualTree(visualChild)) 56 | { 57 | yield return visualChildren; 58 | } 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverContent/LargeTweet.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using SocialStream.Properties; 5 | 6 | namespace SocialStream.Controls.RiverContent 7 | { 8 | /// 9 | /// A river item which shows the large version of tweets. 10 | /// 11 | public partial class LargeTweet : UserControl 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public LargeTweet() 17 | { 18 | InitializeComponent(); 19 | 20 | if (DesignerProperties.GetIsInDesignMode(this)) 21 | { 22 | return; 23 | } 24 | } 25 | 26 | /// 27 | /// Handles the Click event of the Close button. 28 | /// 29 | /// The source of the event. 30 | /// The instance containing the event data. 31 | private void Close_Click(object sender, RoutedEventArgs e) 32 | { 33 | RaiseEvent(new UserSourceRoutedEventArgs(RiverItemBase.CloseRequestedEvent, _closeBtn)); 34 | } 35 | 36 | /// 37 | /// Handles the Click event of the Flip button. 38 | /// 39 | /// The source of the event. 40 | /// The instance containing the event data. 41 | private void Flip_Click(object sender, RoutedEventArgs e) 42 | { 43 | RaiseEvent(new UserSourceRoutedEventArgs(RiverItemBase.FlipRequestedEvent, _flipBtn)); 44 | } 45 | 46 | /// 47 | /// If resizing is enabled, size the content to a fixed pixel size according to the size of the container, and put it in the ViewBox. 48 | /// 49 | internal void SetUpResizing() 50 | { 51 | if (!Settings.Default.EnableContentResizing) 52 | { 53 | return; 54 | } 55 | 56 | _contentRoot.Width = _contentRoot.ActualWidth; 57 | _contentRoot.Height = _contentRoot.ActualHeight; 58 | _fixedContentContainer.Child = null; 59 | _scalingContentContainer.Child = _contentRoot; 60 | } 61 | 62 | /// 63 | /// If resizing is enabled, let the content size dynamically and put it in the normal container. 64 | /// 65 | internal void TearDownResizing() 66 | { 67 | if (!Settings.Default.EnableContentResizing) 68 | { 69 | return; 70 | } 71 | 72 | _scalingContentContainer.Child = null; 73 | _contentRoot.Width = double.NaN; 74 | _contentRoot.Height = double.NaN; 75 | _fixedContentContainer.Child = _contentRoot; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /FeedProcessor/Net/AsyncWebRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Net; 5 | using System.Text; 6 | 7 | namespace FeedProcessor.Net 8 | { 9 | /// 10 | /// Encapsulates the behavior of asynronously loading data from a web service and returning that data along with an HTTP status code. 11 | /// 12 | internal class AsyncWebRequest 13 | { 14 | /// 15 | /// Represents the method that is called when the Result event fires. 16 | /// 17 | /// The AsyncWebRequest object. 18 | /// The AsyncWebResultEventArgs object. 19 | internal delegate void AsyncWebRequestResultHandler(AsyncWebRequest sender, AsyncWebResultEventArgs e); 20 | 21 | /// 22 | /// Occurs when a result arrives from the request. 23 | /// 24 | internal event AsyncWebRequestResultHandler Result; 25 | 26 | /// 27 | /// Requests the specified URI. 28 | /// 29 | /// The URI to request. 30 | internal void Request(Uri uri) 31 | { 32 | Debug.WriteLine("Requesting " + uri); 33 | using (WebClient client = new WebClient()) 34 | { 35 | client.Headers.Add("user-agent", "Social Stream for Microsoft® Surface® Feed Processor"); 36 | client.OpenReadCompleted += Client_OpenReadCompleted; 37 | client.OpenReadAsync(uri); 38 | } 39 | } 40 | 41 | /// 42 | /// Handles the OpenReadCompleted event of the WebClient. 43 | /// 44 | /// The source of the event. 45 | /// The instance containing the event data. 46 | private void Client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) 47 | { 48 | if (Result == null) 49 | { 50 | return; 51 | } 52 | 53 | try 54 | { 55 | HttpStatusCode code = HttpStatusCode.OK; 56 | string response = null; 57 | 58 | if (e.Error != null) 59 | { 60 | WebException ex = e.Error as WebException; 61 | HttpWebResponse webResponse = ex.Response == null ? null : ex.Response as HttpWebResponse; 62 | code = webResponse == null ? HttpStatusCode.ServiceUnavailable : webResponse.StatusCode; 63 | } 64 | else 65 | { 66 | response = new StreamReader(e.Result, Encoding.UTF8, true).ReadToEnd(); 67 | } 68 | 69 | Result(this, new AsyncWebResultEventArgs(response, code)); 70 | } 71 | catch 72 | { 73 | #if DEBUG 74 | throw; 75 | #endif 76 | Result(this, new AsyncWebResultEventArgs(null, HttpStatusCode.ServiceUnavailable)); 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SocialStream/Service References/MicrosoftTagService/configuration.svcinfo: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SocialStream/Converters/VisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Globalization; 4 | using System.Windows; 5 | using System.Windows.Data; 6 | 7 | namespace SocialStream.Converters 8 | { 9 | /// 10 | /// Convert non-empty strings, true bools, and numbers above zero to visible. Everything else to collapsed. Pass any parameter to reverse the behavior. 11 | /// 12 | public class VisibilityConverter : IValueConverter 13 | { 14 | /// 15 | /// Modifies the source data before passing it to the target for display in the UI. 16 | /// 17 | /// The source data being passed to the target. 18 | /// The of data expected by the target dependency property. 19 | /// An optional parameter to be used in the converter logic. 20 | /// The culture of the conversion. 21 | /// 22 | /// The value to be passed to the target dependency property. 23 | /// 24 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "Suppressed to maintain legibility.")] 25 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | bool converted = 28 | (value is string && !string.IsNullOrWhiteSpace((string)value)) || 29 | (value is int && (int)value > 0) || 30 | (value is double && (double)value > 0) || 31 | (value is bool && (bool)value == true) || 32 | (value is ICollection && (value as ICollection).Count > 0) || 33 | (value is DateTime && (DateTime)value != DateTime.MinValue) || 34 | (!(value is string) && !(value is int) && !(value is double) && !(value is bool) && !(value is ICollection) && !(value is DateTime) && value != null); 35 | 36 | if (parameter != null) 37 | { 38 | converted = !converted; 39 | } 40 | 41 | return converted ? Visibility.Visible : Visibility.Collapsed; 42 | } 43 | 44 | /// 45 | /// Modifies the target data before passing it to the source object. This method is called only in bindings. 46 | /// 47 | /// The target data being passed to the source. 48 | /// The of data expected by the source object. 49 | /// An optional parameter to be used in the converter logic. 50 | /// The culture of the conversion. 51 | /// 52 | /// The value to be passed to the source object. 53 | /// 54 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 55 | { 56 | throw new NotSupportedException(); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/App.xaml.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Diagnostics; 9 | using System.Globalization; 10 | using System.IO; 11 | using System.Threading; 12 | using System.Windows; 13 | using System.Windows.Threading; 14 | 15 | namespace SocialStream.ConfigTool 16 | { 17 | /// 18 | /// Interaction logic for App.xaml 19 | /// 20 | public partial class App : Application 21 | { 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// More than one instance of the class is created per . 26 | public App() 27 | { 28 | // This lets you change the culture in the Region and Language control panel and render the right culture. 29 | Thread.CurrentThread.CurrentCulture = CultureInfo.CurrentCulture; 30 | Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentCulture; 31 | 32 | DispatcherUnhandledException += App_DispatcherUnhandledException; 33 | AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; 34 | } 35 | 36 | /// 37 | /// Handles the DispatcherUnhandledException event of the App control. Logs crashes. 38 | /// 39 | /// The source of the event. 40 | /// The instance containing the event data. 41 | private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) 42 | { 43 | LogCrash(e.Exception); 44 | throw e.Exception; 45 | } 46 | 47 | /// 48 | /// Handles the UnhandledException event of the CurrentDomain control. Logs crashes. 49 | /// 50 | /// The source of the event. 51 | /// The instance containing the event data. 52 | private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 53 | { 54 | LogCrash(e.ExceptionObject); 55 | throw e.ExceptionObject as Exception; 56 | } 57 | 58 | /// 59 | /// Logs the crash. 60 | /// 61 | /// The exception object. 62 | private static void LogCrash(object exceptionObject) 63 | { 64 | // C:\Users\Public\Documents\SocialStream.exe.log 65 | string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), Process.GetCurrentProcess().MainModule.ModuleName + ".log"); 66 | File.WriteAllText(path, exceptionObject.ToString()); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Converters/IsEqualConverter.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Globalization; 9 | using System.Linq; 10 | using System.Windows.Data; 11 | 12 | namespace SocialStream.ConfigTool.Converters 13 | { 14 | /// 15 | /// Testes if all passed values are equal. 16 | /// 17 | public class IsEqualConverter : IMultiValueConverter 18 | { 19 | /// 20 | /// Converts source values to a value for the binding target. The data binding engine calls this method when it propagates the values from source bindings to the binding target. 21 | /// 22 | /// The array of values that the source bindings in the produces. The value indicates that the source binding has no value to provide for conversion. 23 | /// The type of the binding target property. 24 | /// The converter parameter to use. 25 | /// The culture to use in the converter. 26 | /// 27 | /// A converted value.If the method returns null, the valid null value is used.A return value of . indicates that the converter did not produce a value, and that the binding will use the if it is available, or else will use the default value.A return value of . indicates that the binding does not transfer the value or use the or the default value. 28 | /// 29 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 30 | { 31 | if (values == null) 32 | { 33 | return true; 34 | } 35 | 36 | return values.Distinct().Count() == 1; 37 | } 38 | 39 | /// 40 | /// Converts a binding target value to the source binding values. 41 | /// 42 | /// The value that the binding target produces. 43 | /// The array of types to convert to. The array length indicates the number and types of values that are suggested for the method to return. 44 | /// The converter parameter to use. 45 | /// The culture to use in the converter. 46 | /// 47 | /// An array of values that have been converted from the target value back to the source values. 48 | /// 49 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 50 | { 51 | throw new NotSupportedException(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SocialStream/Helpers/TouchChangedEvents.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows; 4 | 5 | namespace SocialStream.Helpers 6 | { 7 | /// 8 | /// The Surface SDK included changed events for some dependency properties, such as "IsAnyContactCapturedWithinChanged". These 9 | /// were not ported to WPF4, so this class reinstates them. 10 | /// 11 | public static class TouchChangedEvents 12 | { 13 | #region AreAnyTouchesCapturedWithinChanged 14 | 15 | /// 16 | /// Descriptor for AreAnyTouchesCapturedWithin. 17 | /// 18 | private static DependencyPropertyDescriptor _areAnyTouchesCapturedWithinProperty = DependencyPropertyDescriptor.FromProperty(UIElement.AreAnyTouchesCapturedWithinProperty, typeof(UIElement)); 19 | 20 | /// 21 | /// Attached event description for AreAnyTouchesCapturedWithinChanged. 22 | /// 23 | public static readonly RoutedEvent AreAnyTouchesCapturedWithinChangedEvent = EventManager.RegisterRoutedEvent("AreAnyTouchesCapturedWithinChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TouchChangedEvents)); 24 | 25 | /// 26 | /// Adds a handler for the AreAnyTouchesCapturedWithinChanged event. 27 | /// 28 | /// The target. 29 | /// The handler. 30 | public static void AddAreAnyTouchesCapturedWithinChangedHandler(DependencyObject target, RoutedEventHandler handler) 31 | { 32 | UIElement element = target as UIElement; 33 | if (element != null) 34 | { 35 | element.AddHandler(AreAnyTouchesCapturedWithinChangedEvent, handler); 36 | _areAnyTouchesCapturedWithinProperty.AddValueChanged(target, AreAnyTouchesCapturedWithinChangedHandler); 37 | } 38 | } 39 | 40 | /// 41 | /// Removes a handler for the AreAnyTouchesCapturedWithinChanged event. 42 | /// 43 | /// The target. 44 | /// The handler. 45 | public static void RemoveAreAnyTouchesCapturedWithinChangedHandler(DependencyObject target, RoutedEventHandler handler) 46 | { 47 | UIElement element = target as UIElement; 48 | if (element != null) 49 | { 50 | element.RemoveHandler(AreAnyTouchesCapturedWithinChangedEvent, handler); 51 | _areAnyTouchesCapturedWithinProperty.RemoveValueChanged(target, AreAnyTouchesCapturedWithinChangedHandler); 52 | } 53 | } 54 | 55 | /// 56 | /// Internal handler for the dependency property's changed event. 57 | /// 58 | /// The sender. 59 | /// The instance containing the event data. 60 | private static void AreAnyTouchesCapturedWithinChangedHandler(object sender, EventArgs e) 61 | { 62 | UIElement element = sender as UIElement; 63 | if (element != null) 64 | { 65 | element.RaiseEvent(new RoutedEventArgs(AreAnyTouchesCapturedWithinChangedEvent)); 66 | } 67 | } 68 | 69 | #endregion 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Converters/VisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Collections; 9 | using System.Globalization; 10 | using System.Windows; 11 | using System.Windows.Data; 12 | 13 | namespace SocialStream.ConfigTool.Converters 14 | { 15 | /// 16 | /// Convert non-empty strings, true bools, and numbers above zero to visible. Everything else to collapsed. Pass any parameter to reverse the behavior. 17 | /// 18 | public class VisibilityConverter : IValueConverter 19 | { 20 | /// 21 | /// Modifies the source data before passing it to the target for display in the UI. 22 | /// 23 | /// The source data being passed to the target. 24 | /// The of data expected by the target dependency property. 25 | /// An optional parameter to be used in the converter logic. 26 | /// The culture of the conversion. 27 | /// 28 | /// The value to be passed to the target dependency property. 29 | /// 30 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "Suppressed to maintain legibility.")] 31 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 32 | { 33 | bool converted = 34 | (value is string && !string.IsNullOrEmpty((string)value)) || 35 | (value is int && (int)value > 0) || 36 | (value is uint && (uint)value > 0) || 37 | (value is double && (double)value > 0) || 38 | (value is bool && (bool)value == true) || 39 | (value is ICollection && (value as ICollection).Count > 0) || 40 | (!(value is string) && !(value is int) && !(value is uint) && !(value is double) && !(value is bool) && !(value is ICollection) && value != null); 41 | 42 | if (parameter != null) 43 | { 44 | converted = !converted; 45 | } 46 | 47 | return converted ? Visibility.Visible : Visibility.Collapsed; 48 | } 49 | 50 | /// 51 | /// Modifies the target data before passing it to the source object. This method is called only in bindings. 52 | /// 53 | /// The target data being passed to the source. 54 | /// The of data expected by the source object. 55 | /// An optional parameter to be used in the converter logic. 56 | /// The culture of the conversion. 57 | /// 58 | /// The value to be passed to the source object. 59 | /// 60 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 61 | { 62 | throw new NotSupportedException(); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation 2011. All rights reserved. 4 | // 5 | // ------------------------------------------------------------- 6 | 7 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")] 8 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")] 9 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1824:MarkAssembliesWithNeutralResourcesLanguage")] 10 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "XamlGeneratedNamespace.GeneratedInternalTypeHelper.#AddEventHandler(System.Reflection.EventInfo,System.Object,System.Delegate)")] 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "XamlGeneratedNamespace.GeneratedInternalTypeHelper.#CreateDelegate(System.Type,System.Object,System.String)")] 12 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "XamlGeneratedNamespace.GeneratedInternalTypeHelper.#GetPropertyValue(System.Reflection.PropertyInfo,System.Object,System.Globalization.CultureInfo)")] 13 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "XamlGeneratedNamespace.GeneratedInternalTypeHelper.#SetPropertyValue(System.Reflection.PropertyInfo,System.Object,System.Object,System.Globalization.CultureInfo)")] 14 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Validators", Scope = "namespace", Target = "SocialStream.ConfigTool.Validators")] 15 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "WordList", Scope = "member", Target = "SocialStream.ConfigTool.Model.AppState.#ProfanityFilterWordList")] 16 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1701:ResourceStringCompoundWordsShouldBeCasedCorrectly", MessageId = "username", Scope = "resource", Target = "SocialStream.ConfigTool.Properties.Resources.resources")] 17 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Flickr", Scope = "member", Target = "SocialStream.ConfigTool.Model.AppState.#FlickrApiKey")] 18 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Flickr", Scope = "member", Target = "SocialStream.ConfigTool.Model.AppState.#FlickrBans")] 19 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Flickr", Scope = "member", Target = "SocialStream.ConfigTool.Model.AppState.#FlickrPollInterval")] 20 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Flickr", Scope = "member", Target = "SocialStream.ConfigTool.Model.AppState.#FlickrQueries")] 21 | -------------------------------------------------------------------------------- /SocialStream/MouseTouchDevice.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Input; 3 | using System.Windows.Media; 4 | 5 | namespace Blake.NUI.WPF.Touch 6 | { 7 | /// 8 | /// From Blake.NUI. 9 | /// 10 | public class MouseTouchDevice : TouchDevice 11 | { 12 | #region Class Members 13 | 14 | private static MouseTouchDevice device; 15 | 16 | public Point Position { get; set; } 17 | 18 | #endregion 19 | 20 | #region Public Static Methods 21 | 22 | public static void RegisterEvents(UIElement root) 23 | { 24 | if (root == null) 25 | { 26 | return; 27 | } 28 | 29 | root.PreviewMouseDown += MouseDown; 30 | root.PreviewMouseMove += MouseMove; 31 | root.PreviewMouseUp += MouseUp; 32 | } 33 | 34 | #endregion 35 | 36 | #region Private Static Methods 37 | 38 | private static void MouseDown(object sender, MouseButtonEventArgs e) 39 | { 40 | if (device != null && 41 | device.IsActive) 42 | { 43 | device.ReportUp(); 44 | device.Deactivate(); 45 | device = null; 46 | } 47 | device = new MouseTouchDevice(e.MouseDevice.GetHashCode()); 48 | device.SetActiveSource(e.MouseDevice.ActiveSource); 49 | device.Position = e.GetPosition(null); 50 | device.Activate(); 51 | device.ReportDown(); 52 | e.Handled = true; 53 | } 54 | 55 | private static void MouseMove(object sender, MouseEventArgs e) 56 | { 57 | if (device != null && 58 | device.IsActive) 59 | { 60 | device.Position = e.GetPosition(null); 61 | device.ReportMove(); 62 | e.Handled = true; 63 | } 64 | } 65 | 66 | private static void MouseUp(object sender, MouseButtonEventArgs e) 67 | { 68 | if (device != null && 69 | device.IsActive) 70 | { 71 | device.Position = e.GetPosition(null); 72 | device.ReportUp(); 73 | device.Deactivate(); 74 | device = null; 75 | e.Handled = true; 76 | } 77 | } 78 | 79 | #endregion 80 | 81 | #region Constructors 82 | 83 | public MouseTouchDevice(int deviceId) : 84 | base(deviceId) 85 | { 86 | Position = new Point(); 87 | } 88 | 89 | #endregion 90 | 91 | #region Overridden methods 92 | 93 | public override TouchPointCollection GetIntermediateTouchPoints(IInputElement relativeTo) 94 | { 95 | return new TouchPointCollection(); 96 | } 97 | 98 | public override TouchPoint GetTouchPoint(IInputElement relativeTo) 99 | { 100 | Point point = Position; 101 | if (relativeTo != null) 102 | { 103 | try 104 | { 105 | point = this.ActiveSource.RootVisual.TransformToDescendant((Visual)relativeTo).Transform(Position); 106 | } 107 | catch 108 | { 109 | } 110 | } 111 | 112 | Rect rect = new Rect(point, new Size(1, 1)); 113 | 114 | return new TouchPoint(this, point, rect, TouchAction.Move); 115 | } 116 | 117 | #endregion 118 | 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Controls/NewsEditor.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | using SocialStream.ConfigTool.Command; 5 | using SocialStream.ConfigTool.VO; 6 | 7 | namespace SocialStream.ConfigTool.Controls 8 | { 9 | /// 10 | /// Interaction logic for NewsEditor.xaml 11 | /// 12 | public partial class NewsEditor : UserControl 13 | { 14 | /// 15 | /// Whether an add filter button was just clicked. 16 | /// 17 | private bool _JustAdded; 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | public NewsEditor() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | /// 28 | /// Handles the Loaded event of the TextBox control. Refresh the binding to show the error immediately. 29 | /// 30 | /// The source of the event. 31 | /// The instance containing the event data. 32 | private void TextBox_Loaded(object sender, RoutedEventArgs e) 33 | { 34 | TextBox textBox = sender as TextBox; 35 | BindingExpression binding = textBox.GetBindingExpression(TextBox.TextProperty); 36 | if (binding != null) 37 | { 38 | binding.UpdateSource(); 39 | } 40 | 41 | if (_JustAdded) 42 | { 43 | textBox.Focus(); 44 | _JustAdded = false; 45 | } 46 | } 47 | 48 | /// 49 | /// Handles the Click event of the Delete control. 50 | /// 51 | /// The source of the event. 52 | /// The instance containing the event data. 53 | private void DeleteQuery_Click(object sender, RoutedEventArgs e) 54 | { 55 | RemoveNewsQueryCommand.Execute((sender as Button).DataContext as BindableStringVO); 56 | } 57 | 58 | /// 59 | /// Handles the Click event of the Delete control. 60 | /// 61 | /// The source of the event. 62 | /// The instance containing the event data. 63 | private void DeleteBan_Click(object sender, RoutedEventArgs e) 64 | { 65 | RemoveNewsBanCommand.Execute((sender as Button).DataContext as BindableStringVO); 66 | } 67 | 68 | /// 69 | /// Handles the Click event of the Add control. 70 | /// 71 | /// The source of the event. 72 | /// The instance containing the event data. 73 | private void AddQuery_Click(object sender, RoutedEventArgs e) 74 | { 75 | _JustAdded = true; 76 | AddNewsQueryCommand.Execute(); 77 | } 78 | 79 | /// 80 | /// Handles the Click event of the Add control. 81 | /// 82 | /// The source of the event. 83 | /// The instance containing the event data. 84 | private void AddBan_Click(object sender, RoutedEventArgs e) 85 | { 86 | _JustAdded = true; 87 | AddNewsBanCommand.Execute(); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Controls/FlickrEditor.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | using SocialStream.ConfigTool.Command; 5 | using SocialStream.ConfigTool.VO; 6 | 7 | namespace SocialStream.ConfigTool.Controls 8 | { 9 | /// 10 | /// Interaction logic for FlickrEditor.xaml 11 | /// 12 | public partial class FlickrEditor : UserControl 13 | { 14 | /// 15 | /// Whether an add filter button was just clicked. 16 | /// 17 | private bool _JustAdded; 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | public FlickrEditor() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | /// 28 | /// Handles the Click event of the Delete control. 29 | /// 30 | /// The source of the event. 31 | /// The instance containing the event data. 32 | private void DeleteQuery_Click(object sender, RoutedEventArgs e) 33 | { 34 | RemoveFlickrQueryCommand.Execute((sender as Button).DataContext as BindableStringVO); 35 | } 36 | 37 | /// 38 | /// Handles the Click event of the Delete control. 39 | /// 40 | /// The source of the event. 41 | /// The instance containing the event data. 42 | private void DeleteBan_Click(object sender, RoutedEventArgs e) 43 | { 44 | RemoveFlickrBanCommand.Execute((sender as Button).DataContext as BindableStringVO); 45 | } 46 | 47 | /// 48 | /// Handles the Click event of the Add control. 49 | /// 50 | /// The source of the event. 51 | /// The instance containing the event data. 52 | private void AddQuery_Click(object sender, RoutedEventArgs e) 53 | { 54 | _JustAdded = true; 55 | AddFlickrQueryCommand.Execute(); 56 | } 57 | 58 | /// 59 | /// Handles the Click event of the Add control. 60 | /// 61 | /// The source of the event. 62 | /// The instance containing the event data. 63 | private void AddBan_Click(object sender, RoutedEventArgs e) 64 | { 65 | _JustAdded = true; 66 | AddFlickrBanCommand.Execute(); 67 | } 68 | 69 | /// 70 | /// Handles the Loaded event of the TextBox control. Refresh the binding to show the error immediately. 71 | /// 72 | /// The source of the event. 73 | /// The instance containing the event data. 74 | private void TextBox_Loaded(object sender, RoutedEventArgs e) 75 | { 76 | TextBox textBox = sender as TextBox; 77 | BindingExpression binding = textBox.GetBindingExpression(TextBox.TextProperty); 78 | if (binding != null) 79 | { 80 | binding.UpdateSource(); 81 | } 82 | 83 | if (_JustAdded) 84 | { 85 | textBox.Focus(); 86 | _JustAdded = false; 87 | } 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SocialStream.ConfigTool/Controls/TwitterEditor.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | using SocialStream.ConfigTool.Command; 5 | using SocialStream.ConfigTool.VO; 6 | 7 | namespace SocialStream.ConfigTool.Controls 8 | { 9 | /// 10 | /// Interaction logic for TwitterEditor.xaml 11 | /// 12 | public partial class TwitterEditor : UserControl 13 | { 14 | /// 15 | /// Whether an add filter button was just clicked. 16 | /// 17 | private bool _JustAdded; 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | public TwitterEditor() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | /// 28 | /// Handles the Loaded event of the TextBox control. Refresh the binding to show the error immediately. 29 | /// 30 | /// The source of the event. 31 | /// The instance containing the event data. 32 | private void TextBox_Loaded(object sender, RoutedEventArgs e) 33 | { 34 | TextBox textBox = sender as TextBox; 35 | BindingExpression binding = textBox.GetBindingExpression(TextBox.TextProperty); 36 | if (binding != null) 37 | { 38 | binding.UpdateSource(); 39 | } 40 | 41 | if (_JustAdded) 42 | { 43 | textBox.Focus(); 44 | _JustAdded = false; 45 | } 46 | } 47 | 48 | /// 49 | /// Handles the Click event of the Delete control. 50 | /// 51 | /// The source of the event. 52 | /// The instance containing the event data. 53 | private void DeleteQuery_Click(object sender, RoutedEventArgs e) 54 | { 55 | RemoveTwitterQueryCommand.Execute((sender as Button).DataContext as BindableStringVO); 56 | } 57 | 58 | /// 59 | /// Handles the Click event of the Delete control. 60 | /// 61 | /// The source of the event. 62 | /// The instance containing the event data. 63 | private void DeleteBan_Click(object sender, RoutedEventArgs e) 64 | { 65 | RemoveTwitterBanCommand.Execute((sender as Button).DataContext as BindableStringVO); 66 | } 67 | 68 | /// 69 | /// Handles the Click event of the Add control. 70 | /// 71 | /// The source of the event. 72 | /// The instance containing the event data. 73 | private void AddQuery_Click(object sender, RoutedEventArgs e) 74 | { 75 | _JustAdded = true; 76 | AddTwitterQueryCommand.Execute(); 77 | } 78 | 79 | /// 80 | /// Handles the Click event of the Add control. 81 | /// 82 | /// The source of the event. 83 | /// The instance containing the event data. 84 | private void AddBan_Click(object sender, RoutedEventArgs e) 85 | { 86 | _JustAdded = true; 87 | AddTwitterBanCommand.Execute(); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SocialStream.Installer/SocialStream.Installer.wixproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x86 6 | 3.5 7 | {03119245-7580-4323-8ca1-6e4c6bcc17a5} 8 | 2.0 9 | SocialStream 10 | Package 11 | $(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets 12 | $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets 13 | SocialStream.Installer 14 | 15 | 16 | bin\$(Configuration)\ 17 | obj\$(Configuration)\ 18 | Debug 19 | 20 | 21 | bin\$(Configuration)\ 22 | obj\$(Configuration)\ 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | PreserveNewest 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | $(WixExtDir)\WixUtilExtension.dll 41 | WixUtilExtension 42 | 43 | 44 | $(WixExtDir)\WixUIExtension.dll 45 | WixUIExtension 46 | 47 | 48 | 49 | 50 | Debug 51 | bin\$(Platform)\$(Configuration)\ 52 | obj\$(Platform)\$(Configuration)\ 53 | 54 | 55 | bin\$(Platform)\$(Configuration)\ 56 | obj\$(Platform)\$(Configuration)\ 57 | 58 | 59 | bin\$(Platform)\$(Configuration)\ 60 | obj\$(Platform)\$(Configuration)\ 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 76 | -------------------------------------------------------------------------------- /FeedProcessor/Feeds/TwitterUserFeed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.IO; 4 | using System.ServiceModel.Syndication; 5 | using System.Web; 6 | using System.Xml; 7 | using FeedProcessor.Enums; 8 | using FeedProcessor.FeedItems; 9 | 10 | namespace FeedProcessor.Feeds 11 | { 12 | /// 13 | /// Handles the request and processing of Twitter user queries. 14 | /// 15 | internal class TwitterUserFeed : TwitterSearchFeed 16 | { 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The requested polling interval. 21 | /// The minimum allowed date of a returned item. 22 | internal TwitterUserFeed(TimeSpan pollInterval, DateTime minDate) 23 | : base(TimeSpan.FromMilliseconds(Math.Max(pollInterval.TotalMilliseconds, MinPollingInterval.TotalMilliseconds)), minDate) 24 | { 25 | PageSize = 200; 26 | SourceType = SourceType.Twitter; 27 | } 28 | 29 | /// 30 | /// Builds the query that is passed to the feed service. 31 | /// 32 | /// The query URI. 33 | internal override Uri BuildQuery() 34 | { 35 | if (LastId > 0) 36 | { 37 | return new Uri(string.Format(CultureInfo.InvariantCulture, "http://api.twitter.com/1/statuses/user_timeline.atom?screen_name={0}&count={1}&page=1&since_id={2}", Query, PageSize, LastId)); 38 | } 39 | else 40 | { 41 | return new Uri(string.Format(CultureInfo.InvariantCulture, "http://api.twitter.com/1/statuses/user_timeline.atom?screen_name={0}&count={1}&page=1", Query, PageSize)); 42 | } 43 | } 44 | 45 | /// 46 | /// Processes the response from the feed service. 47 | /// 48 | /// response from the feed service. 49 | internal override void ProcessResponse(object responseObject) 50 | { 51 | string response = responseObject.ToString(); 52 | 53 | using (StringReader stringReader = new StringReader(response)) 54 | { 55 | SyndicationFeed feed = SyndicationFeed.Load(XmlReader.Create(stringReader)); 56 | foreach (SyndicationItem syndicationItem in feed.Items) 57 | { 58 | long id = long.Parse(syndicationItem.Links[0].Uri.AbsoluteUri.Substring(syndicationItem.Links[0].Uri.AbsoluteUri.LastIndexOf('/') + 1), CultureInfo.InvariantCulture); 59 | LastId = Math.Max(id, LastId); 60 | 61 | DateTime publishDate = syndicationItem.PublishDate.DateTime.ToLocalTime(); 62 | 63 | if (publishDate < MinDate) 64 | { 65 | continue; 66 | } 67 | 68 | RaiseGotNewFeedItem(new StatusFeedItem 69 | { 70 | Uri = syndicationItem.Links[0].Uri, 71 | Date = publishDate, 72 | 73 | // The author name isn't actually in the response -- it's in the text as "endquote: tweet text" 74 | Author = HttpUtility.HtmlDecode(syndicationItem.Title.Text.Substring(0, syndicationItem.Title.Text.IndexOf(':'))), 75 | AvatarUri = syndicationItem.Links[1].Uri, 76 | SourceType = SourceType.Twitter, 77 | Status = HttpUtility.HtmlDecode(StripHtml(syndicationItem.Title.Text.Substring(syndicationItem.Title.Text.IndexOf(':') + 2))) 78 | }); 79 | } 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /SocialStream/Converters/RelativeTimeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using SocialStream.Properties; 5 | 6 | namespace SocialStream.Converters 7 | { 8 | /// 9 | /// Given a DateTime, return a string representing its relative value, like "10 minutes ago". 10 | /// 11 | public class RelativeTimeConverter : IValueConverter 12 | { 13 | /// 14 | /// Converts a value. 15 | /// 16 | /// The value produced by the binding source. 17 | /// The type of the binding target property. 18 | /// The converter parameter to use. 19 | /// The culture to use in the converter. 20 | /// 21 | /// A converted value. If the method returns null, the valid null value is used. 22 | /// 23 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | if (!(value is DateTime)) 26 | { 27 | return string.Empty; 28 | } 29 | 30 | DateTime date = (DateTime)value; 31 | TimeSpan diff = DateTime.Now - date; 32 | string suffix = string.Empty; 33 | int numeral = 0; 34 | 35 | if (diff.TotalDays >= 365) 36 | { 37 | numeral = (int)Math.Floor(diff.TotalDays / 365); 38 | suffix = numeral == 1 ? Resources.YearAgo : Resources.YearsAgo; 39 | } 40 | else if (diff.TotalDays >= 31) 41 | { 42 | numeral = (int)Math.Floor(diff.TotalDays / 31); 43 | suffix = numeral == 1 ? Resources.MonthAgo : Resources.MonthsAgo; 44 | } 45 | else if (diff.TotalDays >= 7) 46 | { 47 | numeral = (int)Math.Floor(diff.TotalDays / 7); 48 | suffix = numeral == 1 ? Resources.WeekAgo : Resources.WeeksAgo; 49 | } 50 | else if (diff.TotalDays >= 1) 51 | { 52 | numeral = (int)Math.Floor(diff.TotalDays); 53 | suffix = numeral == 1 ? Resources.DayAgo : Resources.DaysAgo; 54 | } 55 | else if (diff.TotalHours >= 1) 56 | { 57 | numeral = (int)Math.Floor(diff.TotalHours); 58 | suffix = numeral == 1 ? Resources.HourAgo : Resources.HoursAgo; 59 | } 60 | else if (diff.TotalMinutes >= 1) 61 | { 62 | numeral = (int)Math.Floor(diff.TotalMinutes); 63 | suffix = numeral == 1 ? Resources.MinuteAgo : Resources.MinutesAgo; 64 | } 65 | else if (diff.TotalSeconds >= 1) 66 | { 67 | numeral = (int)Math.Floor(diff.TotalSeconds); 68 | suffix = numeral == 1 ? Resources.SecondAgo : Resources.SecondsAgo; 69 | } 70 | else 71 | { 72 | suffix = Resources.JustNow; 73 | } 74 | 75 | string output = numeral == 0 ? suffix : string.Format(CultureInfo.InvariantCulture, "{0} {1}", numeral, suffix); 76 | return output; 77 | } 78 | 79 | /// 80 | /// Converts a value. 81 | /// 82 | /// The value that is produced by the binding target. 83 | /// The type to convert to. 84 | /// The converter parameter to use. 85 | /// The culture to use in the converter. 86 | /// 87 | /// A converted value. If the method returns null, the valid null value is used. 88 | /// 89 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 90 | { 91 | throw new NotSupportedException(); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverContent/SmallNews.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /SocialStream/Controls/RiverContent/SmallTweet.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /SocialStream/Helpers/Audio.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Xna.Framework.Audio; 3 | 4 | namespace SocialStream.Helpers 5 | { 6 | /// 7 | /// A class to manage and play audio samples. 8 | /// 9 | internal class Audio : IDisposable 10 | { 11 | /// 12 | /// The private instance of this Singleton. 13 | /// 14 | private static Audio _instance; 15 | 16 | /// 17 | /// The XNA AudioEngine. 18 | /// 19 | private AudioEngine _audioEngine; 20 | 21 | /// 22 | /// The XNA WaveBank. 23 | /// 24 | private WaveBank _waveBank; 25 | 26 | /// 27 | /// The XNA SoundBank. 28 | /// 29 | private SoundBank _soundBank; 30 | 31 | /// 32 | /// Prevents a default instance of the class from being created. 33 | /// 34 | private Audio() 35 | { 36 | LoadAudioContent(); 37 | } 38 | 39 | /// 40 | /// Gets the singleton instance of this class. 41 | /// 42 | /// 43 | /// The instance. 44 | /// 45 | public static Audio Instance 46 | { 47 | get 48 | { 49 | if (_instance == null) 50 | { 51 | _instance = new Audio(); 52 | } 53 | 54 | return _instance; 55 | } 56 | } 57 | 58 | /// 59 | /// Loads the audio data manually. 60 | /// 61 | public static void Initialize() 62 | { 63 | _instance = new Audio(); 64 | } 65 | 66 | #region IDisposable Members 67 | 68 | /// 69 | /// Dispose IDisposable members. 70 | /// 71 | public void Dispose() 72 | { 73 | GC.SuppressFinalize(this); 74 | _audioEngine.Dispose(); 75 | _waveBank.Dispose(); 76 | _soundBank.Dispose(); 77 | } 78 | 79 | #endregion 80 | 81 | /// 82 | /// Plays an audio sample. 83 | /// 84 | /// The sound cue. 85 | public void PlayCue(string soundCue) 86 | { 87 | if (_audioEngine == null) 88 | { 89 | return; 90 | } 91 | 92 | Cue cue = null; 93 | try 94 | { 95 | cue = _soundBank.GetCue(soundCue); 96 | } 97 | catch 98 | { 99 | throw; 100 | } 101 | 102 | if (cue != null) 103 | { 104 | cue.Play(); 105 | } 106 | } 107 | 108 | /// 109 | /// Load up the audio files. 110 | /// 111 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "I don't know what this means, or how I'd fix it.")] 112 | private void LoadAudioContent() 113 | { 114 | string filename = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; 115 | string path = System.IO.Path.GetDirectoryName(filename) + "\\Resources\\Audio\\"; 116 | 117 | try 118 | { 119 | _audioEngine = new AudioEngine(path + "Audio.xgs"); 120 | _waveBank = new WaveBank(_audioEngine, path + "Audio.xwb"); 121 | _soundBank = new SoundBank(_audioEngine, path + "Audio.xsb"); 122 | } 123 | catch 124 | { 125 | _audioEngine = null; 126 | _waveBank = null; 127 | _soundBank = null; 128 | throw; 129 | } 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /SocialStream/Converters/MultiVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | 8 | namespace SocialStream.Converters 9 | { 10 | /// 11 | /// Given a list of values, return visible if any of those values passes VisibilityConverter. Pass any parameter to return visible if no values pass. 12 | /// 13 | internal class MultiVisibilityConverter : IMultiValueConverter 14 | { 15 | /// 16 | /// An internal VisibilityConverter to do the actual conversion. 17 | /// 18 | private static VisibilityConverter _visibilityConverter; 19 | 20 | /// 21 | /// Converts source values to a value for the binding target. The data binding engine calls this method when it propagates the values from source bindings to the binding target. 22 | /// 23 | /// The array of values that the source bindings in the produces. The value indicates that the source binding has no value to provide for conversion. 24 | /// The type of the binding target property. 25 | /// The converter parameter to use. 26 | /// The culture to use in the converter. 27 | /// 28 | /// A converted value. 29 | /// If the method returns null, the valid null value is used. 30 | /// A return value of . indicates that the converter did not produce a value, and that the binding will use the if it is available, or else will use the default value. 31 | /// A return value of . indicates that the binding does not transfer the value or use the or the default value. 32 | /// 33 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 34 | { 35 | if (_visibilityConverter == null) 36 | { 37 | _visibilityConverter = new VisibilityConverter(); 38 | } 39 | 40 | List converted = 41 | (from v in values 42 | where v != DependencyProperty.UnsetValue 43 | select (Visibility)_visibilityConverter.Convert(v, targetType, null, culture)) 44 | .ToList(); 45 | 46 | Visibility output = converted.Contains(Visibility.Visible) ? Visibility.Visible : Visibility.Collapsed; 47 | 48 | if (parameter != null) 49 | { 50 | output = output == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible; 51 | } 52 | 53 | return output; 54 | } 55 | 56 | /// 57 | /// Converts a binding target value to the source binding values. 58 | /// 59 | /// The value that the binding target produces. 60 | /// The array of types to convert to. The array length indicates the number and types of values that are suggested for the method to return. 61 | /// The converter parameter to use. 62 | /// The culture to use in the converter. 63 | /// 64 | /// An array of values that have been converted from the target value back to the source values. 65 | /// 66 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 67 | { 68 | throw new NotSupportedException(); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /SocialStream/Controls/CloseTimer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Data; 6 | using System.Windows.Media.Animation; 7 | using Microsoft.Surface.Presentation.Controls; 8 | 9 | namespace SocialStream.Controls 10 | { 11 | /// 12 | /// When bound to River.TimeoutDelay, displays a timeout animation for the last portion of that delay. 13 | /// 14 | internal class CloseTimer : Control 15 | { 16 | /// 17 | /// The storyboard which contains the timeout animation. 18 | /// 19 | private Storyboard _timeout; 20 | 21 | /// 22 | /// The root element of the template, which contains the timeout storyboard. 23 | /// 24 | private Panel _layoutRoot; 25 | 26 | /// 27 | /// When overridden in a derived class, is invoked whenever application code or internal processes call . 28 | /// 29 | public override void OnApplyTemplate() 30 | { 31 | if (DesignerProperties.GetIsInDesignMode(this)) 32 | { 33 | return; 34 | } 35 | 36 | // Setting this in XAML causes Blend to freak out. 37 | Binding binding = new Binding() 38 | { 39 | Path = new PropertyPath(River.TimeoutDelayProperty), 40 | RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(ScatterViewItem), 1) 41 | }; 42 | 43 | BindingOperations.SetBinding(this, TimeoutDelayProperty, binding); 44 | 45 | _layoutRoot = GetTemplateChild("PART_LayoutRoot") as Panel; 46 | Loaded += (sender, e) => UpdateTimeoutDelay(); 47 | UpdateTimeoutDelay(); 48 | 49 | base.OnApplyTemplate(); 50 | } 51 | 52 | #region TimeoutDelay 53 | 54 | /// 55 | /// Gets or sets the time before the parent item will get closed automatically. 56 | /// 57 | public TimeSpan TimeoutDelay 58 | { 59 | get { return (TimeSpan)GetValue(TimeoutDelayProperty); } 60 | set { SetValue(TimeoutDelayProperty, value); } 61 | } 62 | 63 | /// 64 | /// Backing store for TimeoutDelay. 65 | /// 66 | public static readonly DependencyProperty TimeoutDelayProperty = DependencyProperty.Register("TimeoutDelay", typeof(TimeSpan), typeof(CloseTimer), new PropertyMetadata(TimeSpan.Zero, TimeoutDelayPropertyChanged)); 67 | 68 | /// 69 | /// Fires when TimeoutDelay changes. 70 | /// 71 | /// The sender. 72 | /// The instance containing the event data. 73 | private static void TimeoutDelayPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 74 | { 75 | (sender as CloseTimer).UpdateTimeoutDelay(); 76 | } 77 | 78 | /// 79 | /// Updates the TimeoutDelay. 80 | /// 81 | private void UpdateTimeoutDelay() 82 | { 83 | if (_layoutRoot == null || !IsLoaded) 84 | { 85 | return; 86 | } 87 | 88 | if (_timeout != null) 89 | { 90 | _timeout.Stop(this); 91 | } 92 | 93 | if (TimeoutDelay == TimeSpan.Zero) 94 | { 95 | return; 96 | } 97 | 98 | if (_timeout == null) 99 | { 100 | _timeout = (_layoutRoot.Resources["Timeout"] as Storyboard).Clone(); 101 | } 102 | 103 | (_timeout.Children[0] as ThicknessAnimation).BeginTime = TimeoutDelay - TimeSpan.FromSeconds(5); 104 | _timeout.Begin(this, Template, true); 105 | } 106 | 107 | #endregion 108 | } 109 | } 110 | --------------------------------------------------------------------------------