Ejemplo n.º 1
0
Archivo: GUI.cs Proyecto: VicBoss/KR
        private void openMiClicked(Object sender, EventArgs e)
        {
            if (changesMade)
            {
                DialogResult result = discardChangesDialog();
                if (result == DialogResult.No)
                {
                    saveMiClicked(new object(), new EventArgs());
                }
                else if (result == DialogResult.Cancel)
                    return;
            }
            OpenFileDialog openFD = new OpenFileDialog();
            openFD.Filter = "Dialog (*.xml)|*.xml";
            openFD.RestoreDirectory = true;
            DialogResult dialogResult = openFD.ShowDialog();
            if (dialogResult == DialogResult.OK)
            {
                fileName = openFD.FileName.ToString();
                conversation = MyXml.load(fileName);
                NpcIdGenerator = new IdGenerator();
                DialogNode[] nodes = conversation.getDialog();
                for (int i = 0; i < nodes.Length; i++)
                    NpcIdGenerator.addId(nodes[i].id);

                this.Text = "Dialog Manager - " + conversation.npcName;
                treeListView.Roots = new ArrayList(conversation.
                    getRootNodes());
                treeListView.ExpandAll();
                changesMade = false;
            }
        }
Ejemplo n.º 2
0
Archivo: GUI.cs Proyecto: VicBoss/KR
        private void newMiClicked(Object sender, EventArgs e)
        {
            DialogResult result;
            if (changesMade)
            {
                result = discardChangesDialog();
                if (result == DialogResult.No)
                {
                    saveMiClicked(new object(), new EventArgs());
                }
                else if (result == DialogResult.Cancel)
                    return;
            }
            Conversation newCon = new Conversation("");
            DialogProperties dp = new DialogProperties(ref newCon);
            dp.Text = "New Dialog";
            result = dp.ShowDialog(this);
            if (result == DialogResult.Cancel)
                return;

            conversation = newCon;
            treeListView.ClearObjects();
            NpcIdGenerator = new IdGenerator();
            fileName = "";
            this.Text = "Dialog Manager - " + conversation.npcName;
            changesMade = false;
        }