示例#1
0
        public MainPage()
        {
            this.InitializeComponent();
            appSettings = ApplicationData.Current.LocalSettings.Values;

            var bounds = Window.Current.Bounds;
            var height = bounds.Height;
            var width  = bounds.Width;

            VidGrid.Width = .7 * width;     // VidGrid takes up the left half of the page
            VideoInformationGrid.Width = .35 * width;



            // If the user is not logged in
            if (!appSettings.ContainsKey(usernameKey) || !appSettings.ContainsKey(passwordKey))
            {
                loginPopUp.IsOpen = true;
                usernameTxtBox.Focus(Windows.UI.Xaml.FocusState.Keyboard);
                logoutBtn.Visibility  = Visibility.Collapsed;
                accoutnBtn.Visibility = Visibility.Collapsed;
                videosBtn.Visibility  = Visibility.Collapsed;
            }
            else
            {
                loginPopUp.IsOpen     = false;
                logoutBtn.Visibility  = Visibility.Visible;
                accoutnBtn.Visibility = Visibility.Visible;
                videosBtn.Visibility  = Visibility.Visible;
            }



            List <DummiePerson> list = new List <DummiePerson>()
            {
                new DummiePerson {
                    Image_Name = "Made some good progress", Image = "Person1.jpg", Description = "I finally figured out how to calculate congruency complexity!"
                },
                new DummiePerson {
                    Image_Name = "Signing off!", Image = "Person2.jpg", Description = "Thank you all for the awesome experience!"
                },
                new DummiePerson {
                    Image_Name = "Just woke up", Image = "Person3.jpg", Description = "I had such a good time with my friends tonight."
                },
                new DummiePerson {
                    Image_Name = "Talk about a bad hair day...", Image = "Person4.jpg", Description = "You know what's awesome about summer? Long hair."
                },
                new DummiePerson {
                    Image_Name = "Haircuts... ", Image = "Person6.jpg", Description = "I don't like haircuts one bit. That's right, I said. it. "
                },
            };

            DataContext = list;
            groupedItemsViewSource.Source = list;

            OpenVideo();
        }
        /// <summary>
        /// Page constructor
        /// </summary>
        public GroupedItemsPage()
        {
            this.InitializeComponent();
            Loaded += OnLoaded;


            videosProgressRing.Visibility = Visibility.Visible;

            appSettings = ApplicationData.Current.LocalSettings.Values;
           
            var bounds = Window.Current.Bounds;
            var height = bounds.Height;
            var width = bounds.Width;

            if (App.HasNetworkConnection)
                AuthenticateArchiveAPI();       // Authenticate client app with Archive API

            // If the user is not logged in 
            if (!appSettings.ContainsKey(usernameKey) || !appSettings.ContainsKey(passwordKey))
            {

                greetingsBanner.Visibility = Visibility.Visible; 
                usernameTxtBox.Focus(Windows.UI.Xaml.FocusState.Keyboard);
                loginPopUp.Visibility = Visibility.Collapsed; 
                logoutBtn.Visibility = Visibility.Collapsed;
                profileBtn.Visibility = Visibility.Collapsed; 
                loginBtn.Visibility = Visibility.Visible;
                signUpBtn.Visibility = Visibility.Visible;
                lowerButtonsStackPanel.Visibility = Visibility.Collapsed;
               
            }
            else
            {
                greetingsBanner.Visibility = Visibility.Collapsed;
                loginPopUp.Visibility = Visibility.Collapsed; 
                logoutBtn.Visibility = Visibility.Visible;
                profileBtn.Visibility = Visibility.Visible; 
                loginBtn.Visibility = Visibility.Collapsed;
                signUpBtn.Visibility = Visibility.Collapsed;
                lowerButtonsStackPanel.Visibility = Visibility.Visible;
                try
                {

                    var userJSON = appSettings[User];
                    App.LoggedInUser = JsonConvert.DeserializeObject<User>(appSettings[User].ToString());
                   
                }
                catch 
                {
                    // Do something here!
                }
            }
            
        }
        public MainPage()
        {
            this.InitializeComponent();
            appSettings = ApplicationData.Current.LocalSettings.Values;

            Loaded += OnLoaded; 

            #region Initialize all selected values in the graduation date popup
            monthComboBox.SelectedIndex = 0;
            dayComboBox.SelectedIndex = 0;
            yearComboBox.SelectedIndex = 0;
            #endregion 

            #region Show the date PopUp if there isn't a saved date 
            if (!appSettings.ContainsKey(dateKey))
            {
                untilTxtBlock.Visibility = Visibility.Collapsed;
                countdownTxtBlock.Visibility = Visibility.Collapsed; 
                datePopUp.IsOpen = true; 
            }
            else
            {
                datePopUp.IsOpen = false;
                string date = appSettings[dateKey].ToString();
                var tempArray = date.Split(' ');    // Results in  tempArray[0] = xx/xx/xx
                var dateArray = tempArray[0].Split('/');
                int month = Convert.ToInt32(dateArray[0]);
                int day = Convert.ToInt32(dateArray[1]);
                int year = Convert.ToInt32(dateArray[2]);
                GraduationDate = new DateTime(year, month, day);
                //Clock.WinRT.ClockTileScheduler.SetGraduationDate(year, month, day); 
            }
            #endregion 
        }
示例#4
0
        public MainPage()
        {
            this.InitializeComponent();
            appSettings = ApplicationData.Current.LocalSettings.Values;

            var bounds = Window.Current.Bounds;
            var height = bounds.Height;
            var width = bounds.Width;
            VidGrid.Width = .7 * width;     // VidGrid takes up the left half of the page
            VideoInformationGrid.Width = .35 * width; 



            // If the user is not logged in 
            if (!appSettings.ContainsKey(usernameKey) || !appSettings.ContainsKey(passwordKey))
            {
                loginPopUp.IsOpen = true;
                usernameTxtBox.Focus(Windows.UI.Xaml.FocusState.Keyboard); 
                logoutBtn.Visibility = Visibility.Collapsed;
                accoutnBtn.Visibility = Visibility.Collapsed;
                videosBtn.Visibility = Visibility.Collapsed;
            }
            else
            {
                loginPopUp.IsOpen = false;
                logoutBtn.Visibility = Visibility.Visible;
                accoutnBtn.Visibility = Visibility.Visible;
                videosBtn.Visibility = Visibility.Visible; 
            }

       

            List<DummiePerson> list = new List<DummiePerson>()
            {
                new DummiePerson{Image_Name="Made some good progress", Image="Person1.jpg", Description="I finally figured out how to calculate congruency complexity!"},
                new DummiePerson{Image_Name="Signing off!", Image="Person2.jpg", Description="Thank you all for the awesome experience!"},
                new DummiePerson{Image_Name="Just woke up", Image="Person3.jpg", Description="I had such a good time with my friends tonight."},
                new DummiePerson{Image_Name="Talk about a bad hair day...", Image="Person4.jpg", Description="You know what's awesome about summer? Long hair."},
                new DummiePerson{Image_Name="Haircuts... ", Image="Person6.jpg", Description="I don't like haircuts one bit. That's right, I said. it. "},
            };
            DataContext = list;
            groupedItemsViewSource.Source = list;

            OpenVideo(); 
        
        }
示例#5
0
        /// <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.  The Parameter
        /// property is typically used to configure the page.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Reload previously taken video
            if (appSettings.ContainsKey(videoKey))
            {
                object filePath;
                if (appSettings.TryGetValue(videoKey, out filePath) && filePath.ToString() != "")
                {
                    await ReloadVideo(filePath.ToString());
                }
            }

            if (!appSettings.ContainsKey(usernameKey) || !appSettings.ContainsKey(passwordKey))
            {
                loginPopUp.IsOpen = true;               // so prompt the user to login
                usernameTxtBox.Focus(Windows.UI.Xaml.FocusState.Keyboard);
            }



            // HttpClient functionality can be extended by plugging multiple handlers together and providing
            // HttpClient with the configured handler pipeline.
            HttpMessageHandler handler = new HttpClientHandler();

            handler    = new PlugInHandler(handler); // Adds a custom header to every request and response message.
            httpClient = new HttpClient(handler);


            // The following line sets a "User-Agent" request header as a default header on the HttpClient instance.
            // Default headers will be sent with every request sent from this HttpClient instance.
            httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Sample", "v8"));
        }