private void OnExportXML()
        {
            try
            {
                // Configure save file dialog box
                var dlg = new Microsoft.Win32.SaveFileDialog()
                {
                    FileName   = "Export",         // Default file name
                    DefaultExt = ".xml",           // Default file extension
                    Filter     = "xml files|*.xml" // Filter files by extension
                };

                // Show save file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process save file dialog box results
                if (result.HasValue && result == true)
                {
                    // write data
                    this.CurrentFilePath = dlg.FileName;
                    NodeSerializer.SaveNodeList(this.NManager.Nodes, this.CurrentFilePath);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "XML File Export Error", MessageBoxButton.OK, MessageBoxImage.Error);
                // MessageBox.Show(ex.StackTrace, "EXCEL File Export Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void OnSave(object _mode)
        {
            if (this.NManager == null)
            {
                return;
            }
            if (this.NManager.Nodes == null)
            {
                return;
            }
            if (this.NManager.Nodes.Count == 0)
            {
                return;
            }
            if (_mode == null)
            {
                return;
            }

            string mode = _mode.ToString();

            if (string.IsNullOrEmpty(mode))
            {
                return;
            }

            if (string.Equals(mode, "SAVE_AS") || string.IsNullOrEmpty(this.CurrentFilePath))
            {
                this.OnExportXML();
            }
            else if (string.Equals(mode, "SAVE"))
            {
                this.SavingXMLState = "YES";
                NodeSerializer.SaveNodeList(this.NManager.Nodes, this.CurrentFilePath);
                this.SavingXMLState = "NO";
            }
        }