Exemplo n.º 1
0
 private void OnTicketToggleButtonClick(object sender, RoutedEventArgs e)
 {
     TicketToggleButton.IsChecked    = true;
     TicketToggleButton.FontWeight   = Windows.UI.Text.FontWeights.SemiBold;
     IncidentToggleButton.IsChecked  = false;
     IncidentToggleButton.FontWeight = Windows.UI.Text.FontWeights.Normal;
     ListFrame.Navigate(typeof(TicketsListPaneView), _incidentId);
 }
Exemplo n.º 2
0
        public MainPage()
        {
            this.InitializeComponent();

            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(360, 120));
            SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
            ListFrame.Navigate(typeof(ListPage));
            EditFrame.Navigate(typeof(EditPage));
        }
Exemplo n.º 3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            JsonObject parameters = JsonObject.Parse(e.Parameter as string);

            if (parameters != null)
            {
                mainAdaptiveVM.FromString(parameters["MainAdaptiveState"].GetString());
            }
            ListFrame.Navigate(typeof(ListPage));
            EditFrame.Navigate(typeof(EditPage), e.Parameter);
        }
Exemplo n.º 4
0
        public MainPage()
        {
            InitializeComponent();
            Current = this;
            ListFrame.Navigate(typeof(ListPage));
            NewFrame.Navigate(typeof(NewPage));

            this.SizeChanged += (s, e) => {
                if (e.NewSize.Width > 800)
                {
                    State = "All";
                }
                else
                {
                    if (State != "Detail")
                    {
                        State = "List";
                    }
                }
            };

            SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) => {
                if (IsSmallScreen())
                {
                    State = "List";
                }
                ListPage.Current.ItemSelected = -1;
            };

            // SetBackground
            ImageBrush imageBrush = new ImageBrush {
                ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/Background1.jpg", UriKind.Absolute))
            };

            MainPageGrid.Background = imageBrush;

            // 恢复挂起状态
            if (((App)App.Current).isSuspend)
            {
                if (ApplicationData.Current.LocalSettings.Values.ContainsKey("AddNewItem"))
                {
                    var isEditState = (bool)ApplicationData.Current.LocalSettings.Values["AddNewItem"];
                    if (isEditState)
                    {
                        State = "Detail";
                    }
                }
            }

            if (State != "Detail")
            {
                State = "List";
            }
        }
Exemplo n.º 5
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;

            if (e.Parameter is DashboardViewModel)
            {
                _viewModel  = e.Parameter as DashboardViewModel;
                DataContext = _viewModel;
                _viewModel.Initialize(MapControl, (pageType, parameter) => ListFrame.Navigate(pageType, parameter));
            }
        }
        public ArticleView()
        {
            this.InitializeComponent();

            ListFrame.Navigate(typeof(ArticleList));

            DispatcherTimer time = new DispatcherTimer
            {
                Interval = new TimeSpan(0, 0, 5)
            };

            time.Tick += Time_Tick;
            time.Start();
        }
Exemplo n.º 7
0
 protected override void OnNavigatedTo(NavigationEventArgs ne)
 {
     ListFrame.Navigate(typeof(ListPage));
     (ListFrame.Content as ListPage).Loaded += (object sender, RoutedEventArgs re) => {
         JsonObject parameters = JsonObject.Parse(ne.Parameter as string);
         if (parameters != null)
         {
             if (parameters.ContainsKey("MainAdaptiveState"))
             {
                 MainAdaptiveViewModel.getInstance().FromString(parameters["MainAdaptiveState"].GetString());
             }
         }
         EditFrame.Navigate(typeof(EditPage), ne.Parameter);
     };
 }
Exemplo n.º 8
0
 //汉堡界面的选择切换
 private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (Home.IsSelected)
     {
         //主界面
         TitleTextBlock.Text = "Home";
         InitializeList();
     }
     else if (Collection.IsSelected)
     {
         //收藏界面
         ListFrame.Navigate(typeof(CollectorItems));
         TitleTextBlock.Text = "Collection";
     }
     else if (Users.IsSelected)
     {
         ListFrame.Navigate(typeof(UserManagePage), user);
         TitleTextBlock.Text = user.Username;
     }
 }
Exemplo n.º 9
0
 private void ManagePage2Base_OnClick(object sender, RoutedEventArgs e)
 {
     ListFrame.Navigate(typeof(ManagePage2));
 }
Exemplo n.º 10
0
        //private  void showProgressRing() {
        //    MyProgressRing.IsActive = true;
        //    MyProgressRing.Visibility = Visibility.Visible;
        //}

        //private  void killProgressRing() {
        //    MyProgressRing.IsActive = false;
        //    MyProgressRing.Visibility = Visibility.Collapsed;
        //}

        private async void InitializeList()
        {
            try
            {
                if (!first)
                {
                    ListFrame.Navigate(typeof(ListPage), VideoTypeComboBox.SelectedIndex);
                }
                //如果选择的是电影类型
                if (VideoTypeComboBox.SelectedIndex == 0)
                {
                    //API请求,language是电影语言, page是搜索的页,用于支持翻页功能,翻一次页请求一次(API本身的限制只能这么做), Mgenre电影的类型, releaseYear电影放映日期, sortBy电影以热度还是评分排序
                    String     url     = String.Format("https://api.themoviedb.org/3/discover/movie?api_key=7888f0042a366f63289ff571b68b7ce0&include_adult=false{0}&page={1}{2}{3}{4}", language, page, Mgenre, releaseYear, sortBy);
                    HttpClient client  = new HttpClient();
                    String     Jresult = await client.GetStringAsync(url);

                    //本想把这句放在最前面,跳转更快,但是ListFrame实例化需要一点时间,放在前面会报空指针的错误,只好先请求网络给程序一点时间
                    if (first)
                    {
                        first = false;
                        ListFrame.Navigate(typeof(ListPage), 0);
                    }
                    //Where is the Show progress ring code? Not here!
                    //Written in XAML for initialization!!!

                    //序列化电影列表,通过其解析Json,Models中除了Starlist,其他类都是通过网站json2csharp.com自动生成的
                    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(QueryMovieList));
                    MemoryStream   ms             = new MemoryStream(Encoding.UTF8.GetBytes(Jresult));
                    QueryMovieList queryMovieList = (QueryMovieList)serializer.ReadObject(ms);

                    //没有这类型的电影
                    if (queryMovieList.total_results == 0)
                    {
                        await new Windows.UI.Popups.MessageDialog("Found nothing, please change the key words and try again! ").ShowAsync();
                    }
                    else
                    {
                        viewModel.clear();
                        foreach (var result in queryMovieList.results)
                        {
                            //该电影有海报
                            if (result.poster_path != null)
                            {
                                //修改为能访问的网址
                                result.poster_path = "https://image.tmdb.org/t/p/w500" + result.poster_path;
                            }
                            //没有海报
                            else
                            {
                                //使用默认海报
                                result.poster_path = "Assets/defaultPoster.jpg";
                            }
                            //添加到ViewModel
                            viewModel.AddMovieResult(result);
                        }
                    }
                }
                else
                {
                    //同理
                    String     url     = String.Format("https://api.themoviedb.org/3/discover/tv?api_key=7888f0042a366f63289ff571b68b7ce0&include_adult=false{0}&page={1}{2}{3}", language, page, Tgenre, sortBy);
                    HttpClient client  = new HttpClient();
                    String     Jresult = await client.GetStringAsync(url);

                    if (first)
                    {
                        first = false;
                        ListFrame.Navigate(typeof(ListPage), 1);
                    }
                    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(QueryTVList));
                    MemoryStream ms          = new MemoryStream(Encoding.UTF8.GetBytes(Jresult));
                    QueryTVList  queryTVList = (QueryTVList)serializer.ReadObject(ms);

                    if (queryTVList.total_results == 0)
                    {
                        await new Windows.UI.Popups.MessageDialog("Found nothing, please change the key words and try again! ").ShowAsync();
                    }
                    else
                    {
                        viewModel.clear();
                        foreach (var result in queryTVList.results)
                        {
                            if (result.poster_path != null)
                            {
                                result.poster_path = "https://image.tmdb.org/t/p/w500" + result.poster_path;
                            }
                            else
                            {
                                result.poster_path = "Assets/defaultPoster.jpg";
                            }
                            viewModel.AddTVResult(result);
                        }
                    }
                }
            }
            catch
            {
                await new Windows.UI.Popups.MessageDialog("Opps! Something wrong happened to the connection, please check your network and try again! ").ShowAsync();
            }
            finally
            {
                MyProgressRing.IsActive   = false;
                MyProgressRing.Visibility = Visibility.Collapsed;
            }
        }
Exemplo n.º 11
0
 public void NavigateTo(StorageFolder item)
 {
     ListFrame.Navigate(typeof(PostersPage), item);
 }