private void btnUserProfile_Click(object sender, EventArgs e)
 {
     try
     {
         tvodUltility = new Ultility();
         bool isLogin = tvodUltility.checkLogin();
         if (isLogin == true)
         {
             NavigationService.Navigate(new Uri("/UserProfileActivity_V2.xaml", UriKind.Relative));
         }
         else
         {
             (App.Current as App).navigation_tvod = "MAIN_PAGE";
             //NavigationService.Navigate(new Uri("/LoginActivity.xaml", UriKind.Relative));
             LoginActivity_V2 loginWindow = new LoginActivity_V2();
             //loginWindow.Login = Username;
             //loginWindow.Closed += new EventHandler(OnLoginChildWindowShow);
             loginWindow.Show();
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
Esempio n. 2
0
        private void parseJSONGetURL(string jsonGetURL)
        {
            try
            {
                var URLJSONObj = JsonConvert.DeserializeObject <URLObject>(jsonGetURL);
                if (URLJSONObj.success == true)
                {
                    this.video_url = URLJSONObj.url;
                    if (this.video_url != null && !this.video_url.Equals(""))
                    {
                        MediaPlayerLauncher player = new MediaPlayerLauncher();
                        player.Media = new Uri(this.video_url);
                        player.Show();
                    }
                    else
                    {
                        MessageBox.Show("File MP4 được gửi từ Server bị lỗi !");
                    }
                    //disableProgressBar();
                }
                else
                {
                    disableProgressBar();
                    if (URLJSONObj.type != null && URLJSONObj.type.Equals(SystemParameter.ERROR_CODE_FROM_SERVER_NO_AUTHORIZED))
                    {
                        //MessageBox.Show("Chưa đăng nhập. Bạn có muốn đăng nhập vào hệ thống ?");
                        if (MessageBox.Show("Chưa đăng nhập. Bạn có muốn đăng nhập vào hệ thống ?", "Thông Báo", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                        {
                            (App.Current as App).navigation_tvod = "MAIN_PAGE";
                            disableProgressBar();
                            LoginActivity_V2 loginWindow = new LoginActivity_V2();
                            loginWindow.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show(URLJSONObj.type + ":" + URLJSONObj.reason);
                    }

                    if ((App.Current as App).user_name != null && (App.Current as App).password != null)
                    {
                        string cmsLogin = SystemParameter.REQUEST_LOGIN;
                        cmsLogin  = cmsLogin.Replace("%u", (App.Current as App).user_name);
                        cmsLogin  = cmsLogin.Replace("%p", (App.Current as App).password);
                        clientURL = new WebClient();
                        clientURL.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_Login_getURL_DownloadStringCompleted);
                        clientURL.DownloadStringAsync(new Uri(cmsLogin.ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Esempio n. 3
0
        private void getURL()
        {
            enableProgressBar();
            /** URL **/
            string cmsURl = SystemParameter.REQUEST_VIDEO_MOBILE_URL;

            cmsURl = cmsURl.Replace("%s", this.video_id);


            clientURL = new WebClient();

            if (tvodUltility.checkLogin())
            {
                if (this.cookie != null && !this.cookie.Equals(""))
                {
                    clientURL.Headers["Cookie"] = this.cookie;
                }
                else
                {
                    if ((App.Current as App).cookie != null && !(App.Current as App).cookie.Equals(""))
                    {
                        clientURL.Headers["Cookie"] = (App.Current as App).cookie;
                    }
                    else
                    {
                        string old_cookie = getCookieFromIsolatedStorage();
                        if (old_cookie != null && old_cookie != "" && old_cookie != "\r\n")
                        {
                            clientURL.Headers["Cookie"] = old_cookie;
                        }
                    }
                }
                clientURL.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_getURL_DownloadStringCompleted);
                clientURL.DownloadStringAsync(new Uri(cmsURl.ToString()));
            }
            else
            {
                if (MessageBox.Show("Chưa đăng nhập. Bạn có muốn đăng nhập vào hệ thống ?", "Thông Báo", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    (App.Current as App).navigation_tvod = "MAIN_PAGE";
                    disableProgressBar();
                    LoginActivity_V2 loginWindow = new LoginActivity_V2();
                    loginWindow.Show();
                }
                else
                {
                    disableProgressBar();
                }
            }
        }
Esempio n. 4
0
        private void addContentToFavouriteList(String video_id)
        {
            webClient = new WebClient();
            enableProgressBar();
            string cmsAddFavourite = SystemParameter.REQUEST_ADD_FAVOURITE_CONTENT;

            cmsAddFavourite = cmsAddFavourite.Replace("%c", video_id.Trim());
            if (tvodUltility.checkLogin())
            {
                if (this.cookie != null && !this.cookie.Equals(""))
                {
                    webClient.Headers["Cookie"] = this.cookie;
                }
                else
                {
                    if ((App.Current as App).cookie != null && !(App.Current as App).cookie.Equals(""))
                    {
                        webClient.Headers["Cookie"] = (App.Current as App).cookie;
                    }
                    else
                    {
                        string old_cookie = getCookieFromIsolatedStorage();
                        if (old_cookie != null && old_cookie != "" && old_cookie != "\r\n")
                        {
                            webClient.Headers["Cookie"] = old_cookie;
                        }
                    }
                }
                webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_add_favourite_DownloadStringCompleted);
                webClient.DownloadStringAsync(new Uri(cmsAddFavourite.ToString()));
            }
            else
            {
                if (MessageBox.Show("Chưa đăng nhập. Bạn có muốn đăng nhập vào hệ thống ?", "Thông Báo", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    (App.Current as App).navigation_tvod = "MAIN_PAGE";
                    disableProgressBar();
                    LoginActivity_V2 loginWindow = new LoginActivity_V2();
                    loginWindow.Show();
                }
                else
                {
                    disableProgressBar();
                }
            }
        }
 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     if (tvodUtil.checkLogin())
     {
         base.OnNavigatedTo(e);
         string live_channel_id     = "";
         string live_channel_url    = "";
         string live_channel_folder = "";
         string msg = "";
         if (NavigationContext.QueryString.TryGetValue("live_channel_id", out msg))
         {
             live_channel_id = msg;
         }
         if (NavigationContext.QueryString.TryGetValue("live_channel_url", out msg))
         {
             live_channel_url = msg;
         }
         if (NavigationContext.QueryString.TryGetValue("live_channel_folder", out msg))
         {
             live_channel_folder = msg;
         }
         live_channel_url += "/manifest";
         PlaylistItem item = new PlaylistItem();
         item.MediaSource    = new Uri(live_channel_url);
         item.DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.Streaming;
         strmPlayer.Playlist.Add(item);
         strmPlayer.Play();
     }
     else
     {
         if (MessageBox.Show("Chưa đăng nhập. Bạn có muốn đăng nhập vào hệ thống ?", "Thông Báo", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
         {
             (App.Current as App).navigation_tvod = "MAIN_PAGE";
             LoginActivity_V2 loginWindow = new LoginActivity_V2();
             loginWindow.Show();
         }
     }
 }
Esempio n. 6
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (tvodUtil.checkLogin())
            {
                base.OnNavigatedTo(e);
                BindingData_To_Get_Session_ID();
                string live_channel_id = "";
                //string live_channel_url = "";
                string live_channel_folder = "";
                string msg = "";
                if (NavigationContext.QueryString.TryGetValue("live_channel_id", out msg))
                {
                    live_channel_id = msg;
                }
                if (NavigationContext.QueryString.TryGetValue("live_channel_url", out msg))
                {
                    this.live_channel_url = msg;
                }
                if (NavigationContext.QueryString.TryGetValue("live_channel_folder", out msg))
                {
                    live_channel_folder = msg;
                }

                //live_channel_url += "/manifest?sessionID=" + this.sessionID;
                //liveChannelPlayer.SmoothStreamingSource = new Uri(live_channel_url);
            }
            else
            {
                NavigationService.GoBack();
                if (MessageBox.Show("Chưa đăng nhập. Bạn có muốn đăng nhập vào hệ thống ?", "Thông Báo", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    (App.Current as App).navigation_tvod = "MAIN_PAGE";
                    LoginActivity_V2 loginWindow = new LoginActivity_V2();
                    loginWindow.Show();
                }
            }
        }