示例#1
0
        private void EnterAShrineToEditBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }

            _shrineToEdit = enterAShrineToEditBox.Text;

            if (_shrineNames.Contains(_shrineToEdit))
            {
                for (int i = 0; i < _shrineNames.Count; i++)
                {
                    if (_shrineToEdit == _shrineNames[i])
                    {
                        _shrineIndex = i;
                    }
                }
                DisplayData.ShowShrineInfo(_shrineToEdit, _allShrines, editDetailBox);
                DisplayDefaultEditControls();
                dataToEditDropDown.SelectedIndex = -1;
            }
            else
            {
                MessageBox.Show("That's not a valid shrine name. Try again.");
            }
        }
示例#2
0
        private void Submit_Click(object sender, EventArgs e)
        {
            switch (completionTypeDropDown.Items.Count)
            {
            case 3:
                switch (completionTypeDropDown.SelectedIndex)
                {
                case 0:
                    _newType = "Blessing";
                    break;

                case 1:
                    _newType = "Combat";
                    break;

                default:
                    _newType = "Puzzle";
                    break;
                }

                EditData.ChangeType(_newType, ref _allShrines, _shrineIndex);
                break;

            case 2:
                _newCompletion = completionTypeDropDown.SelectedIndex == 0;
                EditData.ChangeCompletion(_newCompletion, ref _allShrines, _shrineIndex);
                break;
            }

            switch (dataToEditDropDown.SelectedIndex)
            {
            case 0:
                _updatedDetails = editDetailsBox.Text;
                EditData.ChangeDescription(_updatedDetails, ref _allShrines, _shrineIndex);
                break;

            case 3:
                _updatedDetails = editDetailsBox.Text;
                EditData.ChangeNotes(_updatedDetails, ref _allShrines, _shrineIndex);
                break;
            }

            submit.HideControl();
            changesSaved.ShowControl();
            editDetailsBox.Clear();
            completionTypeDropDown.SelectedIndex = -1;

            DisplayData.ShowShrineInfo(_shrineToEdit, _allShrines, editDetailBox);
            Xml.SaveChanges(_allShrines);
        }
示例#3
0
        private void TypeCompletionSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (viewByDropDown.SelectedIndex)
            {
            case 2:
                switch (typeCompletionSelection.SelectedIndex)
                {
                case 0:
                    DisplayData.ShowAllShrinesOfType("Blessing", _allShrines, viewDetailBox);
                    break;

                case 1:
                    DisplayData.ShowAllShrinesOfType("Combat", _allShrines, viewDetailBox);
                    break;

                case 2:
                    DisplayData.ShowAllShrinesOfType("Puzzle", _allShrines, viewDetailBox);
                    break;

                default:
                    throw new Exception("How did this happen? There are only 3 type cases...");
                }

                break;

            case 3:
            {
                viewDetailBox.Text  = typeCompletionSelection.SelectedIndex == 0 ? "Completed " : "Incomplete ";
                viewDetailBox.Text += "shrines: " + Environment.NewLine;

                foreach (Shrine shrine in _allShrines)
                {
                    switch (typeCompletionSelection.SelectedIndex)
                    {
                    case 0 when shrine.Completed:
                    case 1 when shrine.Completed == false:
                        viewDetailBox.Text += $"{shrine.Name} - {shrine.Region}{Environment.NewLine}";
                        break;
                    }
                }

                break;
            }
            }
        }
示例#4
0
        private void ViewByDropDown_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetViewForm();
            switch (viewByDropDown.SelectedIndex)
            {
            case 0:
                queryLabel.Text = "Enter a shrine name below:";
                AutoCompleteTextBox(queryInputTextBox, _shrineNames);
                break;

            case 1:
                queryLabel.Text = "Enter a region below:";
                AutoCompleteTextBox(queryInputTextBox, _regions);
                break;

            case 2:
                SetViewTypeCompletionControls();
                queryLabel.Text = "Enter a shrine type below:";
                typeCompletionSelection.Items.Add("Blessing");
                typeCompletionSelection.Items.Add("Combat");
                typeCompletionSelection.Items.Add("Puzzle");
                break;

            case 3:
                SetViewTypeCompletionControls();
                queryLabel.Text = "Select search-by option from dropdown list below: ";
                typeCompletionSelection.Items.Add("Yes");
                typeCompletionSelection.Items.Add("No");
                break;

            case 4:
                queryLabel.Text = "Search for ____ in Shrine notes: ";
                DisplayData.ShowNotes(_allShrines, viewDetailBox);
                break;

            default:
                throw new Exception("How did this happen? There are only 5 View-By selections...");
            }
        }
示例#5
0
        private void QueryInputTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }

            _queryInput = queryInputTextBox.Text;

            if (_shrineNames.Contains(_queryInput))
            {
                DisplayData.ShowShrineInfo(_queryInput, _allShrines, viewDetailBox);
            }
            else if (_regions.Contains(_queryInput))
            {
                DisplayData.ShowShrinesInARegion(_queryInput, _allShrines, viewDetailBox);
            }
            else
            {
                DisplayData.ShowNotes(_queryInput, _allShrines, viewDetailBox);
            }
        }