예제 #1
0
        /// <summary>
        /// Checkout Node
        /// lck: true for checkout, false for snap
        /// </summary>
        private void ACTION_CheckOutNode(bool lck = true)
        {
            if (CONTEXT_XML_NODE.IsChargedOut)
            {
                MessageBox.Show("Node is already checked out", "Error", MessageBoxButtons.OK);
                return;
            }

            // Prompt directory
            string st = VSUILib.VSUICommonFunctions.SelectPath(DEFX.KEY_SNAP, "Select target directory");

            if (st != "")
            {
                bool state = true;

                if (lck)
                {
                    tsNode.Text = "Charging out " + CONTEXT_XML_NODE.Name + " ...";
                }
                else
                {
                    tsNode.Text = "Exporting " + CONTEXT_XML_NODE.Name + " ...";
                }

                Application.DoEvents();

                cont.Begin();
                try
                {
                    if (lck)
                    {
                        CONTEXT_XML_NODE.ChargeOut(st);
                    }
                    else
                    {
                        CONTEXT_XML_NODE.Export(st);
                    }
                }
                catch (VXmlException e1)
                {
                    MessageBox.Show(e1.Message, "Error", MessageBoxButtons.OK);
                    state = false;
                }
                cont.Commit();
                if (state)
                {
                    SELECT_Node();
                    string op = lck ? "Check Out" : "Snap";
                    MessageBox.Show(op + " completed, GUID=" + CONTEXT_XML_NODE.GUID, "Successful", MessageBoxButtons.OK);
                }
            }
        }