protected void Page_Load(object sender, EventArgs e)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (State == null || State.Count <= 2) { SessionTimeOut.Text = "../../Default.aspx"; return; }

        if (State["SelectedAppType"] != null)
        {
            SelectedAppType.Value = State["SelectedAppType"].ToString();

            int thumbWidth = Constants.IPHONE_DISPLAY_WIDTH / 2;
            int thumbHeight = Convert.ToInt32(Constants.IPHONE_SCROLL_HEIGHT_S) / 2;

            if (State["SelectedDeviceType"] == null)
            {
                XScaleFactor.Value = (thumbWidth / Constants.IPHONE_SCROLL_WIDTH_D).ToString();
                YScaleFactor.Value = (thumbHeight / Constants.IPHONE_SCROLL_HEIGHT_D).ToString();
            }
            else
            {
                switch (State["SelectedDeviceType"].ToString())
                {
                    case Constants.IPHONE:
                    default:
                        XScaleFactor.Value = (thumbWidth / Constants.IPHONE_SCROLL_WIDTH_D).ToString();
                        YScaleFactor.Value = (thumbHeight / Constants.IPHONE_SCROLL_HEIGHT_D).ToString();
                        break;
                    case Constants.ANDROID_PHONE:
                        XScaleFactor.Value = (thumbWidth / Constants.ANDROID_PHONE_SCROLL_WIDTH_D).ToString();
                        YScaleFactor.Value = (thumbHeight / Constants.ANDROID_PHONE_SCROLL_HEIGHT_D).ToString();
                        break;
                    case Constants.IPAD:
                        XScaleFactor.Value = (thumbWidth / Constants.IPAD_SCROLL_WIDTH_D).ToString();
                        YScaleFactor.Value = (thumbHeight / Constants.IPAD_SCROLL_HEIGHT_D).ToString();
                        break;
                    case Constants.ANDROID_TABLET:
                        XScaleFactor.Value = (thumbWidth / Constants.ANDROID_TABLET_SCROLL_WIDTH_D).ToString();
                        YScaleFactor.Value = (thumbHeight / Constants.ANDROID_TABLET_SCROLL_HEIGHT_D).ToString();
                        break;
                }
            }
        }
        try
        {
            if (IsPostBack)
                Message.Text = " ";
            else
            {
                LoadCurrentStoryBoardPage();
                DataSources DS = new DataSources();
                State["DataSourceDatabaseTables"] = DS.GetDataSourceDatabaseTables(State);
                BuildDatabaseTrees();
             }
        }
        catch (Exception ex)
        {
            Util util = new Util();
            util.LogError(State, ex);
        }
    }