Esempio n. 1
0
        private async void SetListSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var list = sender as ListView;

            if (list.SelectedIndex != -1)
            {
                switch (list.SelectedIndex)
                {
                case 0:
                    var nav = WindowWrapper.Current().NavigationServices.FirstOrDefault();
                    nav.Navigate(typeof(Views.TermSettingPage), null);
                    // (Window.Current.Content as Frame).Navigate(typeof(TermSettingPage));
                    break;

                case 1:
                    var item = list.Items[list.SelectedIndex] as ListViewItem;
                    WeekFlyout.ShowAt(item);
                    break;

                case 2:
                    var dialog = new DialogBox()
                    {
                        Title               = "设置课表最大节数",
                        PrimaryButtonText   = "取消",
                        SecondaryButtonText = "确定",
                        Height              = 500
                    };
                    var slider = new Slider()
                    {
                        Name          = "slider",
                        Minimum       = 5,
                        Maximum       = 24,
                        Margin        = new Thickness(0, 10, 50, 0),
                        TickFrequency = 1
                    };
                    dialog.mainTextBlock.HorizontalAlignment = HorizontalAlignment.Right;
                    dialog.mainTextBlock.VerticalAlignment   = VerticalAlignment.Center;
                    slider.ValueChanged += (s, arg) =>
                    {
                        dialog.mainTextBlock.Text = arg.NewValue.ToString();
                    };
                    slider.Value = data.maxCount;
                    dialog.mainDialogGrid.Children.Add(slider);
                    var result = await dialog.ShowAsync();

                    if (result == ContentDialogResult.Secondary)
                    {
                        data.maxCount = int.Parse(slider.Value.ToString());
                        Frame.Navigate(typeof(MainPage));
                    }
                    break;
                }
            }
        }
Esempio n. 2
0
        private async void SetListSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var list = sender as ListView;

            if (list.SelectedIndex != -1)
            {
                switch (list.SelectedIndex)
                {
                case 0:
                    (Window.Current.Content as Frame).Navigate(typeof(Views.Setting.TermSettingPage));
                    break;

                case 1:
                    var item = list.Items[list.SelectedIndex] as ListViewItem;
                    WeekFlyout.ShowAt(item);
                    break;

                case 2:
                    var dialog = new Controls.DialogBox()
                    {
                        Title               = "设置课表最大节数",
                        PrimaryButtonText   = "取消",
                        SecondaryButtonText = "确定",
                        Height              = 500
                    };

                    /*
                     * var listbox = new ListView() { Height=300};
                     * for (int i = 5; i < 25; i++)
                     * {
                     *  listbox.Items.Add(i);
                     * }
                     * listbox.SelectedIndex = 0;
                     * dialog.mainDialogGrid.Children.Add(listbox);
                     */
                    var slider = new Slider()
                    {
                        Name          = "slider",
                        Minimum       = 5,
                        Maximum       = 24,
                        Margin        = new Thickness(0, 10, 50, 0),
                        TickFrequency = 1
                    };
                    dialog.mainTextBlock.HorizontalAlignment = HorizontalAlignment.Right;
                    dialog.mainTextBlock.VerticalAlignment   = VerticalAlignment.Center;
                    slider.ValueChanged += (s, arg) =>
                    {
                        dialog.mainTextBlock.Text = arg.NewValue.ToString();
                    };
                    slider.Value = Class.UserManager.UserData.maxCount;
                    dialog.mainDialogGrid.Children.Add(slider);
                    var result = await dialog.ShowAsync();

                    if (result == ContentDialogResult.Secondary)
                    {
                        if (await Class.Model.CourseManager.Setting.SetCourseMaxCount(int.Parse(slider.Value.ToString())))
                        {
                            Frame.Navigate(typeof(CoursePage));
                        }
                    }
                    break;

                case 3:
                    (Window.Current.Content as Frame).Navigate(typeof(Views.Course.BackgroundSetPage));
                    break;

                default:
                    break;
                }
                list.SelectedIndex = -1;
            }
        }