static int AsReadOnly(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         System.Collections.Generic.List <UnityEngine.GameObject> obj = (System.Collections.Generic.List <UnityEngine.GameObject>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <UnityEngine.GameObject>));
         System.Collections.ObjectModel.ReadOnlyCollection <UnityEngine.GameObject> o = obj.AsReadOnly();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #2
0
    static int AsReadOnly(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        List <fogs.proto.config.AwardConfig> obj = (List <fogs.proto.config.AwardConfig>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<fogs.proto.config.AwardConfig>");

        System.Collections.ObjectModel.ReadOnlyCollection <fogs.proto.config.AwardConfig> o = obj.AsReadOnly();
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Example #3
0
 public void RetrieveProducts(System.Collections.ObjectModel.ReadOnlyCollection <UnityEngine.Purchasing.ProductDefinition> products)
 {
     // Fetch product information and invoke callback.OnProductsRetrieved();
 }
Example #4
0
    protected void Grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
    {
        string[] parameters = e.Parameters.Split(';');

        int    index              = int.Parse(parameters[0]);
        string fieldname          = parameters[1];
        bool   isGroupRowSelected = bool.Parse(parameters[2]);

        System.Collections.ObjectModel.ReadOnlyCollection <GridViewDataColumn> groupedCols = Grid.GetGroupedColumns();

        if (groupedCols[groupedCols.Count - 1].FieldName == fieldname)
        {
            // Checked groupcolumn is the lowest level groupcolumn;
            // we can apply original recursive checking here

            Grid.ExpandRow(index, true); // expand grouped column for consistent behaviour
            for (int i = 0; i < Grid.GetChildRowCount(index); i++)
            {
                DataRow row  = Grid.GetChildDataRow(index, i);
                object  test = row["ProductID"];
                Grid.Selection.SetSelectionByKey(row["ProductID"], isGroupRowSelected);
            }
        }
        else
        {
            // checked row is not the lowest level groupcolumn:
            // we will find the Datarows that are to be checked recursively by iterating all rows
            // and compare the fieldvalues of the fields described by the checked groupcolumn
            // and all its parent groupcolumns. Rows that match these criteria are to the checked.
            // CAVEAT: only expanded rows can be iterated, so we will have to expand clicked row recursivly before iterating the grid

            int gidx = -1;
            foreach (GridViewDataColumn gcol in groupedCols)
            {
                if (gcol.FieldName == fieldname)
                {
                    gidx = groupedCols.IndexOf(gcol);
                    break;
                }
            }

            DataRow CheckedDataRow = Grid.GetDataRow(index);
            //Build dictionary with checked groucolumn and its parent groupcolumn fieldname and values
            Dictionary <string, object> DictParentFieldnamesValues = new Dictionary <string, object>();
            string parentfieldname;
            object parentkeyvalue;
            for (int i = gidx; i >= 0; i--)
            {
                // find parent groupcols and parentkeyvalue
                GridViewDataColumn pcol = groupedCols[i];
                parentfieldname = pcol.FieldName;
                parentkeyvalue  = CheckedDataRow[parentfieldname];
                DictParentFieldnamesValues.Add(parentfieldname, parentkeyvalue);
            }


            bool isChildDatarowOfClickedGroup;
            Grid.ExpandRow(index, true);
            for (int i = 0; i <= Grid.VisibleRowCount - 1; i++)
            {
                DataRow row = Grid.GetDataRow(i);

                isChildDatarowOfClickedGroup = true;
                // check whether row does belong to checked group all the parent groups of the clicked group
                foreach (KeyValuePair <string, object> kvp in DictParentFieldnamesValues)
                {
                    parentfieldname = kvp.Key;
                    parentkeyvalue  = kvp.Value;
                    if (row[parentfieldname].Equals(parentkeyvalue) == false)
                    {
                        isChildDatarowOfClickedGroup = false;
                        break;
                        //Iterated row does not belong to at least one parentgroup of the clicked groupbox; do not change selection state for this row
                    }
                }

                if (isChildDatarowOfClickedGroup == true)
                {
                    //row meets all the criteria for belonging to the clicked group and all parents of the clicked group:
                    // change selection state
                    Grid.Selection.SetSelectionByKey(row["ProductID"], isGroupRowSelected);
                }
            }
        }
    }
    protected void setImages(GridView GridView1)
    {
        if (!GridView1.EnableSortingAndPagingCallbacks)
        {
            return;
        }

        System.Collections.ObjectModel.ReadOnlyCollection <MetaColumn>
             cols          = GridView1.GetMetaTable().Columns;
        bool conainsimages = (from cc in cols.ToList() where cc.Name.ToLower().Contains("image") select cc).FirstOrDefault() != null;

        if (!conainsimages)
        {
            return;
        }

        string baseurl = UtilsConfig.AzureStorage_BaseURL();
        int    row     = -1;

        foreach (GridViewRow gv in GridView1.Rows)
        {
            row++;

            if (!gv.Visible)
            {
                continue;
            }

            TableCellCollection tbc = gv.Cells;

            int cellPosition = -1;
            foreach (TableCell ob in tbc)
            {
                cellPosition++;
                if (GridView1.HeaderRow.Cells[cellPosition].Controls.Count == 0)
                {
                    continue;
                }
                object lb = (object)GridView1.HeaderRow.Cells[cellPosition].Controls[0];
                if (lb == null || lb.GetType().BaseType != typeof(LinkButton))
                {
                    continue;
                }


                if (((LinkButton)lb).Text.ToLower().Contains("image") && !((LinkButton)lb).Text.ToLower().Contains("type"))
                {
                    ControlCollection cl = ob.Controls;
                    // object l = (object)cl[0];
                    // DynamicControl dn = (DynamicControl)l;
                    DynamicControl dn = (DynamicControl)((object)cl[0]);
                    Literal        lt = (Literal)dn.Controls[0].Controls[0];

                    if (!string.IsNullOrEmpty(lt.Text))
                    {
                        dn.Controls[0].Controls.Add(new LiteralControl("</br>"));
                        dn.Controls[0].Controls.Add(new System.Web.UI.WebControls.Image()
                        {
                            Width    = 100,
                            Height   = 100,
                            ID       = "Image" + row.ToString() + cellPosition.ToString(),
                            ImageUrl = UtilsConfig.ImageKeepFullURL ? lt.Text :  lt.Text.Contains("http")? lt.Text: baseurl + lt.Text,
                            ToolTip  = UtilsConfig.ImageKeepFullURL  ? lt.Text : lt.Text.Contains("http") ? lt.Text : baseurl + lt.Text
                        });
                    }
                }
            }
        }
    }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Select current langauge
        string currentLang = new LangaugeSystem().CurrentLang;

        // Show if javascript is disable
        ErrorJS.InnerText = GetLocalResourceObject("JavascriptBoxErrorMessageError").ToString();

        // url for JS
        string pageId = Context.Request.AppRelativeCurrentExecutionFilePath.ToString();
        string jsurl  = ("~/js.axd?p=" + HttpUtility.UrlEncode(pageId)).ChangeToJsHost();

        scriptsall.Scripts.Add(new System.Web.UI.ScriptReference(jsurl));


        if (Page.IsPostBack)
        {
            return;
        }


        // get timezone
        ANO_User GetUserCookie = ANOProfile.GetCookieValues(CurrentUserIP);
        string   currentZone   = GetUserCookie.TimeZone;

        if (string.IsNullOrEmpty(currentZone))
        {
            DivTimeZone.Visible = true;
        }
        else
        {
            DivTimeZone.Visible = false;
        }



        // check cache
        System.Collections.ObjectModel.ReadOnlyCollection <TimeZoneInfo> getTimeZones = (System.Collections.ObjectModel.ReadOnlyCollection <TimeZoneInfo>)Cache["masterpage_timezones"];
        if (getTimeZones == null)
        {
            getTimeZones = TimeZoneInfo.GetSystemTimeZones();
            if (getTimeZones != null)
            {
                // add Cache
                Cache.Add("masterpage_timezones", getTimeZones, null, TimeZoneManager.DateTimeNow.AddDays(30),
                          System.Web.Caching.Cache.NoSlidingExpiration,
                          System.Web.Caching.CacheItemPriority.Normal,
                          null);
            }
        }

        DdlTimeZones.Items.Clear();
        foreach (var zone in getTimeZones)
        {
            DdlTimeZones.Items.Add(new ListItem(zone.DisplayName.ToString(), zone.BaseUtcOffset.ToString()));
        }
        if (!string.IsNullOrEmpty(currentZone))
        {
            DdlTimeZones.Items.FindByValue(currentZone).Selected = true;
        }


        // Insert Langauges in DropDownList
        DropDownList ddlLang = DdlSelectLang;

        ddlLang.Items.Clear();

        // check cache

        List <SW_Lang> langs = (List <SW_Lang>)Cache["masterpage_langs"];
        LangaugeSystem ls    = new LangaugeSystem();

        if (langs == null)
        {
            langs = ls.GetLangs();
            if (langs != null)
            {
                // add Cache
                Cache.Add("masterpage_langs", langs, null, TimeZoneManager.DateTimeNow.AddDays(10),
                          System.Web.Caching.Cache.NoSlidingExpiration,
                          System.Web.Caching.CacheItemPriority.Normal,
                          null);
            }
        }

        foreach (var lang in langs)
        {
            ddlLang.Items.Add(new ListItem(lang.LangName, lang.LangShortname));
        }


        // check cache
        int?currentLangId = (int?)Cache["masterpage_LangId" + currentLang];

        if (currentLangId.HasValue == false)
        {
            currentLangId = ls.GetLang(currentLang).LangId;
            if (currentLangId.HasValue == true)
            {
                // add Cache
                Cache.Add("masterpage_LangId" + currentLang, currentLangId, null, TimeZoneManager.DateTimeNow.AddDays(10),
                          System.Web.Caching.Cache.NoSlidingExpiration,
                          System.Web.Caching.CacheItemPriority.Normal,
                          null);
            }
        }

        if (!string.IsNullOrEmpty(currentLang))
        {
            DdlSelectLang.Items.FindByValue(currentLang).Selected = true;
        }



        // change url for logo (Now with shortlang)

        CustomSiteMapNode csm = new CustomSiteMapNode();
        cSiteMapNode      homeCSiteMapNode = csm.GetSiteMapNode(2, currentLangId.Value);
        string            getPath          = homeCSiteMapNode.SiteMapNodePath;

        if (!string.IsNullOrEmpty(homeCSiteMapNode.SiteMapNodeRewrittedPath))
        {
            getPath = homeCSiteMapNode.SiteMapNodeRewrittedPath;
        }
        HyperImgLogo.NavigateUrl = getPath;

        // Insert menu data
        // check cache
        List <cSiteMapNode> sitemapnodes = (List <cSiteMapNode>)Cache["masterpage_nodes" + currentLangId];

        if (sitemapnodes == null)
        {
            sitemapnodes = csm.GetSiteMapNodes((int)currentLangId, false);
            if (sitemapnodes != null)
            {
                // add Cache
                Cache.Add("masterpage_nodes" + currentLangId, sitemapnodes, null, TimeZoneManager.DateTimeNow.AddDays(1),
                          System.Web.Caching.Cache.NoSlidingExpiration,
                          System.Web.Caching.CacheItemPriority.Normal,
                          null);
            }
        }
        CMenu.DataSource    = sitemapnodes;
        CMenu.CurrentUserIP = CurrentUserIP;
        CMenu.DataBind();



        // Properties for metatags event
        SiteMapNodeMetatagsObject getMapMetaTags = null;
        cSiteMapNode getCurrentSiteMap           = null;
        int          currentSiteMapId;

        // Get CurrentSiteMapNode
        getCurrentSiteMap = csm.GetCurrentSiteMapNode((int)currentLangId);
        currentSiteMapId  = getCurrentSiteMap.SiteMapNodeId;

        // Get Metatags for current cSiteMapNode
        // check cache
        getMapMetaTags = (SiteMapNodeMetatagsObject)Cache["masterpage_NodeMetatags" + currentSiteMapId.ToString() + currentLangId.ToString()];
        SiteMapNodeMetaTags smm = new SiteMapNodeMetaTags();

        if (getMapMetaTags == null)
        {
            getMapMetaTags = smm.GetMetaTags(currentSiteMapId, (int)currentLangId);
            if (getMapMetaTags != null)
            {
                // add cache
                Cache.Add("masterpage_NodeMetatags" + currentSiteMapId.ToString() + currentLangId.ToString(),
                          getMapMetaTags,
                          null,
                          TimeZoneManager.DateTimeNow.AddDays(4),
                          System.Web.Caching.Cache.NoSlidingExpiration,
                          System.Web.Caching.CacheItemPriority.Normal,
                          null);
            }
        }


        // Insert MetaTags
        string pageTitle = Request.Url.Host;

        if (getMapMetaTags != null)
        {
            MetaAuthor.Content       = getMapMetaTags.MetaTagAuthor;
            MetaCache.Content        = getMapMetaTags.MetaTagCache;
            MetaCopyright.Content    = getMapMetaTags.MetaTagCopyright;
            MetaDescription.Content  = getMapMetaTags.MetaTagDescription;
            MetaKeywords.Content     = getMapMetaTags.MetaTagKeywords;
            MetaLanguage.Content     = getMapMetaTags.MetaTagLanguage;
            MetaPublisher.Content    = getMapMetaTags.MetaTagPublisher;
            MetaRobots.Content       = getMapMetaTags.MetaTagRobots;
            MetaRevisitAfter.Content = getMapMetaTags.MetaTagRevisitAfter;
            MetaCacheControl.Content = getMapMetaTags.MetaTagCacheControl;
            pageTitle += " - " + getMapMetaTags.MetaTagTitle;
        }


        Page.Title = pageTitle;
    }
    static int AsReadOnly(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        List <KeyValuePair <uint, bool> > obj = (List <KeyValuePair <uint, bool> >)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<KeyValuePair<uint,bool>>");

        System.Collections.ObjectModel.ReadOnlyCollection <KeyValuePair <uint, bool> > o = obj.AsReadOnly();
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }