Exemplo n.º 1
0
        private void EncEntryBtn_Click(object sender, EventArgs e)
        {
            if (this.SelectedCreature == null && this.SelectedNPC == null)
            {
                return;
            }
            Guid              guid = (this.SelectedNPC != null ? this.SelectedNPC.ID : this.SelectedCreature.ID);
            string            str  = (this.SelectedNPC != null ? this.SelectedNPC.Name : this.SelectedCreature.Name);
            string            str1 = (this.SelectedNPC != null ? "People" : "Creatures");
            EncyclopediaEntry encyclopediaEntry = Session.Project.Encyclopedia.FindEntryForAttachment(guid);

            if (encyclopediaEntry == null)
            {
                if (MessageBox.Show(string.Concat(string.Concat(string.Concat("There is no encyclopedia entry associated with ", str, "."), Environment.NewLine), "Would you like to create one now?"), "Masterplan", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
                encyclopediaEntry = new EncyclopediaEntry()
                {
                    Name         = str,
                    AttachmentID = guid,
                    Category     = str1
                };
                Session.Project.Encyclopedia.Entries.Add(encyclopediaEntry);
                Session.Modified = true;
            }
            int entry = Session.Project.Encyclopedia.Entries.IndexOf(encyclopediaEntry);
            EncyclopediaEntryForm encyclopediaEntryForm = new EncyclopediaEntryForm(encyclopediaEntry);

            if (encyclopediaEntryForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Session.Project.Encyclopedia.Entries[entry] = encyclopediaEntryForm.Entry;
                Session.Modified = true;
            }
        }
Exemplo n.º 2
0
        private void EntryBtn_Click(object sender, EventArgs e)
        {
            if (this.SelectedHero == null)
            {
                return;
            }
            EncyclopediaEntry encyclopediaEntry = Session.Project.Encyclopedia.FindEntryForAttachment(this.SelectedHero.ID);

            if (encyclopediaEntry == null)
            {
                if (MessageBox.Show(string.Concat(string.Concat("There is no encyclopedia entry associated with this PC.", Environment.NewLine), "Would you like to create one now?"), "Masterplan", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
                encyclopediaEntry = new EncyclopediaEntry()
                {
                    Name         = this.SelectedHero.Name,
                    AttachmentID = this.SelectedHero.ID,
                    Category     = "People"
                };
                Session.Project.Encyclopedia.Entries.Add(encyclopediaEntry);
                Session.Modified = true;
            }
            int entry = Session.Project.Encyclopedia.Entries.IndexOf(encyclopediaEntry);
            EncyclopediaEntryForm encyclopediaEntryForm = new EncyclopediaEntryForm(encyclopediaEntry);

            if (encyclopediaEntryForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Session.Project.Encyclopedia.Entries[entry] = encyclopediaEntryForm.Entry;
                Session.Modified = true;
            }
        }
        private void EncEntryBtn_Click(object sender, EventArgs e)
        {
            if ((SelectedCreature == null) && (SelectedNPC == null))
            {
                return;
            }

            Guid   id   = (SelectedNPC != null) ? SelectedNPC.ID : SelectedCreature.ID;
            string name = (SelectedNPC != null) ? SelectedNPC.Name : SelectedCreature.Name;
            string cat  = (SelectedNPC != null) ? "People" : "Creatures";

            EncyclopediaEntry entry = Session.Project.Encyclopedia.FindEntryForAttachment(id);

            if (entry == null)
            {
                // If there is no entry, ask to create it
                string msg = "There is no encyclopedia entry associated with " + name + ".";
                msg += Environment.NewLine;
                msg += "Would you like to create one now?";
                if (MessageBox.Show(msg, "Masterplan", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                entry              = new EncyclopediaEntry();
                entry.Name         = name;
                entry.AttachmentID = id;
                entry.Category     = cat;

                Session.Project.Encyclopedia.Entries.Add(entry);
                Session.Modified = true;
            }

            // Edit the entry
            int index = Session.Project.Encyclopedia.Entries.IndexOf(entry);
            EncyclopediaEntryForm dlg = new EncyclopediaEntryForm(entry);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Session.Project.Encyclopedia.Entries[index] = dlg.Entry;
                Session.Modified = true;
            }
        }
Exemplo n.º 4
0
        private void LocationEntry_Click(object sender, EventArgs e)
        {
            if (MapPanel.SelectedLocation == null)
            {
                return;
            }

            EncyclopediaEntry entry = Session.Project.Encyclopedia.FindEntryForAttachment(MapPanel.SelectedLocation.ID);

            if (entry == null)
            {
                // If there is no entry, ask to create it
                string msg = "There is no encyclopedia entry associated with this location.";
                msg += Environment.NewLine;
                msg += "Would you like to create one now?";
                if (MessageBox.Show(msg, "Masterplan", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                entry              = new EncyclopediaEntry();
                entry.Name         = MapPanel.SelectedLocation.Name;
                entry.AttachmentID = MapPanel.SelectedLocation.ID;
                entry.Category     = MapPanel.SelectedLocation.Category;
                if (entry.Category == "")
                {
                    entry.Category = "Places";
                }

                Session.Project.Encyclopedia.Entries.Add(entry);
                Session.Modified = true;
            }

            // Edit the entry
            int index = Session.Project.Encyclopedia.Entries.IndexOf(entry);
            EncyclopediaEntryForm dlg = new EncyclopediaEntryForm(entry);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Session.Project.Encyclopedia.Entries[index] = dlg.Entry;
                Session.Modified = true;
            }
        }