//Button click for returning to main menu in pause menu. Logs and summarizes presentation session
        private void GoMainMenu_Click(object sender, RoutedEventArgs e)
        {
            if (pauseControl != null)
            {
                pauseControl.GoBackButton.Click -= GoBackButtonPause_Click;
                myCanvas.Children.Remove(pauseControl);
                pauseControl = null;
            }
            MainWindow.myState = MainWindow.States.menu;
            try
            {
                

            }
            catch
            {

            }

            parent.rulesAnalyzerImproved.makeLog();
            parent.rulesAnalyzerImproved.makeUserProfileLog();
            parent.rulesAnalyzerImproved.makeAllMistakeLogFiles();

            sumControl = new SummarizationPopup();
            myCanvas.Children.Add(sumControl);
            Canvas.SetLeft(sumControl, 20);
            Canvas.SetTop(sumControl, 20);
            sumControl.mostCorrectedMistakeLabel.Content = parent.rulesAnalyzerImproved.mostRepeatedCorrection;
            sumControl.mostRepeatedMistakeLabel.Content = parent.rulesAnalyzerImproved.mostRepeatedMistake;
            sumControl.mostRepeatedMetaMistakeLabel.Content = parent.rulesAnalyzerImproved.mostRepeatedMetaMistake;
            sumControl.mostCorrectedMetaMistakeLabel.Content = parent.rulesAnalyzerImproved.mostRepeatedMetaCorrection;
            sumControl.CloseSummarizationPopupButton.Click += finishPresentation_Click;
            //parent.closeFreeStyleMode();
            
            //parent.loadMode();
        }
        //button click for returning to presentation after pause
        private void GoBackButtonPause_Click(object sender, RoutedEventArgs e)
        {


            if (pauseControl != null)
            {
                pauseControl.GoBackButton.Click -= GoBackButtonPause_Click;
                myCanvas.Children.Remove(pauseControl);
                pauseControl = null;
            }

            // myState = currentState.play;
             setGhostMovingInvisible();
             setOldTextInvisible();
             setGhostInvisible();
             setFeedbackTextInvisible();
        //    textFeedback.FeedbackIMG.Visibility = Visibility.Visible;

            countdown.startAnimation();
            //parent.rulesAnalyzerFIFO.lastFeedbackTime = DateTime.Now.TimeOfDay.TotalMilliseconds;
            //parent.rulesAnalyzerFIFO.resetAfterPause();

            parent.rulesAnalyzerImproved.lastFeedbackTime = DateTime.Now.TimeOfDay.TotalMilliseconds;
            parent.rulesAnalyzerImproved.resetAfterPause();
        }
        //shows 3 second countdown for pausing
        void countdownPause_countdownFinished(object sender)
        {
            myState = currentState.stop;
            pauseControl = new PauseControl();
            myCanvas.Children.Add(pauseControl);
            Canvas.SetLeft(pauseControl, 20);
            Canvas.SetTop(pauseControl, 20);
            pauseControl.GoBackButton.Click+=GoBackButtonPause_Click;
            pauseControl.GoMainMenu.Click+=GoMainMenu_Click;            

        }