Esempio n. 1
0
        /// <summary>
        /// </summary>
        private void btnImport_Click(object sender, EventArgs e)
        {
            StartWait();

            this.Invoke((MethodInvoker) delegate
            {
                while (true)
                {
                    openFileDialog1.FileName = "";
                    openFileDialog1.Filter   = "Xml Files|*.xml";

                    if (openFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        // get current node, which should be group
                        var curNode = tvMMD.SelectedNode;

                        if (curNode == null || curNode.Level != 1)
                        {
                            cout("ERROR", "Please choose a Group in the tree where the termset(s) and term(s) will be imported.");
                            break;
                        }

                        // get group from mmd
                        var tGroup = MMDHelper.GetObj(txtSiteUrl.Text, curNode.Level, curNode) as Group;

                        if (!string.IsNullOrEmpty(MMDHelper.errMsg))
                        {
                            cout("ERROR", MMDHelper.errMsg);
                            break;
                        }

                        // get xml content from file
                        var sr            = new StreamReader(openFileDialog1.FileName);
                        string xmlContent = sr.ReadToEnd();
                        sr.Close();

                        var msg = XmlImportHelper.ProcessXml(xmlContent, tGroup, curNode);

                        if (!GenUtil.IsNull(msg))
                        {
                            cout("ERROR", msg);
                            break;
                        }

                        cout("Xml File Imported.");

                        MMDHelper.LoadChildObjects(txtSiteUrl.Text, curNode.Level, curNode);

                        if (!string.IsNullOrEmpty(MMDHelper.errMsg))
                        {
                            cout("ERROR", MMDHelper.errMsg);
                        }
                    }

                    break;
                }
            });

            StopWait();
        }
Esempio n. 2
0
        /// <summary>
        /// Expand current node, load sub nodes (groups, termsets, terms)
        /// </summary>
        void tvMMD_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            StartWait();

            this.Invoke((MethodInvoker) delegate
            {
                MMDHelper.LoadChildObjects(txtSiteUrl.Text, e.Node.Level, e.Node);

                if (!string.IsNullOrEmpty(MMDHelper.errMsg))
                {
                    cout("ERROR", MMDHelper.errMsg);
                }
            });

            StopWait();
        }