Posts Tagged ‘Data’
23
Nov

Stock Chart

1 Comment » Popularity: 1%

amCharts is a powerful financial charts control which support Line, column, candlestick, OHLC, step line and area charts type. It works for data-binding with various data sets. Of course, there are many other stunning features which greatly enhanced the chart viewing experience.

Stock Chart

View Demo: New Window
22
Nov

Create Business Objects using RIA Services

1 Comment » Popularity: 1%

A very basic tutorial guiding you to create your own Business Object using RIA Services. Read the rest of the tutorial in Deborah Kurata’s blog.

Create Business Objects using RIA Services 

12
Nov

ADO.NET Data Services

1 Comment » Popularity: 1%

A Game catalog which demonstrated how to use ADO.NET Data Services. You are able to witch between NHibernate and Entity Framework as well.

ADO.NET Data Services

View Demo: New Window
12
Nov

Interacting with different data source

1 Comment » Popularity: 1%

 Jeremy Likness explained in details 3 different ways (WCF, REST, Callback from browser) for Silverlight to retrieve data. Very comprehensive and useful tutorial.

Interacting with different data source

28
Sep

Integrate with Browser Cookie

Post a comment » Popularity: 1%

Integrate with the browser cookie for saving and accessing data in the cookie.

Integrate with Browser Cookie

Get and Set Cookie:
// sample usage
CookieManager.SetCookie("key", "value", TimeSpan.FromSeconds(3600));
string value  = CookieManager.GetCookie("value");

// cookie manager class
public class CookieManager
    {

        public static void SetCookie(string key, string val, TimeSpan? expires)
        {

            SetCookie(key, val, expires, null, null, false);
        }

        public static void SetCookie(string key, string val, TimeSpan? expires, string path, string domain, bool secure)
        {

            StringBuilder fullCookie = new StringBuilder();
            fullCookie.Append(string.Concat(key, "=", val));

            if (expires.HasValue)
            {

                DateTime expire = DateTime.UtcNow + expires.Value;
                fullCookie.Append(string.Concat(";expires=", expire.ToString("R")));
            }

            if (path != null)
            {

                fullCookie.Append(string.Concat(";path=", path));
            }

            if (domain != null)
            {

                fullCookie.Append(string.Concat(";domain=", domain));
            }

            if (secure)
            {

                fullCookie.Append(";secure");
            }

            HtmlPage.Document.SetProperty("cookie", fullCookie.ToString());
        }

        public static string GetCookie(String key)
        {
            String[] cookies = HtmlPage.Document.Cookies.Split(';');
            String result = (from c in cookies let keyValues = c.Split('=') where
                                 keyValues.Length == 2 && keyValues[0].Trim() == key.Trim()
                             select keyValues[1]).FirstOrDefault();
            return result;
        }

        public static void DeleteCookie(String key){
            DateTime expir =DateTime.UtcNow -TimeSpan.FromDays(1);
            string cookie =String.Format("{0}=;expires={1}",
            key, expir.ToString("R"));
            HtmlPage.Document.SetProperty("cookie", cookie);
        }

        public static bool Exists(String key, String value)
        {
            return HtmlPage.Document.Cookies.Contains(String.Format("{0}={1}", key, value));
        }
    }
24
Sep

Load & Save File from Isolated Storage

Post a comment » Popularity: 1%

Mike Snow demonstrated how to read file and load file from local storage. Please read the C# for details.

Load & Save File from Isolated Storage

Save and read file from local storage:
using System;
using System.Windows.Controls;
using System.IO.IsolatedStorage;
using System.IO;

namespace SilverlightApplication10
{
    public class Page : UserControl
    {
        public Page()
        {
            SaveData("Hello There", "MyData.txt");
            if (HasFile("MyData.txt"))
            {
                string test = LoadData("MyData.txt");
            }
        }

        private void SaveData(string data, string fileName)
        {
            IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
            IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(fileName, FileMode.Create, isf);
            using (StreamWriter sw = new StreamWriter(isfs))
            {
                sw.Write(data);
                sw.Close();
            }
        }

        private bool HasFile(string fileName)
        {
            IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
            return isf.FileExists(fileName);
        }

        private string LoadData(string fileName)
        {
            string data = String.Empty;
            IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
            IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(fileName, FileMode.Open, isf);
            using (StreamReader sr = new StreamReader(isfs))
            {
                string lineOfData = String.Empty;
                while ((lineOfData = sr.ReadLine()) != null) data += lineOfData;
            }
            return data;
        }
    }
}
21
Sep

Transmitting data using JSON

1 Comment » Popularity: 1%

Switch on The Code released an article demonstrating how Silverlight can communicate with JSON object using DataContractJsonSerializer.

Transmitting data using JSON

18
Sep

Loading XML file

2 Comments » Popularity: 1%

A detailed article released by kirual, teaching you how to get an xml data file from remote server.

Loading XML file

11
Sep

Simple Data Binding in Blend 3

Post a comment » Popularity: 1%

Alex Knight has written an tutorial teaching you how to use data binding wisely. You will find that data binding is extremely useful if you really understand how to use it.

Simple Data Binding in Blend 3