public void SetImage()
 {
     ActiveIO.NewImage();
     if (!timerWindow.SetImage(new Uri(ActiveIO.TempImgPath)))
     {
         ActiveIO.ShowMessage("The Image is invalid.");
     }
 }
        public bool GetResults(List <Pairing> pairings, string buttonGetResultsText, bool CutIsEnabled, bool update = false, bool end = false)
        {
            if (update)
            {
                ActiveTournament.GetResults(pairings, true);
                return(true);
            }
            if (pairings.Count == 1)
            {
                end = true;
            }
            bool allResultsEdited = true;

            if (ActiveTournament.Rule.IsDrawPossible || ActiveTournament.bonus)
            {
                foreach (Pairing p in pairings)
                {
                    if (!p.ResultEdited)
                    {
                        allResultsEdited = false;
                        break;
                    }
                }
            }
            if (allResultsEdited)
            {
                if (CheckResults(pairings) || ActiveTournament.bonus)
                {
                    ActiveTournament.GetResults(pairings);
                }
                else
                {
                    ActiveIO.ShowMessage("One ore more results are invalid.");
                    return(false);
                }
            }
            else
            {
                ActiveIO.ShowMessage("There is a result missing.");
                return(false);
            }

            if (end)
            {
                if (!ActiveTournament.CutStarted)
                {
                    ActiveTournament.CalculateWonBye();
                }
                //DataGridPairing.Visibility = System.Windows.Visibility.Hidden;
                //ChangeGUIState(false, true);
            }
            else
            {
                //ChangeGUIState(false);
            }
            ActiveTournament.Sort();
            return(true);
        }
        public void StartTimer(string startTime)
        {
            bool timeOK = startTime == "";

            if (timeOK)
            {
                ActiveTimer.StartTimer();
            }
            else
            {
                int pos = startTime.IndexOf(':');
                int check = startTime.LastIndexOf(':');
                int starthour = 0, startmin = 0;
                timeOK = true;
                if (pos != check)
                {
                    timeOK = false;
                }
                if (pos >= 3 || pos == 0)
                {
                    timeOK = false;
                }
                if ((pos == 1 && startTime.Length >= 5) || startTime.Length >= 6)
                {
                    timeOK = false;
                }
                try
                {
                    starthour = Int32.Parse(startTime.Substring(0, pos));
                }
                catch (Exception)
                {
                    timeOK = false;
                }
                try
                {
                    startmin = Int32.Parse(startTime.Substring(pos + 1));
                }
                catch (Exception)
                {
                    timeOK = false;
                }
                if (timeOK)
                {
                    ActiveTimer.StartTimer(starthour, startmin);
                }
                else
                {
                    ActiveIO.ShowMessage("The Time is only allowed in the format HH:MM.");
                }
            }
        }
 public bool StartTournament(string buttonGetResultsText, bool CutIsEnabled)
 {
     if (ActiveTournament.Participants.Count != 0)
     {
         firststart = true;
         Started    = true;
         ActiveIO.Save(ActiveTournament, true, buttonGetResultsText, CutIsEnabled, "TournamentStart");
         return(true);
     }
     else
     {
         ActiveIO.ShowMessage("Tournament can't be started without player");
         return(false);
     }
 }