Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        allimages = "[";
        List <PrizeController.Prize> prizelist = PrizeController.GetPrizes();
        List <string> imglist = new List <string>();

        foreach (PrizeController.Prize prize in prizelist)
        {
            if (prize.isnonprize)
            {
                allimages += "'" + prize.image1 + "',";
            }
            else
            {
                allimages += "'" + prize.image1 + "',";
                allimages += "'" + prize.image2 + "',";
            }
        }
        allimages = allimages.TrimEnd(',') + "]";

        //load settings
        PrizeController.Settings settings = PrizeController.GetSettings();
        playtime        = (Convert.ToInt32(settings.playtime) * 1000).ToString();
        gamespeed       = settings.gamespeed;
        buildtime       = settings.buildtime;
        idletimeouttime = (Convert.ToInt32(settings.idletimeouttime) * 1000).ToString();
        idletiptime     = (Convert.ToInt32(settings.idletiptime) * 1000).ToString();
    }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (isLoggedIn)
     {
         //get settings & populate
         PrizeController.Settings settings = PrizeController.GetSettings();
         tbPlayTime.Text    = settings.playtime;
         tbPlaySpeed.Text   = settings.gamespeed;
         tbBuildTime.Text   = settings.buildtime;
         tbTimeOutTime.Text = settings.idletimeouttime;
         tbTipTime.Text     = settings.idletiptime;
     }
 }
Ejemplo n.º 3
0
 //*****************************************************************//
 //***************Handle button clicks******************************//
 //*****************************************************************//
 /// <summary>
 /// Logs user into admin
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void LoginBtn_OnClick(Object sender, EventArgs e)
 {
     PrizeController.Settings settings = PrizeController.GetSettings();
     if (tbUser.Text == settings.username && tbPass.Text == settings.pass)
     {
         isLoggedIn              = true;
         btnLogout.Visible       = true;
         mvMulti.ActiveViewIndex = 1;
         tbPlayTime.Text         = settings.playtime;
         tbPlaySpeed.Text        = settings.gamespeed;
         tbBuildTime.Text        = settings.buildtime;
         tbTimeOutTime.Text      = settings.idletimeouttime;
         tbTipTime.Text          = settings.idletiptime;
         LoadPrizeDataTable();
     }
     else
     {
         lblError.Text = "Please enter the correct username & password";
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Handles when user clicks button to save edited settings
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnChangeSettings_OnClick(Object sender, EventArgs e)
 {
     try
     {
         PrizeController.Settings settings = PrizeController.GetSettings();
         settings.playtime        = tbPlayTime.Text;
         settings.gamespeed       = tbPlaySpeed.Text;
         settings.buildtime       = tbBuildTime.Text;
         settings.idletimeouttime = tbTimeOutTime.Text;
         settings.idletiptime     = tbTipTime.Text;
         string output = JsonConvert.SerializeObject(settings);
         File.WriteAllText(settingspath, output);
         LoadPrizeDataTable();
         lblChangesSuccess.Text = "Changes successful";
     }
     catch (Exception ex)
     {
         using (System.IO.StreamWriter file = new System.IO.StreamWriter(errorpath, true))
         {
             file.WriteLine(DateTime.Now.ToString() + " Error in Admin.aspx.cs Method btnChangeSettings_OnClick: " + ex.Message);
         }
         lblChangesSuccess.Text = "Changes not successful";
     }
 }