コード例 #1
0
        /*
         * 单击页面树,显示当前页面内容
         */
        private void StorageVideo_TreeView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (e.Source.GetType().Name != "TreeViewItem")
            {
                e.Handled = true;
                return;
            }

            try
            {
                TreeViewItem treeViewItem = (TreeViewItem)e.Source;
                Object       tag          = treeViewItem.Tag;
                if (tag != null)
                {
                    Int32         folderId      = Int32.Parse(tag.ToString());
                    VideoItemPage videoItemPage = new VideoItemPage(folderId);
                    mainFrame.Navigate(videoItemPage);
                    FrameUtil.RemoveBackEntry(mainFrame);
                }
                else
                {
                    MessageBox.Show("没有tag:" + treeViewItem.Header.ToString());
                }
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("页面不能为空");
            }
            catch (ArgumentException)
            {
                MessageBox.Show("页面地址异常");
            }
            catch (UriFormatException)
            {
                MessageBox.Show("页面地址格式化异常");
            }
            catch (Exception e4)
            {
                MessageBox.Show("找不到此页面" + e4.Message.ToString() + e4.StackTrace);
            }
        }
コード例 #2
0
        /*
         * 选项卡按钮选中
         */
        private void SelectItemFun(string currItemName)
        {
            foreach (Canvas canvas in itemWrapPanel.Children)
            {
                if (currItemName == canvas.Name)
                {
                    //选中当前
                    SelectThisItem(canvas, canvas.Name);

                    if (currItemName == "imageItem")
                    {
                        StorageImage_InitFolder();

                        ImageItemPage imageItemPage = new ImageItemPage(1);
                        mainFrame.Navigate(imageItemPage);
                    }
                    else if (currItemName == "videoItem")
                    {
                        //获取视频文件夹
                        StorageVideo_InitFolder();

                        VideoItemPage videoItemPage = new VideoItemPage(1);
                        mainFrame.Navigate(videoItemPage);
                    }
                    else if (currItemName == "fileItem")
                    {
                        StorageFile_InitFolder();

                        FileItemPage fileItemPage = new FileItemPage(1);
                        mainFrame.Navigate(fileItemPage);
                    }
                }
                else
                {
                    //其他取消选中
                    UnSelectThisItem(canvas, canvas.Name);
                }
            }
        }