コード例 #1
0
        /// <summary>
        /// Selected a class.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            SectionButton button = (SectionButton)sender;

            ClassNameBox.Text = (String)button.Content;
            StudentSelectPanel.Children.Clear();
            CurrentSection = button.Info;

            foreach (var item in ClassSelectPanel.Children)
            {
                if (item is SectionButton)
                {
                    ((SectionButton)item).IsEnabled = true;
                }
            }

            foreach (StudentInfo info in button.Info.Students.OrderBy(inf => inf.LastName).ThenBy(inf => inf.FirstName).ToList())
            {
                StudentButton studentButton = new StudentButton(info);
                studentButton.Click += StudentButton_Click;
                StudentSelectPanel.Children.Add(studentButton);
            }

            try
            {
                CommentSettings.CurrentHeaderParagraph = await button.Info.CurrentCommentHeaderAsync();
            }
            // If something goes wrong alert the user.
            catch (WebException ex)
            {
                String responseBody;
                using (StreamReader sr = new StreamReader(ex.Response.GetResponseStream()))
                {
                    responseBody = sr.ReadToEnd();
                }

                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(responseBody);
                await dialog.ShowAsync();
            }

            using (MemoryStream ms = new MemoryStream())
            {
                StreamWriter writer = new StreamWriter(ms);
                writer.Write(CommentSettings.CurrentHeaderParagraph.Html);
                writer.Flush();
                ms.Position = 0;

                EditorBox.Load(ms, FormatType.Html);
            }


            button.IsEnabled = false;
            CurrentState     = State.LoadedHeader;
            StateChanged(this, new EventArgs());
        }
コード例 #2
0
    void CreateSectionButton()
    {
        GameObject inst = Instantiate(sectionButtonPrefab);

        inst.transform.parent = this.transform;

        SectionButton sb = inst.GetComponent <SectionButton>();

        sb.SetSection(sections.Count - 1);
        sectionButtons.Add(sb);

        SetButtonPositions();
    }
コード例 #3
0
    public void CreateSectionButtons()
    {
        for (int i = 0; i < sections.Count; i++)
        {
            GameObject inst = Instantiate(sectionButtonPrefab);
            inst.transform.parent = this.transform;
            float xPos = (maxSections - sections.Count) / 2 + i;
            inst.transform.localPosition = new Vector3(xPos, 0, 0);

            SectionButton sb = inst.GetComponent <SectionButton>();
            sb.SetSection(i);
            sectionButtons.Add(sb);
        }
    }
コード例 #4
0
        private async void LoginControl_OnAuthenticationCompleted(object sender, EventArgs e)
        {
            ClassSelectPanel.Children.Remove(loginControl);
            await UserInfo.GetCurrent();

            UserNameDisplay.Text = String.Format("{0} {1}", UserInfo.Current.FirstName, UserInfo.Current.LastName);
            List <SectionInfo> sections = await((TeacherInfo)UserInfo.Current).CurrentSections();

            StudentLabel.Visibility = Visibility.Visible;
            foreach (SectionInfo section in sections)
            {
                SectionButton button = new SectionButton(section);
                button.Click += Button_Click;
                ClassSelectPanel.Children.Add(button);
            }

            CurrentState = State.LoadedSections;
            StateChanged(this, new EventArgs());
        }