DevConnections Presentation Orlando, How To Make Your Browser fly

(About 100 People)

The Presentation was broken down into three parts. 

Part 1

Created a windows razor project that cached in image on a web site using best practices for threading and locking.  The code and project to do this are below:

var downloadByteArray = HttpContext.Current.Cache[cacheName] as byte[];
if (downloadByteArray == null)
{
// make sure multiple requestors are not filling up the cache
lock (LockVal)
{
downloadByteArray = HttpContext.Current.Cache[cacheName] as byte[];
if (downloadByteArray == null)
{
Thread.Sleep(sleep * 1000);

string imageLocation = HttpContext.Current.Server.MapPath("~") + imageUrl;

downloadByteArray = File.ReadAllBytes(imageLocation);
if (cacheExpiresSeconds > 0)
{
HttpContext.Current.Cache.Insert(cacheName, downloadByteArray,
null,
DateTime.Now.Add(new TimeSpan(0, 0, 0, cacheExpiresSeconds)),
TimeSpan.Zero, CacheItemPriority.NotRemovable, null);
CacheInsertCounter = 9999; // any touch of this increments the global counter
}
}
}
}

 

 

Part 2

Tips from Steve Souders

 

Part 3

Sprite Library from Microsoft Example: 

 

imageIMAG0174IMAG0177

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP since 2007. In addition, he's a multi-course video author at Pluralsight. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Follow

Get every new post delivered to your Inbox

Join other followers: