Exemple #1
0
        public async Task <bool> PutRumContentProvidersConfigurationAsync(ContentResources body, CancellationToken cancellationToken = default)
        {
            var response = await GetRumContentResourcesUrl()
                           .PutJsonAsync(body, cancellationToken)
                           .ConfigureAwait(false);

            return(response.IsSuccessStatusCode);
        }
Exemple #2
0
    public static void ApplyNewLanguageAndRefreshPage(Page p)
    {
        //Refresh the current page to make all control-texts take effect
        //Response.Redirect(Request.Url.AbsoluteUri);
        //return;
        string CurrentPage    = p.ToString().Replace("_", ".").Replace("ASP.", "");
        string CurrentCulture = "en-US";// p.Session[LanguageManager.ToString()].ToString();

        DataSet ds = new DataSet();

        ds = ContentResources.GetResourceByCulture(CurrentPage, CurrentCulture);


        if (ds.Tables.Count < 0)
        {
            return;
        }

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            object obj = FindControlRecursive(p, dr[0].ToString().Split('.')[0]);

            if (obj == null)
            {
                continue;
            }

            if (dr[0] != null)
            {
                if (obj.GetType().Name == "Label")
                {
                    Label ctl = obj as Label;
                    ctl.Text = dr[1].ToString();
                }
                else if (obj.GetType().Name == "LinkButton")
                {
                    LinkButton ctl = obj as LinkButton;
                    ctl.Text = dr[1].ToString();
                }
                else if (obj.GetType().Name == "HtmlTableCell")
                {
                    HtmlTableCell ctl = obj as HtmlTableCell;
                    ctl.InnerHtml = dr[1].ToString();
                }
                else if (obj.GetType().Name == "Literal")
                {
                    Literal ctl = obj as Literal;
                    ctl.Text = dr[1].ToString();
                }
            }
        }
    }
Exemple #3
0
        void AddContentResource(string v)
        {
            if (string.IsNullOrEmpty(v))
            {
                return;
            }

            string name, filename;
            bool   local = Path.GetFullPath(v).StartsWith(Path.GetFullPath("."));
            int    comma = v.IndexOf(',');

            if (comma == -1)
            {
                if (local)
                {
                    name     = v;
                    filename = v;
                }
                else
                {
                    name = filename = Path.GetFileName(v);
                    if (!InPlace)
                    {
                        File.Copy(v, Path.Combine(TmpDir, Path.GetFileName(v)));
                    }
                    else
                    {
                        File.Copy(v, Path.Combine(WorkingDir, Path.GetFileName(v)));
                    }
                }
            }
            else
            {
                name     = v.Substring(comma + 1);
                filename = v.Substring(0, comma);
                if (!InPlace)
                {
                    File.Copy(filename, Path.Combine(TmpDir, Path.GetFileName(filename)));
                    filename = Path.Combine(TmpDir, Path.GetFileName(filename));
                }
            }

            ContentResources.Add(name, filename);
        }
Exemple #4
0
        public Form1()
        {
            _gameController = new GameController(ConfigurationManager.AppSettings["InMemoryDatabase"]);
            ContentResources.LoadImages();

            _placedShips = new List <Ship>();

            InitializeComponent();

            _gridController = new GridController(Grid, OnTileClick, OnMissedShot);
            _gridController.GenerateGrid();

            StateSection.TabPages.Remove(tab_Player1Select);
            StateSection.TabPages.Remove(tab_Player2Name);
            StateSection.TabPages.Remove(tab_Player2Select);
            StateSection.TabPages.Remove(tab_playerAttacks);
            StateSection.TabPages.Remove(tab_Finish);

            pnl_nextTurn.Hide();
            //tabControl1.TabPages.Remove(tabPage2);

            StateSection.SelectedTab = tab_Player1Name;
        }
Exemple #5
0
    public static void ApplyNewLanguageAndRefreshPage(Page p, UserControl uc)
    {
        //Refresh the current page to make all control-texts take effect
        //Response.Redirect(Request.Url.AbsoluteUri);
        //return;
        //string CurrentPage = uc.ToString().Replace("ASP.usercontrols_", "").Replace("_", ".");
        Match  m           = Regex.Match(uc.ToString(), "[a-zA-Z0-9]*_ascx");
        string CurrentPage = "";

        if (m.Success)
        {
            CurrentPage = m.Captures[0].Value.Replace('_', '.');
        }

        string  CurrentCulture = p.Session[LanguageManager.ToString()].ToString();
        DataSet ds             = new DataSet();
        int     v = 0;

        ds = ContentResources.GetResourceByCulture(CurrentPage, CurrentCulture);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            object obj = FindControlRecursive(p, dr[0].ToString().Split('.')[0]);

            if (obj == null)
            {
                continue;
            }

            if (dr[0] != null)
            {
                if (obj.GetType().Name == "Label")
                {
                    Label ctl = obj as Label;
                    ctl.Text = dr[1].ToString();
                }
                else if (obj.GetType().Name == "LinkButton")
                {
                    LinkButton ctl = obj as LinkButton;
                    ctl.Text = dr[1].ToString();
                }
                else if (obj.GetType().Name == "TableCell")
                {
                    TableCell ctl = obj as TableCell;
                    ctl.Text = dr[1].ToString();
                }
                else if (obj.GetType().Name == "HtmlTableCell")
                {
                    HtmlTableCell ctl = obj as HtmlTableCell;
                    ctl.InnerHtml = dr[1].ToString();
                }
                else if (obj.GetType().Name == "Literal")
                {
                    Literal ctl = obj as Literal;
                    ctl.Text = dr[1].ToString();
                }
                else if (obj.GetType().Name == "CheckBox")
                {
                    CheckBox ctl = obj as CheckBox;
                    ctl.Text = dr[1].ToString();
                }
                else if (obj.GetType().Name == "Image")
                {
                    Image ctl = obj as Image;
                    ctl.ImageUrl = "~/images/" + dr[1].ToString();
                }
            }
        }
    }