示例#1
0
        public override void Selected(GUI.Selection selection)
        {
            bool promptQuit = false;

            GUI.ListBox listBox = selection.RowIndex switch
            {
                0 => BackedUpLevelsList,
                1 => BackedUpScriptsList,
                _ => throw new NotImplementedException(),
            };
            CommandsList.HighlightCurrentItem();
            listBox.Clear();
            listBox.Draw();
            listBox.NavigateToDefault();
            while (!promptQuit)
            {
                var subSelection = BackedUpLevelsList.PromptSelection();
                if (subSelection.Command == Properties.Command.Cancel)
                {
                    promptQuit = true;
                }
            }

            CommandsList.SelectCurrentItem();
            DetailsTextBox.Clear();
            WriteSummary();
        }
示例#2
0
 public void WriteSummary()
 {
     DetailsTextBox.ClearContent();
     DetailsTextBox.WriteLine(Text.LevelBackupsCount);
     DetailsTextBox.WriteLine(backedUpLevels.Length.ToString());
     DetailsTextBox.WriteLine();
     DetailsTextBox.WriteLine(Text.ScriptBackupsCount);
     DetailsTextBox.WriteLine(backedUpScripts.Length.ToString());
 }
示例#3
0
        // Fixes the size of the contents of the window when the window is resized.
        private void FixSize()
        {
            const int pad    = 15;
            int       x      = ClientRectangle.X + pad;
            int       y      = ClientRectangle.Y + pad;
            int       width  = ClientRectangle.Width - (2 * pad);
            int       height = ClientRectangle.Height - (2 * pad);

            DetailsTextBox.SetBounds(x, y, width, height);
        }
示例#4
0
 public void WriteSummary()
 {
     DetailsTextBox.ClearContent();
     DetailsTextBox.WriteLine(Text.SaveManagerWindowCurrentSave);
     DetailsTextBox.WriteLine(currentSavedMapName);
     DetailsTextBox.WriteLine();
     DetailsTextBox.WriteLine(Text.SaveManagerWindowBackupsCount);
     DetailsTextBox.WriteLine(backedUpSaves.Count.ToString());
     DetailsTextBox.WriteLine();
     DetailsTextBox.WriteLine(Text.SaveManagerWindowAutoBackupStatus);
     DetailsTextBox.WriteLine(Program.manageSaves ? Text.Enabled : Text.Disabled);
 }
 private void ViewModel_ReportFormFlushRequested(object sender, EventArgs e)
 {
     // The report TextBox doesn't update its source binding if it's focused.
     // If it is currently focused, request an immediate update of the binding.
     if (DetailsTextBox != null && FocusManager.GetFocusedElement() == DetailsTextBox)
     {
         BindingExpression expr = DetailsTextBox.GetBindingExpression(TextBox.TextProperty);
         if (expr != null)
         {
             expr.UpdateSource();
         }
     }
 }
示例#6
0
 private void MapListSelectionChanged(object Sender, GUI.SelectionChangedEventArgs eventArgs)
 {
     if (ignoreNextSelectionChangedEvent)
     {
         ignoreNextSelectionChangedEvent = false;
     }
     else
     {
         if (eventArgs.SelectedItemIndex <= 2)
         {
             DetailsTextBox.ClearContent();
         }
         else
         {
             Map map = ((GUI.SelectableMap)eventArgs.SelectedItem).Map;
             DetailsTextBox.WriteAllMapInfo(map);
             LogTextBox.WriteMapIssues(map);
         }
     }
 }
示例#7
0
 private void ClearData_Click(object sender, RoutedEventArgs e)
 {
     activeSkiRun.ClearCompData();             //Calls a method in the SkiRun class which empties the dictionary and the lists.
     IncomeTextBox.Clear();                    //Clears the income textbox.
     TotalScoresTextBox.Clear();               //Clears the total scores text box.
     EntriesTextBox.Clear();                   //Clears the ammount of entries the competiton had.
     TopThreeScoresTextBox.Clear();            //Clears the high scores text box so data doesn't overlap.
     AgeMinTextBox.Clear();                    //Clears the minimum age textbox.
     AgeMaxTextBox.Clear();                    //Clears the maximum age textbox.
     AgeAveTextBox.Clear();                    //Clears the average age textbox.
     AgeModeTextBox.Clear();                   //Clears the mode age textbox.
     activeSkiRun.CompetitorAges.Clear();      //Clears the ages list.
     CompetitorNumberTextBox.Text = "000000";  //Resets the competitor number text box.
     NumberTextBox.Clear();                    //Clears the number text box.
     NameTextBox.Clear();                      //Clears the name text box.
     AddressTextBox.Clear();                   //Clears the address text box.
     DetailsTextBox.Clear();                   //Clears the details text box.
     ScoreTextBox.Clear();                     //Clears the scores text box.
     SearchTextBox.Clear();                    //Clears the seach by name text box.
     TagTextBox.Clear();                       //Clears the tag text box.
     SearchByName.Items.Clear();               //Clears the search by name combo box.
 }
示例#8
0
 /// <summary>
 /// Sets the text in the text box of the details window.
 /// </summary>
 /// <param name="text">The text to be displayed in the details window.</param>
 public void SetText(string text)
 {
     DetailsTextBox.Clear();
     DetailsTextBox.AppendText(text);
 }
示例#9
0
        private void FindCompetitor()                                                                  //Set up to find the competitors by their number.
        {
            DetailsTextBox.Clear();                                                                    //Clears the details textbox.
            Competitor editSkier;                                                                      //Makes aninstance of the Competitor class.

            if (SearchTextBox.Text.Trim() != "" && NumberTextBox.Text.Trim() != "")                    //You can only use on search method so if there is text in both it will be rejected.
            {
                MessageBox.Show("Please use only one search method!");                                 //The error message.
            }
            else if (SearchByName.Text.Trim() == "" && NumberTextBox.Text.Trim() == "")                //If there is no text in either search methods then the search will fail.
            {
                editSkier = null;                                                                      //There's no competitor.
                MessageBox.Show("There is no competitor with that number or name! Please try again."); //The error message.
                NameTextBox.Clear();                                                                   //Clears the name text box.
                AddressTextBox.Clear();                                                                //Clears the address text box.
                ScoreTextBox.Clear();                                                                  //Clears the score text box.
                NumberTextBox.Clear();                                                                 //Clears number text box.
                TagTextBox.Clear();                                                                    //Clears the tag text box.
            }

            //***NOTE*** - This is a very inefficient way to seach. I have the same code twice for each search method because I didn't know how to differentiate between the two.

            else if (SearchByName.Text.Trim() != "")                          //If search by name has some text in it then it will make a competitor.
            {
                editSkier = SkiRun.FindSkierByName(SearchByName.Text.Trim()); //Calls the find competitor by name in the SkiRun class.
                try
                {
                    NameTextBox.Text    = editSkier.GetName().Trim();                                                                                                                                                                                                                                    //Sets the competitor name.
                    AddressTextBox.Text = editSkier.GetAddress().Trim();                                                                                                                                                                                                                                 //Sets the competitor address.
                    ScoreTextBox.Text   = editSkier.GetScore().Trim();                                                                                                                                                                                                                                   //Sets the competitor score.

                    if (editSkier.GetSponsor() == null && editSkier.GetBlood() == null && editSkier.GetNoK() == null)                                                                                                                                                                                    //If there's no sponsor, no blood type and no next of kin then it must be an amateur.
                    {
                        DetailsTextBox.Text = "Class: Amatuer" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £100";                                                                                                                                   //Information show in details text box.
                        TagTextBox.Text     = "Amateur";                                                                                                                                                                                                                                                 //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetSponsor() != null)                                                                                                                                                                                                                                             //If the sponsor does no equal null then it must be a professional.
                    {
                        DetailsTextBox.Text = "Class: Professional" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £200" + Environment.NewLine + "Sponsor: " + editSkier.GetSponsor();                                                                 //Information show in details text box.
                        TagTextBox.Text     = "Professional";                                                                                                                                                                                                                                            //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetBlood() != null)                                                                                                                                                                                                                                               //If blood type does not equal null then is must be a celebrity.
                    {
                        DetailsTextBox.Text = "Class: Celebrity" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You do not have to pay." + Environment.NewLine + "Blood Type: " + editSkier.GetBlood() + Environment.NewLine + "Next of Kin: " + editSkier.GetNoK(); //Information show in details text box.
                        TagTextBox.Text     = "Celebrity";                                                                                                                                                                                                                                               //Displays the tag in the tag text box.
                    }
                }
                catch
                {
                    MessageBox.Show("Could not find competitor!");  //If the user types a name it cannot find then it will display this.
                }
            }
            else if (NumberTextBox.Text.Trim() != "")                    //If the number text box has something in it then it will use this method.
            {
                editSkier = SkiRun.FindSkier(NumberTextBox.Text.Trim()); //Calls the find competitor in the SkiRun class.
                try
                {
                    NameTextBox.Text    = editSkier.GetName();                                                                                                                                                                                                                                           //Sets the competitor name.
                    AddressTextBox.Text = editSkier.GetAddress();                                                                                                                                                                                                                                        //Sets the competitor address.
                    ScoreTextBox.Text   = editSkier.GetScore();                                                                                                                                                                                                                                          //Sets the competitor score.

                    if (editSkier.GetSponsor() == null && editSkier.GetBlood() == null && editSkier.GetNoK() == null)                                                                                                                                                                                    //If there's no sponsor, no blood type and no next of kin then it must be an amateur.
                    {
                        DetailsTextBox.Text = "Class: Amatuer" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £100";                                                                                                                                   //Information show in details text box.
                        TagTextBox.Text     = "Amateur";                                                                                                                                                                                                                                                 //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetSponsor() != null)                                                                                                                                                                                                                                             //If the sponsor does no equal null then it must be a professional.
                    {
                        DetailsTextBox.Text = "Class: Professional" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £200" + Environment.NewLine + "Sponsor: " + editSkier.GetSponsor();                                                                 //Information show in details text box.
                        TagTextBox.Text     = "Professional";                                                                                                                                                                                                                                            //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetBlood() != null)                                                                                                                                                                                                                                               //If blood type does not equal null then is must be a celebrity.
                    {
                        DetailsTextBox.Text = "Class: Celebrity" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You do not have to pay." + Environment.NewLine + "Blood Type: " + editSkier.GetBlood() + Environment.NewLine + "Next of Kin: " + editSkier.GetNoK(); //Information show in details text box.
                        TagTextBox.Text     = "Celebrity";                                                                                                                                                                                                                                               //Displays the tag in the tag text box.
                    }
                }
                catch
                {
                    MessageBox.Show("Could not find competitor!");  //If the user types a name it cannot find then it will display this.
                }
            }
            //NumberTextBox.Clear();
            //SearchByName.Items.Clear();
            //SearchTextBox.Clear();
        }