private async void projectBtn_Click(object sender, RoutedEventArgs e)
        {
            rootPage = ((App)App.Current)._MainWindowHandle;

            if (rootPage.ProjectionViewPageControl == null)
            {
                double CropPanelHeight = clippingPanel.Height;
                double CropPanelWidth = clippingPanel.Width;
                double offsetX = clippingGrid.ColumnDefinitions[0].Width.Value - paddingX;
                double offsetY = clippingGrid.RowDefinitions[0].Height.Value - paddingY;
                double ImageWidth = image.ActualWidth;

                // First, create a new, blank view
                var thisDispatcher = Window.Current.Dispatcher;
                await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    // ViewLifetimeControl is a wrapper to make sure the view is closed only
                    // when the app is done with it
                    rootPage.ProjectionViewPageControl = ViewLifetimeControl.CreateForCurrentView();

                    // Assemble some data necessary for the new page
                    var initData = new ProjectionViewPageInitializationData();
                    initData.MainDispatcher = thisDispatcher;
                    initData.ProjectionViewPageControl = rootPage.ProjectionViewPageControl;
                    initData.MainViewId = thisViewId;
                    initData.page = typeof(PictureEditorProject);
                    PageNavigateParam param = new PageNavigateParam();
                    param.MainViewId = thisViewId;
                    switch (stage)
                    {
                        case GLOABOALSTAGE.EDITPAGE_CROP:
                            param.stage = GLOABOALSTAGE.EDITPAGE_CROP;
                            CropStateParam cropParam = new CropStateParam();
                            cropParam.PicInfo = info;
                            cropParam.CropPanelHeight = CropPanelHeight;
                            cropParam.CropPanelWidth = CropPanelWidth;
                            cropParam.offsetX = offsetX;
                            cropParam.offsetY = offsetY;
                            cropParam.ImageWidth = ImageWidth;
                            param.stageParam = cropParam;
                            break;
                        case GLOABOALSTAGE.EDITPAGE_ROTATE:
                            param.stage = GLOABOALSTAGE.EDITPAGE_ROTATE;
                            RotateStateParam rotateParam = new RotateStateParam();
                            rotateParam.PicInfo = info;
                            rotateParam.UserRotation = m_userRotation;
                            param.stageParam = rotateParam;
                            break;
                        case GLOABOALSTAGE.EDITPAGE_INK:
                            param.stage = GLOABOALSTAGE.EDITPAGE_INK;
                            InkStateParam inkParam = new InkStateParam();
                            inkParam.PicInfo = info;
                            param.stageParam = inkParam;
                            //foreach (var item in strokes)
                            //{
                            //    ((App)App.Current).Strokes.Add(item.Clone());                                
                            //}
                            //((App)App.Current).SyncStrokeEx(strokeMapping, false);
                            inkTimer = new DispatcherTimer();
                            inkTimer.Tick += InkTimer_Tick;
                            inkTimer.Interval = new TimeSpan(0, 0, 2);
                            inkTimer.Start();
                            break;
                        case GLOABOALSTAGE.EDITPAGE_TEXT:
                            param.stage = GLOABOALSTAGE.EDITPAGE_TEXT;
                            TextStateParam textParam = new TextStateParam();
                            textParam.PicInfo = info;
                            param.stageParam = textParam;
                            break;
                    }
                    initData.naviParam = param;

                    // Display the page in the view. Note that the view will not become visible
                    // until "StartProjectingAsync" is called
                    var rootFrame = new Frame();
                    rootFrame.Navigate(typeof(HomeProject), initData);
                    Window.Current.Content = rootFrame;
                    Window.Current.Activate();
                });

                try
                {
                    // Start/StopViewInUse are used to signal that the app is interacting with the
                    // view, so it shouldn't be closed yet, even if the user loses access to it
                    rootPage.ProjectionViewPageControl.StartViewInUse();

                    // Show the view on a second display (if available) or on the primary display
                    Rect pickerLocation = new Rect(470.0, 0.0, 200.0, 300.0);
                    bool projected = await ProjectionManager.RequestStartProjectingAsync(rootPage.ProjectionViewPageControl.Id, thisViewId, pickerLocation, Windows.UI.Popups.Placement.Above);
                    if (projected)
                    {
                        ((App)App.Current).projectedFlag = true;
                        rootPage.ProjectionViewPageControl.StopViewInUse();
                        if (stage != GLOABOALSTAGE.EDITPAGE_INK)
                        {
                            projectControlPanel.Visibility = Visibility.Visible;
                            editorGrid.Visibility = Visibility.Collapsed;
                            if (monitorTimer == null)
                            {
                                monitorTimer = new DispatcherTimer();
                                monitorTimer.Interval = new TimeSpan(0, 0, 2);
                                monitorTimer.Tick += MonitorTimer_Tick;
                                monitorTimer.Start();
                            }
                            else
                            {
                                monitorTimer.Start();
                            }
                        }
                    }

                }
                catch (InvalidOperationException)
                {

                }
            }

        }
        private async void projectButton_Click(object sender, RoutedEventArgs e)
        {            
            // If projection is already in progress, then it could be shown on the monitor again
            // Otherwise, we need to create a new view to show the presentation
            rootPage = ((App)App.Current)._MainWindowHandle;
            if (rootPage.ProjectionViewPageControl == null)
            {
                // First, create a new, blank view
                var thisDispatcher = Window.Current.Dispatcher;
                await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    // ViewLifetimeControl is a wrapper to make sure the view is closed only
                    // when the app is done with it
                    rootPage.ProjectionViewPageControl = ViewLifetimeControl.CreateForCurrentView();

                    // Assemble some data necessary for the new page
                    var initData = new ProjectionViewPageInitializationData();
                    initData.MainDispatcher = thisDispatcher;
                    initData.ProjectionViewPageControl = rootPage.ProjectionViewPageControl;
                    initData.MainViewId = thisViewId;
                    initData.page = typeof(MainPageProject);
                    PageNavigateParam param = new PageNavigateParam();
                    param.stage = stage;
                    param.MainViewId = thisViewId;
                    if (stage == GLOABOALSTAGE.MAINPAGE_PICFLIP)
                    {
                        param.stageParam = selectedIndex;
                    }
                    else
                    {
                        param.stageParam = null;
                    }
                    initData.naviParam = param;
                    // Display the page in the view. Note that the view will not become visible
                    // until "StartProjectingAsync" is called
                    var rootFrame = new Frame();
                    rootFrame.Navigate(typeof(HomeProject),initData);
                    Window.Current.Content = rootFrame;
                    Window.Current.Activate();
                });

                try
                {
                    // Start/StopViewInUse are used to signal that the app is interacting with the
                    // view, so it shouldn't be closed yet, even if the user loses access to it
                    rootPage.ProjectionViewPageControl.StartViewInUse();

                    // Show the view on a second display (if available) or on the primary display
                    Rect pickerLocation = new Rect(470.0, 0.0, 200.0, 300.0);
                    bool projected = await ProjectionManager.RequestStartProjectingAsync(rootPage.ProjectionViewPageControl.Id, thisViewId, pickerLocation, Windows.UI.Popups.Placement.Above);
                    if (projected)
                    {
                        ((App)App.Current).projectedFlag = true;
                        rootPage.ProjectionViewPageControl.StopViewInUse();
                        projectControlPanel.Visibility = Visibility.Visible;
                        mainGrid.Visibility = Visibility.Collapsed;
                        if(monitorTimer == null)
                        {
                            monitorTimer = new DispatcherTimer();
                            monitorTimer.Interval = new TimeSpan(0,0,2);
                            monitorTimer.Tick += MonitorTimer_Tick;
                            monitorTimer.Start();
                        }
                        else
                        {
                            monitorTimer.Start();
                        }
                    }
                }
                catch (InvalidOperationException)
                {

                }
            }           
        }