private void buttonImport_Click(object sender, EventArgs e)
        {
            if (tableDialogs.SelectedItems == null || tableDialogs.SelectedItems.Length == 0)
            {
                return;
            }

            CategoryDataSet.CategoryRow row = ((CategoryDataSet.CategoryRow)tableDialogs.SelectedItems[0].Tag);

            DialogDataSet.DialogRow dialogRow;
            if (row == null)
            {
                dialogRow = GetDialogRowFromCategory(0);
            }
            else
            {
                dialogRow = GetDialogRowFromCategory(row.CategoryID);
            }

            OpenFileDialog fileDlg = new OpenFileDialog();

            fileDlg.Filter = StringTable.XmlFileDialogFilter;

            if (fileDlg.ShowDialog(this) == DialogResult.OK)
            {
                // Prüfen, ob es sich um einen Dialog handelt
                string xmlDialog    = File.ReadAllText(fileDlg.FileName);
                string errorMessage = "";

                if (!MainCDUserControl.IsHitbaseDialog(xmlDialog, ref errorMessage))
                {
                    MessageBox.Show(StringTable.NoHitbaseDialog, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                DialogTableAdapter ta = new DialogTableAdapter(dataBase);

                if (dialogRow == null)      // Neu
                {
                    DialogDataSet ds = new DialogDataSet();
                    dialogRow = ds.Dialog.AddDialogRow(row.CategoryID, xmlDialog);
                }
                else
                {
                    dialogRow.DialogXML = xmlDialog;
                }

                ta.Update(dialogRow);

                LoadDialogs();
                FillList();
            }
        }
Exemple #2
0
 public UndoEngine(MainCDUserControl dlg)
 {
     mainWindowControl = dlg;
     depth             = 0;
 }