예제 #1
0
        /// <summary>
        /// Load XML
        /// </summary>
        private void ACTION_LoadXML()
        {
            string fname = VSUICommonFunctions.SelectFile(DEFX.KEY_LOAD_XML, "Select XML file for load", "XML files (*.xml" + ")|*.xml");

            if (fname != "")
            {
                VXmlNode n = cont.GetNode(VSLib.ConvertStringToLong(tvCat.SelectedNode.Name));
                tsNode.Text = "Loading " + fname + " ...";
                Application.DoEvents();
                Cursor.Current = Cursors.WaitCursor;
                cont.Begin();
                string rc = "";
                try
                {
                    if (n.NodeTypeCode == DEFX.NODE_TYPE_DOCUMENT)
                    {
                        VXmlDocument d = (VXmlDocument )cont.GetNode(n.Id);
                        rc = d.Load(fname);
                    }
                    else
                    {
                        rc = n.Load(fname);
                    }
                }
                catch (VXmlException e1)
                {
                    rc = e1.Message;
                }

                if (rc == "")
                {
                    cont.Commit();
                    SHOW_NodeInTree(n);
                }
                else
                {
                    cont.RollBack();
                    MessageBox.Show(rc, "Load error", MessageBoxButtons.OK);
                }
            }
            Cursor.Current = Cursors.Default;
            SELECT_Node();
        }