Beispiel #1
0
 /*
  * Button start click event handler
  */
 private void ButtonStart_Click(object sender, RoutedEventArgs e)
 {
     //Return to the start panel
     ReturnToStartEvent?.Invoke();
 }
Beispiel #2
0
        /*
         * Updated the picture shown
         */
        private void UpdatePicture()
        {
            //Disable the selection button
            buttonSelect.IsEnabled = false;

            //Get a new image file path
            string sFilePath = IPictureManager.Instance.GetRandomPicture();

            //Check if there are any pictures left
            if (!string.IsNullOrEmpty(sFilePath))
            {
                //Get the GPS information and check if it exists
                bool bInfo = IPictureManager.Instance.GetImageInfo(out coordsPicture, out Rotation iRotation);
                switch (iMode)
                {
                case GameMode.Normal:
                    //Set the new image
                    SetImage(sFilePath, iRotation);

                    //Check if the GPS information has been found
                    if (!bInfo)
                    {
                        //Ask if the user wants to add the information
                        MessageBoxResult iResult = MessageBox.Show(Properties.Resources.Main_textSetInfoGPS, "JapanGuessr", MessageBoxButton.YesNo);
                        switch (iResult)
                        {
                        case MessageBoxResult.Yes:
                            //Set the coordinates selection flag
                            bSaveCoords = true;

                            //Enable the selection button
                            buttonSelect.IsEnabled = true;
                            break;

                        case MessageBoxResult.No:
                            //Set a new picture
                            UpdatePicture();
                            break;
                        }
                    }
                    break;

                case GameMode.OnlyGPS:
                    //Check if the GPS information has been found
                    if (bInfo)
                    {
                        //Set the new image
                        SetImage(sFilePath, iRotation);
                    }
                    else
                    {
                        //Try with a new picture
                        UpdatePicture();
                    }
                    break;

                case GameMode.AddGPS:
                    //Check if the GPS information has been found
                    if (bInfo)
                    {
                        //Try with a new picture
                        UpdatePicture();
                    }
                    else
                    {
                        //Set the new image
                        SetImage(sFilePath, iRotation);

                        //Enable the selection button
                        buttonSelect.IsEnabled = true;
                    }
                    break;
                }
            }
            else
            {
                //Show the no pictures left dialog
                MessageBox.Show(Properties.Resources.Main_textNoPicturesLeft, "JapanGuessr", MessageBoxButton.OK);

                //Return to the start panel
                ReturnToStartEvent?.Invoke();
            }
        }