This commit is contained in:
2024-02-23 06:55:00 -05:00
commit 277fc69c11
12 changed files with 1073 additions and 0 deletions

330
.gitignore vendored Normal file
View File

@@ -0,0 +1,330 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/

162
Animation/FeedManager.cs Normal file
View File

@@ -0,0 +1,162 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Threading;
using Ticker.Models;
using Ticker.Helper;
namespace Ticker.Animation
{
public class FeedManager
{
private static int FEED_DEFAULT_INTERVAL_MINUTES=1;
private static String FEED_CACHE_FILE_NAME="feedcache.txt";
private readonly Dictionary<string, FeedItem> feedItems = new Dictionary<string, FeedItem>();
private DispatcherTimer dispatcherTimer = new DispatcherTimer();
public event EventHandler<ItemEventArgs<FeedItem>> NewFeedItem;
public delegate List<FeedItem> GetFeedItemsEventHandler();
public event GetFeedItemsEventHandler FeedSourceEventHandler;
private bool stop = false;
private bool isInit=true;
public FeedManager()
{
ReadCache();
dispatcherTimer.Tick += DispatcherTimer_Tick;
dispatcherTimer.Interval = new TimeSpan(0, FEED_DEFAULT_INTERVAL_MINUTES, 0);
}
public virtual void Dispose()
{
Stop();
}
public void MarkFeedAsRead(FeedItem item)
{
if(!feedItems.ContainsKey(item.Guid))return;
feedItems[item.Guid].Read = true;
WriteCache(item);
}
public int GetFeedItemCount()
{
int count=0;
lock(feedItems)
{
if(null==feedItems||0==feedItems.Count)return count;
List<FeedItem> feedItemsList=new List<FeedItem>(feedItems.Values);
count=(from FeedItem feedItem in feedItemsList where feedItem.Read==false select feedItem).Count();
}
return count;
}
private void DispatcherTimer_Tick(object sender, EventArgs e)
{
Go();
}
public int FeedIntervalMinutes
{
get{return dispatcherTimer.Interval.Minutes;}
set{dispatcherTimer.Interval=new TimeSpan(0,value,0);}
}
public void Start()
{
stop = false;
Go();
dispatcherTimer.Start();
}
public void Stop()
{
if(stop)return;
if(null!=dispatcherTimer)dispatcherTimer.Stop();
stop = true;
}
private void Go()
{
if(stop)return;
if(isInit)
{
isInit=false;
AddOpeningBanner();
}
ThreadPool.QueueUserWorkItem(LoadFeed,null);
}
// ***************************************************************************************************************************************************
// *************************************************************************** F E E D C A C H E ****************************************************
// ***************************************************************************************************************************************************
private void ReadCache()
{
lock(feedItems)
{
feedItems.Clear();
List<FeedItem> cacheItems=FeedSerializer.Deserialize(FEED_CACHE_FILE_NAME);
foreach(FeedItem feedItem in cacheItems)
{
if(!feedItems.ContainsKey(feedItem.Guid))feedItems.Add(feedItem.Guid,feedItem);
}
}
}
private void WriteCache(FeedItem feedItem)
{
lock(feedItems)
{
List<FeedItem> cacheItems=new List<FeedItem>(feedItems.Values);
FeedSerializer.Serialize(FEED_CACHE_FILE_NAME,DateTime.Today,feedItem);
}
}
// ***************************************************************************************************************************************************
private void AddOpeningBanner()
{
FeedItem feedItem=new FeedItem();
DateTime today=DateTime.Now;
feedItem.Description="TradeBlotter";
feedItem.Title=today.ToLongDateString()+" "+today.ToLongTimeString();
feedItem.Guid=today.ToLongTimeString();
feedItem.Link="https://www.time.gov/";
feedItem.Source="";
feedItem.PubDate=today.ToLongDateString();
feedItems.Add(feedItem.Guid,feedItem);
if (NewFeedItem != null) NewFeedItem(this, new ItemEventArgs<FeedItem>(feedItem));
}
private void LoadFeed(object state)
{
try
{
List<FeedItem> newFeedItems=null;
if(null==FeedSourceEventHandler)return;
newFeedItems=FeedSourceEventHandler();
if(null==newFeedItems||0==newFeedItems.Count)return;
foreach (FeedItem item in newFeedItems)
{
if (stop) return;
if (feedItems.ContainsKey(item.Guid)) continue;
item.Title = Clean(item.Title).Replace("\r","").Replace("\n","");
item.Description = Clean(item.Description);
lock (feedItems)
{
feedItems.Add(item.Guid, item);
}
if (NewFeedItem != null) NewFeedItem(this, new ItemEventArgs<FeedItem>(item));
}
}
catch(Exception)
{
}
}
private static string Clean(string input)
{
string output = input.Trim();
output = output.Replace("&#39;", "'");
output = output.Replace("&amp;", "&");
output = output.Replace("&quot;", "\"");
output = output.Replace("&nbsp;", " ");
output = RemoveHTMLTags(output);
return output;
}
private static string RemoveHTMLTags(string text)
{
string regularExpressionString = "<.+?>";
Regex r = new Regex(regularExpressionString, RegexOptions.Singleline);
return r.Replace(text, "");
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
namespace Ticker.Animation
{
public class ItemEventArgs<T> : EventArgs
{
public ItemEventArgs(T item)
{
Item = item;
}
public T Item { get; private set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.Windows;
using System.Windows.Media.Animation;
namespace Ticker.Animation
{
public class TaggedDoubleAnimation : DoubleAnimation
{
public FrameworkElement TargetElement { get; set; }
protected override Freezable CreateInstanceCore()
{
return new TaggedDoubleAnimation{TargetElement = TargetElement};
}
}
}

95
Animation/Ticker.cs Normal file
View File

@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
namespace Ticker.Animation
{
public class Ticker<T> where T : FrameworkElement
{
private static int DISPLAY_TIMER_SPEED_SECONDS=40; // This is the speed used to traverse the display from right to left
private static int DISPLAY_TIMER_INTERVAL_MILLISECONDS=1000; // This is the interval of time between displaying successive items
private readonly DispatcherTimer displayTimer=new DispatcherTimer(DispatcherPriority.Normal); // new DispatcherTimer();
public EventHandler<ItemEventArgs<T>> ItemDisplayed;
public Ticker(Panel container)
{
SeperatorSize = 25;
Container = container;
Container.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
Container.Arrange(new Rect(Container.DesiredSize));
Speed = new TimeSpan(0, 0, 0, DISPLAY_TIMER_SPEED_SECONDS);
Items = new Queue<T>();
displayTimer.Tick += displayTimer_Tick;
displayTimer.Start();
IsRunning = true;
}
public virtual void Dispose()
{
Stop();
}
public bool IsRunning { get; set; }
public void Stop()
{
if(!IsRunning)return;
if(null!=displayTimer)displayTimer.Stop();
IsRunning = false;
}
public void Start()
{
if(IsRunning)return;
if(null==displayTimer)return;
displayTimer.Start();
displayTimer.Interval = new TimeSpan(0,0,0,0,DISPLAY_TIMER_INTERVAL_MILLISECONDS);
IsRunning = true;
}
public double SeperatorSize { get; set; }
public TimeSpan Speed { get; set; }
public Queue<T> Items { get; set; }
public Panel Container { get; private set; }
private void displayTimer_Tick(object sender, EventArgs e)
{
DisplayNextItem();
}
private void DisplayNextItem()
{
if (Items.Count == 0)return;
T item = Items.Dequeue();
Container.Children.Add(item);
AnimateMove(item);
if (ItemDisplayed != null) ItemDisplayed(this, new ItemEventArgs<T>(item));
}
private void AnimateMove(FrameworkElement e)
{
e.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
e.Arrange(new Rect(e.DesiredSize));
double from = Container.ActualWidth;
double to = -500;
int unitsPerSec = Convert.ToInt32(Math.Abs(from - to)/Speed.TotalSeconds);
int nextFire = Convert.ToInt32((e.ActualWidth + SeperatorSize)/unitsPerSec);
displayTimer.Stop();
displayTimer.Interval = new TimeSpan(0, 0, nextFire);
// displayTimer.Dispatcher.Thread.Priority=ThreadPriority.AboveNormal;
displayTimer.Start();
TaggedDoubleAnimation animation = new TaggedDoubleAnimation();
animation.From = from;
animation.To = to;
animation.Duration = new Duration(Speed);
animation.TargetElement = e;
animation.Completed += ani_Completed;
TranslateTransform translateTransform = new TranslateTransform();
e.RenderTransform = translateTransform;
translateTransform.BeginAnimation(TranslateTransform.XProperty, animation, HandoffBehavior.Compose);
}
private void ani_Completed(object sender, EventArgs e)
{
Clock clock = (Clock) sender;
TaggedDoubleAnimation animation = (TaggedDoubleAnimation) clock.Timeline;
FrameworkElement element = animation.TargetElement;
Container.Children.Remove(element);
}
}
}

116
Helper/FeedSerializer.cs Normal file
View File

@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Windows.Media;
using MarketData.Utils;
using Ticker.Models;
// Author:Sean Kessler
namespace Ticker.Helper
{
public class FeedSerializer
{
private FeedSerializer()
{
}
public static List<FeedItem> Deserialize(String strPathFileName)
{
List<FeedItem> feedItems=new List<FeedItem>();
if(!File.Exists(strPathFileName))return feedItems;
String strLine=null;
if(!IsCacheCurrent(strPathFileName,DateTime.Now))
{
RemoveCache(strPathFileName);
return feedItems;
}
StreamReader streamReader=new StreamReader(new FileStream(strPathFileName,FileMode.Open));
DateTime cacheDate=new NVP(streamReader.ReadLine()).Get<DateTime>();
while(null!=(strLine=streamReader.ReadLine()))
{
if("".Equals(strLine))continue;
FeedItem feedItem=FeedItem.FromString(strLine);
if(null==feedItem)continue;
feedItems.Add(feedItem);
}
streamReader.Close();
streamReader.Dispose();
return feedItems;
}
public static bool Serialize(String strPathFileName,DateTime feedDate,List<FeedItem> feedsList)
{
try
{
if(File.Exists(strPathFileName))File.Delete(strPathFileName);
StreamWriter streamWriter=new StreamWriter(new FileStream(strPathFileName,FileMode.CreateNew));
streamWriter.WriteLine(new NVP("CacheDate",feedDate.ToShortDateString()).ToString());
foreach(FeedItem feedItem in feedsList)
{
String strLine=feedItem.ToNVPCollection().ToString();
if(null==strLine||"".Equals(strLine))continue;
streamWriter.WriteLine(strLine);
}
streamWriter.Flush();
streamWriter.Close();
streamWriter.Dispose();
return true;
}
catch(Exception)
{
return false;
}
}
public static bool Serialize(String strPathFileName,DateTime feedDate,FeedItem feedItem)
{
try
{
StreamWriter streamWriter=null;
String strLine=feedItem.ToNVPCollection().ToString();
if(null==strLine||"".Equals(strLine))return false;
if(!File.Exists(strPathFileName))
{
streamWriter=new StreamWriter(new FileStream(strPathFileName,FileMode.CreateNew));
streamWriter.WriteLine(new NVP("CacheDate",feedDate.ToShortDateString()).ToString());
}
else
{
streamWriter=new StreamWriter(new FileStream(strPathFileName,FileMode.Append));
}
streamWriter.WriteLine(strLine);
streamWriter.Flush();
streamWriter.Close();
streamWriter.Dispose();
return true;
}
catch(Exception)
{
return false;
}
}
private static bool IsCacheCurrent(String strPathFileName,DateTime feedDate)
{
try
{
if(!File.Exists(strPathFileName))return false;
StreamReader streamReader=new StreamReader(new FileStream(strPathFileName,FileMode.Open));
DateTime cacheDate=new NVP(streamReader.ReadLine()).Get<DateTime>();
streamReader.Close();
return feedDate.Date.Equals(cacheDate.Date);
}
catch(Exception)
{
return false;
}
}
private static void RemoveCache(String strPathFileName)
{
try
{
if(File.Exists(strPathFileName))File.Delete(strPathFileName);
}
catch(Exception)
{
}
}
}
}

153
Models/FeedItem.cs Normal file
View File

@@ -0,0 +1,153 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Windows.Media;
using MarketData.Utils;
using Ticker.Helper;
namespace Ticker.Models
{
public class FeedBrushes
{
public enum BrushColor{Normal=0,Red=1,Green=2};
public static Brush[] ContextBrushes={
new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00ABA9")),
new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF0000")),
new SolidColorBrush((Color)ColorConverter.ConvertFromString("#008000"))
};
private FeedBrushes()
{
}
public static Brush GetContextBrush(BrushColor brushColor)
{
return ContextBrushes[(int)brushColor];
}
}
//
public class FeedItem : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string title;
private string pubDate;
private string link;
private string description;
private string guid;
private string source;
private bool read;
private FeedBrushes.BrushColor brushAssignment;
public FeedItem()
{
brushAssignment=FeedBrushes.BrushColor.Normal;
}
// Don't save the link. Firstly, we don't need it, secondly, it contains '=' which are a keyword for NVP
public NVPCollection ToNVPCollection()
{
NVPCollection nvpCollection=new NVPCollection();
nvpCollection.Add(new NVP("Title",title));
nvpCollection.Add(new NVP("PubDate",pubDate));
String fixupLink=link.Replace("=","^");
nvpCollection.Add(new NVP("Link",fixupLink));
nvpCollection.Add(new NVP("Description",description));
nvpCollection.Add(new NVP("Guid",guid));
nvpCollection.Add(new NVP("Source",source));
nvpCollection.Add(new NVP("Read",read.ToString()));
return nvpCollection;
}
public static FeedItem FromString(String strFeedItem)
{
try
{
FeedItem feedItem=new FeedItem();
NVPCollection nvpCollection=new NVPCollection(strFeedItem);
NVPDictionary nvpDictionary=nvpCollection.ToDictionary();
feedItem.Title=nvpDictionary["Title"].Get<String>();
feedItem.PubDate=nvpDictionary["PubDate"].Get<String>();
String fixupLink=nvpDictionary["Link"].Get<String>();
feedItem.Link=fixupLink.Replace("^","=");
feedItem.Description=nvpDictionary["Description"].Get<String>();
feedItem.Guid=nvpDictionary["Guid"].Get<String>();
feedItem.Source=nvpDictionary["Source"].Get<String>();
feedItem.Read=nvpDictionary["Read"].Get<Boolean>();
return feedItem;
}
catch(Exception)
{
return null;
}
}
public Brush ForegroundBrush
{
get{return FeedBrushes.GetContextBrush(brushAssignment);}
}
public FeedBrushes.BrushColor BrushAssigment
{
get{return brushAssignment;}
set{brushAssignment=value;if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("BrushAssigment"));}
}
public bool Read
{
get { return read; }
set
{
read = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Read"));
}
}
public string Source
{
get { return source; }
set
{
source = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Source"));
}
}
public string Guid
{
get { return guid; }
set
{
guid = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Guid"));
}
}
public string Description
{
get { return description; }
set
{
description = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Description"));
}
}
public string Link
{
get { return link; }
set
{
link = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Link"));
}
}
public string PubDate
{
get { return pubDate; }
set
{
pubDate = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("PubDate"));
}
}
public string Title
{
get { return title; }
set
{
title = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Title"));
}
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TickerLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TickerLib")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a5608a21-5b1c-427f-8a8a-497cb7a2cae5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

79
TickerLib.csproj Normal file
View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C2682400-EEB6-41AD-AE25-1D60A307D99C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TickerLib</RootNamespace>
<AssemblyName>TickerLib</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Animation\FeedManager.cs" />
<Compile Include="Animation\ItemEventArgs.cs" />
<Compile Include="Animation\TaggedDoubleAnimation.cs" />
<Compile Include="Animation\Ticker.cs" />
<Compile Include="Helper\FeedSerializer.cs" />
<Compile Include="Models\FeedItem.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Views\TickerItemView.xaml.cs">
<DependentUpon>TickerItemView.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\marketdata\MarketDataLib\MarketDataLib.csproj">
<Project>{e807f1ca-9d9c-484a-8e83-269d57707b4b}</Project>
<Name>MarketDataLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="Views\TickerItemView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

20
TickerLib.sln Normal file
View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TickerLib", "TickerLib.csproj", "{C2682400-EEB6-41AD-AE25-1D60A307D99C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C2682400-EEB6-41AD-AE25-1D60A307D99C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2682400-EEB6-41AD-AE25-1D60A307D99C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2682400-EEB6-41AD-AE25-1D60A307D99C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2682400-EEB6-41AD-AE25-1D60A307D99C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

19
Views/TickerItemView.xaml Normal file
View File

@@ -0,0 +1,19 @@
<UserControl x:Class="Ticker.Views.TickerItemView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
x:Name="UserControl"
d:DesignWidth="640" d:DesignHeight="480" Height="39">
<Grid Height="39" Margin="2,0,2,0" >
<TextBlock Foreground="#00ABA9" Height="18" VerticalAlignment="Top" TextWrapping="NoWrap">
<Hyperlink NavigateUri="{Binding Path=FeedItem.Link}" RequestNavigate="Navigate">
<TextBlock Text="{Binding Path=FeedItem.Title}" Foreground="{Binding Path=FeedItem.ForegroundBrush}" TextWrapping="NoWrap"/>
</Hyperlink>
</TextBlock>
<TextBlock Text="{Binding Path=FeedItem.PubDate}" Margin="0,12,0,1" Foreground="#FF939393" TextWrapping="NoWrap" FontSize="10"/>
<TextBlock Text="{Binding Path=FeedItem.Source}" Margin="0,20,0,1" Foreground="#F09609" TextWrapping="NoWrap" FontSize="10" />
</Grid>
</UserControl>

View File

@@ -0,0 +1,35 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Navigation;
using Ticker.Models;
namespace Ticker.Views
{
/// <summary>
/// Interaction logic for TickerItemView.xaml
/// </summary>
public partial class TickerItemView : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private FeedItem feedItem;
public TickerItemView(FeedItem item)
{
InitializeComponent();
DataContext = this;
FeedItem = item;
}
public FeedItem FeedItem
{
get { return feedItem; }
set
{
feedItem = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("FeedItem"));
}
}
public void Navigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.ToString()));
}
}
}