Example #1
0
        private void abilitiesHub_Loaded(object sender, RoutedEventArgs e)
        {
            passiveHeaderTextBlock.Text = champion.Value.passive.name;
            BitmapImage passiveBitmapImage = new BitmapImage(new Uri(AppConstants.ChampionPassiveIconUrl() + champion.Value.passive.image.full));

            passiveHeaderImage.Source    = passiveBitmapImage;
            ability1HeaderTextBlock.Text = champion.Value.spells[0].name;
            BitmapImage ability1BitmapImage = new BitmapImage(new Uri(AppConstants.SpellIconUrl() + champion.Value.spells[0].image.full));

            ability1HeaderImage.Source   = ability1BitmapImage;
            ability2HeaderTextBlock.Text = champion.Value.spells[1].name;
            BitmapImage ability2BitmapImage = new BitmapImage(new Uri(AppConstants.SpellIconUrl() + champion.Value.spells[1].image.full));

            ability2HeaderImage.Source   = ability2BitmapImage;
            ability3HeaderTextBlock.Text = champion.Value.spells[2].name;
            BitmapImage ability3BitmapImage = new BitmapImage(new Uri(AppConstants.SpellIconUrl() + champion.Value.spells[2].image.full));

            ability3HeaderImage.Source   = ability3BitmapImage;
            ability4HeaderTextBlock.Text = champion.Value.spells[3].name;
            BitmapImage ability4BitmapImage = new BitmapImage(new Uri(AppConstants.SpellIconUrl() + champion.Value.spells[3].image.full));

            ability4HeaderImage.Source = ability4BitmapImage;

            passiveHubSection.Width  = 500;
            ability1HubSection.Width = 500;
            ability2HubSection.Width = 500;
            ability3HubSection.Width = 500;
            ability4HubSection.Width = 500;
        }
Example #2
0
        //protected void Page_PreInit(object sender, EventArgs e)
        //{
        //    SessionFixation();
        //    CoockieCheck();

        //    string UserId = Session["UserId"].ToString();
        //    if (UserId == "6")
        //    {
        //        PageAuthorization();
        //    }
        //    else
        //    {
        //        Response.Redirect("~/HomePage1.aspx");
        //    }
        //}
        //public void PageAuthorization()
        //{
        //    int pageID = 5;
        //    //MySqlParameter[] spm = { new MySqlParameter("@User_Id", Session["UserId"]),
        //    //                   new MySqlParameter("@page_ID",pageID)};
        //    //DataTable dt = nSQL.getDataTable("proc_page_authorization", spm, "tab");
        //    DataTable dt = oCommonDAL.pageAuth(pageID, Session["UserId"]);
        //    int PageRights;
        //    if (dt.Rows.Count > 0)
        //    {
        //        PageRights = Convert.ToInt32(dt.Rows[0]["v_CNT"].ToString());
        //        if (PageRights >= 0)
        //        {
        //            if (PageRights == 0)
        //            {
        //                Response.Redirect("~/HomePage.aspx");
        //            }
        //        }
        //    }


        //}
        //public void SessionFixation()
        //{
        //    string _sessionIPAdress = string.Empty;
        //    string _sessionBrowserInfo = string.Empty;

        //    if (HttpContext.Current.Session != null)
        //    {
        //        string _encryptedString = Convert.ToString(Session["encryptedSession"]);
        //        byte[] _encodedAsBytes = System.Convert.FromBase64String(_encryptedString);
        //        string _decryptedString = System.Text.ASCIIEncoding.ASCII.GetString(_encodedAsBytes);
        //        char[] _separator = new char[] { '^' };
        //        if (_decryptedString != string.Empty && _decryptedString != "" && _decryptedString != null)
        //        {
        //            string[] _splitStrings = _decryptedString.Split(_separator);
        //            if (_splitStrings.Count() > 0)
        //            {
        //                if (_splitStrings[1].Count() > 0)
        //                {
        //                    string[] _userBrowserInfo = _splitStrings[2].Split('~');
        //                    if (_userBrowserInfo.Count() > 0)
        //                    {
        //                        _sessionBrowserInfo = _userBrowserInfo[0];
        //                        _sessionIPAdress = _userBrowserInfo[1];
        //                    }
        //                }
        //            }
        //        }
        //        string _currentuseripAddress;
        //        if (string.IsNullOrEmpty(Request.ServerVariables["HTTP_X_FORWARD_FOR"]))
        //        {
        //            _currentuseripAddress = Request.ServerVariables["REMOTE_ADDR"];
        //        }
        //        else
        //        {
        //            _currentuseripAddress = Request.ServerVariables["HTTP_X_FORWARD_FOR"].Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
        //        }
        //        System.Net.IPAddress result;
        //        if (!System.Net.IPAddress.TryParse(_currentuseripAddress, out result))
        //        {
        //            result = System.Net.IPAddress.None;
        //        }

        //        string _currentBrowserInfo = Request.Browser.Browser + Request.Browser.Version + Request.UserAgent;

        //        if (_sessionIPAdress != "" && _sessionIPAdress != string.Empty)
        //        {
        //            if (_sessionIPAdress != _currentuseripAddress || _sessionBrowserInfo != _currentBrowserInfo)
        //            {
        //                Session.RemoveAll();
        //                Session.Clear();
        //                Session.Abandon();
        //                Response.Cookies["ASP.Net_Session_Id"].Expires = DateTime.Now.AddSeconds(-30);
        //                Response.Cookies.Add(new HttpCookie("ASP.Net_Session_Id", ""));
        //            }
        //            else
        //            {
        //                //Valid
        //            }

        //        }
        //        //}
        //    }
        //    else
        //    {
        //        Response.Redirect("~/HomePage.aspx");
        //    }

        //}
        //public void CoockieCheck()
        //{
        //    try
        //    {
        //        Uri MyUrl = Request.UrlReferrer;
        //        string Port = Server.HtmlEncode(MyUrl.Port.ToString());
        //        string Scheme = Server.HtmlEncode(MyUrl.Scheme);
        //        string PreviousPath = Server.HtmlEncode(MyUrl.OriginalString);
        //        string path = HttpContext.Current.Request.Url.AbsolutePath;
        //        string AbsolutePathss = Server.HtmlEncode(MyUrl.AbsolutePath);
        //        string[] Section = PreviousPath.Split('/');
        //        string PagePath = "/MyDashboard/Masters/DivisionMaster.aspx";//C:\inetpub\wwwroot\Vispublished\Master\ComplainTypeMaster.aspx.cs

        //        if (path == PagePath && Port == "80" && Scheme == "http" && PreviousPath != string.Empty && Section[2] == "49.50.117.223" && Section[3] == "MyDashboard")
        //        //if (path == PagePath && Port == "80" && Scheme == "http" && PreviousPath != string.Empty && Section[2] == "49.50.101.77" && Section[3] == "FTSNEW")//&& Section[4] == "49.50.101.77" && Section[4] == "FTSNEW"
        //        {


        //        }
        //        else
        //        {
        //            Response.Redirect("~/HomePage.aspx");
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Response.Redirect("~/HomePage.aspx");
        //    }
        //}
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (ddlKpiRange.SelectedIndex > -1)
            {
                kpiRecno = Convert.ToInt32(ddlKpiRange.SelectedValue);
            }
            if (!Page.IsPostBack)
            {
                try
                {
                    obll.BindFirstKPI(ddlKpiRange);
                    // obll.BindAllDivision(ddlDivision);
                }
                catch (Exception ex)
                {
                    AppConstants OAp           = new AppConstants();
                    String       FUNCTION_NAME = "Page_Load";
                    String       MODULE_NAME   = "Default.aspx";
                    String       ERROR_TYPE    = "Application";
                    String       ERROR_DESC    = ex.Message;
                    string       lineNumber    = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7);
                    string       url           = HttpContext.Current.Request.Url.AbsoluteUri;
                    OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber);
                }
            }
        }
Example #3
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     try
     {
         btnSave.Text = "Save";
         //ddlDivision.SelectedIndex = 0;
         //ddlRegion.SelectedIndex = 0;
         rbtActive.Checked             = true;
         ddlOfficeStatus.SelectedIndex = 0;
         txtKPIName.Text         = string.Empty;
         divForStatus.Visible    = false;
         divGirdShow.Visible     = false;
         divEnterDetails.Visible = true;
     }
     catch (Exception ex)
     {
         AppConstants OAp           = new AppConstants();
         String       FUNCTION_NAME = "btnAddNew_Click";
         String       MODULE_NAME   = "InitiativeManagement.aspx";
         String       ERROR_TYPE    = "Application";
         String       ERROR_DESC    = ex.Message;
         string       lineNumber    = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7);
         string       url           = HttpContext.Current.Request.Url.AbsoluteUri;
         OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber);
     }
 }
        private void passiveImage_Loaded(object sender, RoutedEventArgs e)
        {
            Image       image       = sender as Image;
            BitmapImage bitmapImage = new BitmapImage(new Uri(AppConstants.ChampionPassiveIconUrl() + champion.Value.passive.image.full));

            image.Source = bitmapImage;
        }
        private void ability4Image_Loaded(object sender, RoutedEventArgs e)
        {
            Image       image       = sender as Image;
            BitmapImage bitmapImage = new BitmapImage(new Uri(AppConstants.SpellIconUrl() + champion.Value.spells[3].image.full));

            image.Source = bitmapImage;
        }
Example #6
0
 private void regionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (!justLoaded)
     {
         RefreshStatus((CreepScore.Region)AppConstants.GetCreepScoreRegion(regionComboBox.SelectedIndex));
     }
 }
Example #7
0
        async Task <bool> PlayStream()
        {
            streamOfflineBlock.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

            if (qualities == null)
            {
                // stream offline
                streamOfflineBlock.Visibility             = Windows.UI.Xaml.Visibility.Visible;
                liveViewersBlock.Text                     = "Offline";
                playPauseButton.Label                     = "Play";
                ((SymbolIcon)playPauseButton.Icon).Symbol = Symbol.Play;
                totalViewersBlock.Text                    = channel.views.ToString();
                followersBlock.Text = channel.followers.ToString();
                return(false);
            }

            AppConstants.PlayPreferredQuality(qualities, AppConstants.Quality.Source, streamerObject);
            stream = await AppConstants.twixel.RetrieveStream(channel.name);

            videoPlaying           = true;
            liveViewersBlock.Text  = stream.viewers.ToString();
            totalViewersBlock.Text = channel.views.ToString();
            followersBlock.Text    = channel.followers.ToString();
            streamerObject.SetTrackTitle(stream.channel.displayName, channel.status);
            streamerObject.SetThumbnail(stream.channel.logo.urlString);
            return(true);
        }
Example #8
0
        //protected void Page_PreInit(object sender, EventArgs e)
        //{
        //    SessionFixation();
        //    CoockieCheck();

        //    string UserId = Session["UserId"].ToString();
        //    if (UserId == "6")
        //    {
        //        PageAuthorization();
        //    }
        //    else
        //    {
        //        Response.Redirect("~/HomePage1.aspx");
        //    }
        //}
        //public void PageAuthorization()
        //{
        //    int pageID = 5;
        //    //MySqlParameter[] spm = { new MySqlParameter("@User_Id", Session["UserId"]),
        //    //                   new MySqlParameter("@page_ID",pageID)};
        //    //DataTable dt = nSQL.getDataTable("proc_page_authorization", spm, "tab");
        //    DataTable dt = oCommonDAL.pageAuth(pageID, Session["UserId"]);
        //    int PageRights;
        //    if (dt.Rows.Count > 0)
        //    {
        //        PageRights = Convert.ToInt32(dt.Rows[0]["v_CNT"].ToString());
        //        if (PageRights >= 0)
        //        {
        //            if (PageRights == 0)
        //            {
        //                Response.Redirect("~/HomePage.aspx");
        //            }
        //        }
        //    }


        //}
        //public void SessionFixation()
        //{
        //    string _sessionIPAdress = string.Empty;
        //    string _sessionBrowserInfo = string.Empty;

        //    if (HttpContext.Current.Session != null)
        //    {
        //        string _encryptedString = Convert.ToString(Session["encryptedSession"]);
        //        byte[] _encodedAsBytes = System.Convert.FromBase64String(_encryptedString);
        //        string _decryptedString = System.Text.ASCIIEncoding.ASCII.GetString(_encodedAsBytes);
        //        char[] _separator = new char[] { '^' };
        //        if (_decryptedString != string.Empty && _decryptedString != "" && _decryptedString != null)
        //        {
        //            string[] _splitStrings = _decryptedString.Split(_separator);
        //            if (_splitStrings.Count() > 0)
        //            {
        //                if (_splitStrings[1].Count() > 0)
        //                {
        //                    string[] _userBrowserInfo = _splitStrings[2].Split('~');
        //                    if (_userBrowserInfo.Count() > 0)
        //                    {
        //                        _sessionBrowserInfo = _userBrowserInfo[0];
        //                        _sessionIPAdress = _userBrowserInfo[1];
        //                    }
        //                }
        //            }
        //        }
        //        string _currentuseripAddress;
        //        if (string.IsNullOrEmpty(Request.ServerVariables["HTTP_X_FORWARD_FOR"]))
        //        {
        //            _currentuseripAddress = Request.ServerVariables["REMOTE_ADDR"];
        //        }
        //        else
        //        {
        //            _currentuseripAddress = Request.ServerVariables["HTTP_X_FORWARD_FOR"].Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
        //        }
        //        System.Net.IPAddress result;
        //        if (!System.Net.IPAddress.TryParse(_currentuseripAddress, out result))
        //        {
        //            result = System.Net.IPAddress.None;
        //        }

        //        string _currentBrowserInfo = Request.Browser.Browser + Request.Browser.Version + Request.UserAgent;

        //        if (_sessionIPAdress != "" && _sessionIPAdress != string.Empty)
        //        {
        //            if (_sessionIPAdress != _currentuseripAddress || _sessionBrowserInfo != _currentBrowserInfo)
        //            {
        //                Session.RemoveAll();
        //                Session.Clear();
        //                Session.Abandon();
        //                Response.Cookies["ASP.Net_Session_Id"].Expires = DateTime.Now.AddSeconds(-30);
        //                Response.Cookies.Add(new HttpCookie("ASP.Net_Session_Id", ""));
        //            }
        //            else
        //            {
        //                //Valid
        //            }

        //        }
        //        //}
        //    }
        //    else
        //    {
        //        Response.Redirect("~/HomePage.aspx");
        //    }

        //}
        //public void CoockieCheck()
        //{
        //    try
        //    {
        //        Uri MyUrl = Request.UrlReferrer;
        //        string Port = Server.HtmlEncode(MyUrl.Port.ToString());
        //        string Scheme = Server.HtmlEncode(MyUrl.Scheme);
        //        string PreviousPath = Server.HtmlEncode(MyUrl.OriginalString);
        //        string path = HttpContext.Current.Request.Url.AbsolutePath;
        //        string AbsolutePathss = Server.HtmlEncode(MyUrl.AbsolutePath);
        //        string[] Section = PreviousPath.Split('/');
        //        string PagePath = "/MyDashboard/Masters/DivisionMaster.aspx";//C:\inetpub\wwwroot\Vispublished\Master\ComplainTypeMaster.aspx.cs

        //        if (path == PagePath && Port == "80" && Scheme == "http" && PreviousPath != string.Empty && Section[2] == "49.50.117.223" && Section[3] == "MyDashboard")
        //        //if (path == PagePath && Port == "80" && Scheme == "http" && PreviousPath != string.Empty && Section[2] == "49.50.101.77" && Section[3] == "FTSNEW")//&& Section[4] == "49.50.101.77" && Section[4] == "FTSNEW"
        //        {


        //        }
        //        else
        //        {
        //            Response.Redirect("~/HomePage.aspx");
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Response.Redirect("~/HomePage.aspx");
        //    }
        //}
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    if (ddlOfficeStatus.SelectedValue == "0")
                    {
                        BindRegion();
                        BindDivision();
                        DivForDivision.Visible = true;
                        DivForRegion.Visible   = false;
                    }
                    else if (ddlOfficeStatus.SelectedValue == "1")
                    {
                        BindDivision();
                        BindRegion();
                        DivForDivision.Visible = false;
                        DivForRegion.Visible   = true;
                    }
                    PageLoadBindGrid();
                }
            }
            catch (Exception ex)
            {
                AppConstants OAp           = new AppConstants();
                String       FUNCTION_NAME = "Page_Load";
                String       MODULE_NAME   = "ActionActualEntry.aspx";
                String       ERROR_TYPE    = "Application";
                String       ERROR_DESC    = ex.Message;
                string       lineNumber    = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7);
                string       url           = HttpContext.Current.Request.Url.AbsoluteUri;
                OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber);
            }
        }
Example #9
0
        /// <summary>
        /// Show User Form and set the initial values
        /// </summary>
        public void ShowProductForm(Product product = null)
        {
            Spinner.InitSpinner();

            // Set the productId. Means that is a edit
            _productId = (product != null) ? product.ProductId : 0;

            // Set the Form title
            Text = (_productId != 0)
              ? AppConstants.GetViewTitle(Phrases.ProductEdit)
              : AppConstants.GetViewTitle(Phrases.ProductCreateNewProduct);

            // hide the error labels
            lbErrorReference.Visible = false;
            lbErrorName.Visible      = false;

            // Edit
            if (product != null)
            {
                tbReference.Text = product.Reference;
                tbName.Text      = product.Name;
            }

            Spinner.StopSpinner();
            ShowDialog();
        }
Example #10
0
 public RegionComboBoxSettings(ComboBox comboBox, bool canChangeSettings)
 {
     this.comboBox              = comboBox;
     this.canChangeSettings     = canChangeSettings;
     comboBox.SelectedIndex     = AppConstants.SetCreepScoreRegion((int)AppConstants.preferredRegion);
     comboBox.SelectionChanged += comboBox_SelectionChanged;
 }
Example #11
0
 void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (canChangeSettings)
     {
         AppConstants.preferredRegion = (CreepScore.Region)AppConstants.GetCreepScoreRegion(comboBox.SelectedIndex);
     }
 }
Example #12
0
 void RefreshChampionsCollection()
 {
     championsCollection.Clear();
     if (selectedRole == "All")
     {
         foreach (KeyValuePair <string, ChampionStatic> champion in sortedChampions)
         {
             if (screenHeight >= 1440)
             {
                 championsCollection.Add(new ChampionsGridViewBinding(new Uri(AppConstants.championLoadingUrl + champion.Key + "_0.jpg"), 308, 560, champion.Key, champion.Value));
             }
             else
             {
                 championsCollection.Add(new ChampionsGridViewBinding(new Uri(AppConstants.ChampionIconUrl() + champion.Key + ".png"), 120, 120, champion.Key, champion.Value));
             }
         }
     }
     else
     {
         foreach (KeyValuePair <string, ChampionStatic> champion in sortedChampions)
         {
             if (champion.Value.tags[0] == selectedRole)
             {
                 if (screenHeight >= 1440)
                 {
                     championsCollection.Add(new ChampionsGridViewBinding(new Uri(AppConstants.championLoadingUrl + champion.Key + "_0.jpg"), 308, 560, champion.Key, champion.Value));
                 }
                 else
                 {
                     championsCollection.Add(new ChampionsGridViewBinding(new Uri(AppConstants.ChampionIconUrl() + champion.Key + ".png"), 120, 120, champion.Key, champion.Value));
                 }
             }
         }
     }
 }
Example #13
0
        private async void streamPlayer_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            if (fullScreen)
            {
                topBar.Visibility    = Windows.UI.Xaml.Visibility.Visible;
                bottomBar.Visibility = Windows.UI.Xaml.Visibility.Visible;
                fullScreen           = false;
            }
            else
            {
                topBar.Visibility    = Windows.UI.Xaml.Visibility.Collapsed;
                bottomBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                fullScreen           = true;
            }

            qualities = await AppConstants.GetQualities(stream.channel.name);

            if (CheckOffline())
            {
                streamOffline = true;
            }

            if (!streamOffline)
            {
                stream = await AppConstants.twixel.RetrieveStream(stream.channel.name);

                if (stream != null)
                {
                    streamDescription.Text = stream.channel.status;
                    streamerName.Text      = stream.channel.displayName;
                    streamGame.Text        = stream.game;
                    streamViewers.Text     = stream.viewers.ToString();
                }
            }
        }
Example #14
0
        private void LoadIds()
        {
            var constants = new AppConstants();

            using (var br = new Browser(constants))
            {
                foreach (DataGridViewRow dataGridViewRow in dataGridView1.Rows)
                {
                    if (dataGridViewRow.Cells[1].Value.IsNullOrEmpty())
                    {
                        var name = dataGridViewRow.Cells[0].Value.ToString();
                        if (IsInCache(name))
                        {
                            dataGridViewRow.Cells[2].Value = GetFromCache(name);
                        }
                        else
                        {
                            br.FindFilm(name);
                            var film = br.GetOpenedFilm(false);
                            dataGridViewRow.Cells[2].Value = film.KinopoiskId;
                        }
                    }
                    else
                    {
                        dataGridViewRow.Cells[2].Value = dataGridViewRow.Cells[1].Value;
                    }
                }
            }
        }
Example #15
0
        async Task GetVideos(TwitchConstants.Period period)
        {
            videos.Clear();
            videosCollection.Clear();
            endOfList = false;
            currentlyPullingVideos = true;
            await AppConstants.SetText("fetching videos");

            StatusBar statusBar = AppConstants.GetStatusBar();

            statusBar.ProgressIndicator.ProgressValue = null;
            await statusBar.ProgressIndicator.ShowAsync();

            weekRadioButton.IsEnabled  = false;
            monthRadioButton.IsEnabled = false;
            allRadioButton.IsEnabled   = false;
            videos = await AppConstants.twixel.RetrieveTopVideos(100, "", period);

            foreach (Video video in videos)
            {
                videosCollection.Add(new VideosGridViewBinding(video));
            }
            currentlyPullingVideos = false;
            await AppConstants.SetText("Videos");

            weekRadioButton.IsEnabled  = true;
            monthRadioButton.IsEnabled = true;
            allRadioButton.IsEnabled   = true;
        }
Example #16
0
 public void FillCapctha()
 {
     try
     {
         Random        random      = new Random();
         string        combination = "0123456789";
         StringBuilder captcha     = new StringBuilder();
         for (int i = 0; i < 6; i++)
         {
             captcha.Append(combination[random.Next(combination.Length)]);
         }
         Session["captcha"]  = captcha.ToString();
         imgCaptcha.ImageUrl = "~/GenerateCaptcha.aspx?" + DateTime.Now.Ticks.ToString();
     }
     catch (Exception ex)
     {
         AppConstants OAp           = new AppConstants();
         String       FUNCTION_NAME = "FillCapctha()";
         String       MODULE_NAME   = "HomePage.aspx";
         String       ERROR_TYPE    = "Application";
         String       ERROR_DESC    = ex.Message;
         string       lineNumber    = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7);
         string       url           = HttpContext.Current.Request.Url.AbsoluteUri;
         OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber);
     }
 }
Example #17
0
        async void LoadMoreVideos()
        {
            if (!endOfList)
            {
                currentlyPullingVideos = true;
                await AppConstants.SetText("fetching videos");

                StatusBar statusBar = AppConstants.GetStatusBar();
                statusBar.ProgressIndicator.ProgressValue = null;
                await statusBar.ProgressIndicator.ShowAsync();

                weekRadioButton.IsEnabled  = false;
                monthRadioButton.IsEnabled = false;
                allRadioButton.IsEnabled   = false;
                videos = await AppConstants.twixel.RetrieveTopVideos(true);

                if (videos.Count == 0)
                {
                    endOfList = true;
                }
                foreach (Video video in videos)
                {
                    videosCollection.Add(new VideosGridViewBinding(video));
                }
                currentlyPullingVideos = false;
                await AppConstants.SetText("Videos");

                weekRadioButton.IsEnabled  = true;
                monthRadioButton.IsEnabled = true;
                allRadioButton.IsEnabled   = true;
            }
        }
        /// <summary>
        /// Overwrites a file with newly retrieved data. Doesn't contain data by ID field
        /// </summary>
        /// <typeparam name="T1">The object type to return</typeparam>
        /// <typeparam name="T2">The data section enum</typeparam>
        /// <param name="region">The region to load information from</param>
        /// <param name="data">The object we should store the loaded data in</param>
        /// <param name="staticDataType">The data section we should load</param>
        /// <param name="localFolder">The folder the file resides in</param>
        /// <param name="fileName">The filename</param>
        /// <param name="loadFunction"></param>
        /// <param name="retrieveFunction"></param>
        /// <param name="locale">The locale we should use</param>
        /// <param name="version">The patch number we should load data from</param>
        /// <returns>Returns the object (T1) with loaded data</returns>
        async Task <T1> ReadAndOverwriteData <T1, T2>(CreepScore.Region region,
                                                      T1 data,
                                                      T2 staticDataType,
                                                      StorageFolder localFolder,
                                                      string fileName,
                                                      Func <CreepScore.Region, T2, string, string, Task <T1> > retrieveFunction, string locale = "", string version = "")
        {
            StorageFile file;

#if WINDOWS_APP
            file = await localFolder.TryGetItemAsync(fileName) as StorageFile;
#endif
#if WINDOWS_PHONE_APP
            file = await AppConstants.TryGetItemAsync(localFolder, fileName);
#endif

            // look for the specified file
            if (file != null)
            {
                data = await OverwriteData <T1, T2>(region, data, staticDataType, localFolder, file, fileName, retrieveFunction);

                return(data);
            }
            else
            {
                data = await CreateData <T1, T2>(region, data, staticDataType, localFolder, file, fileName, retrieveFunction);

                return(data);
            }
        }
Example #19
0
        public async void PlayPauseAction()
        {
            if (videoPlaying)
            {
                streamerObject.Stop();
                videoPlaying = false;
                ((SymbolIcon)pausePlayButton.Icon).Symbol = Symbol.Play;
            }
            else
            {
                qualities = await AppConstants.GetQualities(featuredStreams[selectedStreamIndex].stream.channel.name);

                if (qualities == null)
                {
                    streamOfflineTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    streamIsOffline           = true;
                    pausePlayButton.IsEnabled = false;
                }
                else
                {
                    AppConstants.PlayPreferredQuality(qualities, AppConstants.preferredQuality, streamerObject);
                    videoPlaying = true;
                    ((SymbolIcon)pausePlayButton.Icon).Symbol = Symbol.Pause;
                }
            }
        }
        /// <summary>
        /// Reads data from a file and returns it. If the file doesn't exist it creates the file and retrieves the data. Doesn't contain data by ID field
        /// </summary>
        /// <typeparam name="T1">The object type to return</typeparam>
        /// <typeparam name="T2">The data section enum</typeparam>
        /// <param name="region">The region to load information from</param>
        /// <param name="data">The object we should store the loaded data in</param>
        /// <param name="staticDataType">The data section we should load</param>
        /// <param name="localFolder">The folder the file resides in</param>
        /// <param name="fileName">The filename</param>
        /// <param name="loadFunction"></param>
        /// <param name="retrieveFunction"></param>
        /// <param name="locale">The locale we should use</param>
        /// <param name="version">The patch number we should load data from</param>
        /// <returns>Returns the object (T1) with loaded data</returns>
        async Task <T1> ReadAndLoadData <T1, T2>(CreepScore.Region region,
                                                 T1 data,
                                                 T2 staticDataType,
                                                 StorageFolder localFolder,
                                                 string fileName,
                                                 Func <JObject, T1> loadFunction,
                                                 Func <CreepScore.Region, T2, string, string, Task <T1> > retrieveFunction, string locale = "", string version = "")
        {
            StorageFile file;

#if WINDOWS_APP
            file = await localFolder.TryGetItemAsync(fileName) as StorageFile;
#endif
#if WINDOWS_PHONE_APP
            file = await AppConstants.TryGetItemAsync(localFolder, fileName);
#endif

            // look for the specified file
            if (file != null)
            {
                // if the file is there read it and load the data from it
                string fileString = await FileIO.ReadTextAsync(file);

                JObject fileObject = JObject.Parse(fileString);
                data = loadFunction(fileObject);
                return(data);
            }
            else
            {
                data = await CreateData <T1, T2>(region, data, staticDataType, localFolder, file, fileName, retrieveFunction);

                return(data);
            }
        }
Example #21
0
        private async void forwardStreamButton_Click(object sender, RoutedEventArgs e)
        {
            selectedStreamIndex++;
            backStreamButton.IsEnabled        = true;
            streamOfflineTextBlock.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            streamIsOffline           = false;
            pausePlayButton.IsEnabled = true;
            if (selectedStreamIndex == featuredStreams.Count - 1)
            {
                forwardStreamButton.IsEnabled = false;
            }
            streamerObject.Stop();
            featuredGameTextBlock.Text        = featuredStreams[selectedStreamIndex].stream.channel.displayName + " playing " + featuredStreams[selectedStreamIndex].stream.game;
            featuredDescriptionTextBlock.Text = FixDescription(featuredStreams[selectedStreamIndex].text);
            qualities = await AppConstants.GetQualities(featuredStreams[selectedStreamIndex].stream.channel.name);

            if (qualities == null)
            {
                streamOfflineTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible;
                streamIsOffline           = true;
                pausePlayButton.IsEnabled = false;
            }

            if (videoPlaying)
            {
                streamerObject.SetTrackTitle(featuredStreams[selectedStreamIndex].stream.channel.displayName, featuredDescriptionTextBlock.Text);
                streamerObject.SetThumbnail(featuredStreams[selectedStreamIndex].stream.channel.logo.urlString);
                AppConstants.PlayPreferredQuality(qualities, AppConstants.preferredQuality, streamerObject);
            }
        }
        async Task SaveRegionSetting()
        {
            AppConstants.preferredRegion = (CreepScore.Region)AppConstants.GetCreepScoreRegion(regionComboBox.SelectedIndex);
            StorageFile regionFile = await AppConstants.TryCreateFile("Region.json", localFolder);

            await AppConstants.OverwriteFile(regionFile, UrlConstants.GetRegion(AppConstants.preferredRegion));
        }
 private void regionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (!justLaunched)
     {
         AppConstants.preferredRegion = (CreepScore.Region)AppConstants.GetCreepScoreRegion(regionComboBox.SelectedIndex);
     }
 }
Example #24
0
        //added code - tanshi
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {
                Response.Redirect("~/Masters/UserMaster.aspx", false);
            }
            catch (Exception ex)
            {
                AppConstants OAp           = new AppConstants();
                String       FUNCTION_NAME = "btnCancel_Click";
                String       MODULE_NAME   = "Masters_frm_UserMaster";
                String       ERROR_TYPE    = "Application";
                String       ERROR_DESC    = ex.Message;
                string       lineNumber    = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7);
                string       url           = HttpContext.Current.Request.Url.AbsoluteUri;
                OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber);
                FUNCTION_NAME = "";
                MODULE_NAME   = "";
                ERROR_TYPE    = "";
                ERROR_DESC    = "";



                Response.Redirect("~/Invalid.aspx", false);
            }
        }
Example #25
0
 void Current_Resuming(object sender, object e)
 {
     if (videoPlaying)
     {
         AppConstants.PlayPreferredQuality(qualities, AppConstants.Quality.Source, streamerObject);
     }
 }
Example #26
0
        /// <summary>
        /// Show User Form and set the initial values
        /// </summary>
        public async Task ShowUserFormAsync(User user = null)
        {
            Spinner.InitSpinner();

            // Set the userId. Means that is a edit
            _userId = (user != null) ? user.UserId : 0;

            // Set the Form title
            Text = (_userId != 0)
              ? AppConstants.GetViewTitle(Phrases.UserEditUser)
              : AppConstants.GetViewTitle(Phrases.UserCreateNewUser);

            // hide the error labels
            lbErrorUsername.Visible = false;
            lbErrorPassword.Visible = false;

            // Populate the combo box
            IEnumerable <Role> roles = await AppServices.RoleService.GetAllAsync();

            cbRoles.DataSource    = roles;
            cbRoles.ValueMember   = "RoleId";
            cbRoles.DisplayMember = "Code";

            // Edit
            if (user != null)
            {
                tbUsername.Text      = user.Username;
                cbRoles.SelectedItem = roles.First(x => x.RoleId == user.RoleId);
                cbRoles.Enabled      = (user.UserId == Program.LoggedInUser.UserId) ? false : true;
            }

            Spinner.StopSpinner();
            ShowDialog();
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            List<object> parameters = (List<object>)e.Parameter;
            searchQuery = (string)parameters[0];
            await AppConstants.SetText("Searching for " + searchQuery);

            if (AppConstants.ActiveUser != null)
            {
                if (AppConstants.ActiveUser.authorized)
                {
                    userButton.Content = AppConstants.ActiveUser.displayName;
                }
                else
                {
                    userButton.Content = "Log In";
                }
            }
            else
            {
                userButton.Content = "Log In";
            }

            gamesCollection = new ObservableCollection<GameGridViewBinding>();
            List<SearchedGame> searchedGames = new List<SearchedGame>();
            StatusBar statusBar = AppConstants.GetStatusBar();
            statusBar.ProgressIndicator.ProgressValue = null;
            await statusBar.ProgressIndicator.ShowAsync();
            searchedGames = await AppConstants.twixel.SearchGames(searchQuery, true);
            foreach (SearchedGame searchedGame in searchedGames)
            {
                gamesCollection.Add(new GameGridViewBinding(searchedGame.ToGame()));
            }
            await AppConstants.SetText("Searched: " + searchQuery);
        }
Example #28
0
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            try
            {
                int     divisionid   = Convert.ToInt32(ddlDivision.SelectedValue);
                int     initiativeid = Convert.ToInt32(ddlInitiative.SelectedValue);
                int     kpirecno     = Convert.ToInt32(ddlKpiRange.SelectedValue);
                string  progressdate = txtRecordDate.Text;
                DataSet ds           = obll.BindHistoryActualDetailsGrid(divisionid, initiativeid, kpirecno, progressdate);

                divGirdShow.Visible = true;
                grdvUser.DataSource = ds;
                grdvUser.DataBind();
            }
            catch (Exception ex)
            {
                AppConstants OAp           = new AppConstants();
                String       FUNCTION_NAME = "btnGenerate_Click";
                String       MODULE_NAME   = "ActualHistoryDetails.aspx";
                String       ERROR_TYPE    = "Application";
                String       ERROR_DESC    = ex.Message;
                string       lineNumber    = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7);
                string       url           = HttpContext.Current.Request.Url.AbsoluteUri;
                OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber);
            }
        }
Example #29
0
        public void SetChampionImage()
        {
            string         championName = AppConstants.championsData.keys[game.championId.ToString()];
            ChampionStatic champion     = AppConstants.championsData.data[championName];

            ChampionImage = AppConstants.SetImageSource(new Uri(AppConstants.ChampionIconUrl() + champion.image.full));
        }
Example #30
0
 void Current_Resuming(object sender, object e)
 {
     AppConstants.DeterminePreferredQuality();
     if (videoPlaying)
     {
         AppConstants.PlayPreferredQuality(qualities, AppConstants.preferredQuality, streamerObject);
     }
 }
        public ActionResult Invite(int? id, AppConstants.InviteTypes type)
        {
            Data.Entity.MemberInvitations model = new Data.Entity.MemberInvitations() { Senderid = new Data.Entity.MemberDetails() { Id = LoggedInUserKey }, Createdate = DateTime.Now, Version = DateTime.Now, Type = (int)type };

            model.MyInvites = Data.Helper.NHibernateHelper.ConvertToListOf<Data.Entity.MemberInvitations>(Data.Helper.NHibernateHelper.Find("select distinct a from MemberInvitations a where a.Senderid = ? or a.Email = ?", new object[] { LoggedInUserKey, LoggedInUserEmail }, new NHibernate.Type.IType[] { NHibernate.NHibernateUtil.Int32, NHibernate.NHibernateUtil.String }, false));

            return (View(model));
        }
        public ActionResult Invite(int? id, AppConstants.InviteTypes type, Data.Entity.MemberInvitations model)
        {
            try
            {
                int _senderId = LoggedInUserKey;

                if ((model.Senderid != null) && (model.Senderid.Id != 0) && (model.Senderid.Id != -1))
                    _senderId = model.Senderid.Id;

                MemberInvitations itm = new MemberInvitations();

                Guid val;

                do
                {
                    val = System.Guid.NewGuid();
                } while (Data.Helper.NHibernateHelper.UniqueResult<MemberInvitations>("Guid", "Guid", val.ToString()) != null);

                itm.Guid = val.ToString();
                itm.Senderid = Data.Helper.NHibernateHelper.UniqueResult<MemberDetails>(null, "Id", _senderId);
                itm.Email = model.Email;
                itm.Type = (int)type;
                itm.Createdate = DateTime.Now;
                itm.TargetPageid = id;
                itm.Status = 1;

                try
                {
                    string[] msgParam = new string[4];

                    string strMsg = "Hello,\n\n {0} has requested you to join Parichay. \n\n Please click the following link to sign up if you do not have an account: \n {1} \n\n Please click on following link to acknowledge if you already have an account:\n {2} \n\n {3} \n\n Thanks & Regards,\n Webmasters \n Parichay";

                    msgParam[0] = itm.Senderid.Givennm;
                    msgParam[1] = AppConstants.BaseSiteUrl.TrimEnd('/') + Url.Action("Register", "Account");
                    msgParam[2] = AppConstants.BaseSiteUrl.TrimEnd('/') + Url.Action("AckInvite", new { id = itm.Guid });
                    msgParam[3] = string.IsNullOrEmpty(model.UserMessage) ? "" : "\n----------\n" + model.UserMessage + "\n----------\n";

                    strMsg = string.Format(strMsg, msgParam);

                    SendMail(model.Email, itm.Senderid.Givennm + " : Request to Join Parichay", strMsg);
                    //SendMail(itm.Senderid.PEmail, itm.Senderid.Givennm + " : Request to Join Parichay", strMsg);
                }
                catch (Exception exc1)
                {
                    Data.Helper.NHibernateHelper.Log(new Exception("Error sending Connect Invitation Email=>", exc1));
                }

                Data.Helper.NHibernateHelper.Save<MemberInvitations>(itm);

                TempData["message"] = "Invitation sent successfully.";
            }
            catch (Exception exc1)
            {
                TempData["message"] = "Unable to invite friend. Error:" + exc1.Message;
            }

            model.MyInvites = Data.Helper.NHibernateHelper.ConvertToListOf<MemberInvitations>(Data.Helper.NHibernateHelper.Find("select distinct a from MemberInvitations a where a.Senderid = ? or a.Email = ?", new object[] { LoggedInUserKey, LoggedInUserEmail }, new NHibernate.Type.IType[] { NHibernate.NHibernateUtil.Int32, NHibernate.NHibernateUtil.String }, false));

            return (View(model));
        }