private void Export_Click(object sender, RoutedEventArgs e) { string fileName = ""; if ((bool)ExportDelimited.IsChecked) { exportDelimited(out fileName); } else //xml { } if ((bool)AutoLaunch.IsChecked && fileName.Length > 0) { try { System.Diagnostics.Process.Start(fileName); } catch (Exception ex) { ApplicationEx.DebugException(ex); } } }
public void PublishData(XElement publishElement) { this.Items.Clear(); myItemList = null; if (Common.boolValue(publishElement.GetAttribute("clearOnly"))) { return; } // Get the type and row nodes XElement typeNodes = null; XElement rowNodes = null; XElement childNode = (XElement)publishElement.FirstNode; while (childNode != null) { if (childNode.Name == "Types") { typeNodes = childNode; } else if (childNode.Name == Common.Data.Rows) { rowNodes = childNode; } childNode = (XElement)childNode.NextNode; } if (rowNodes == null) { return; } // The server may indicate the ID and type of node to select string selectedType = ((XElement)rowNodes).GetAttribute("selectedType"); int selectedId = myValue; if (((XElement)rowNodes).GetAttribute("selectedId").Length > 0) { selectedId = int.Parse(((XElement)rowNodes).GetAttribute("selectedId")); } TreeViewItemEx selectedNode = null; // Add the branches to the tree, setting the selectedNode if it is in the branch XElement rowNode = (XElement)rowNodes.FirstNode; while (rowNode != null) { TreeViewItemEx treeBranch = ProcessTreeBranch(rowNode, typeNodes, selectedType, selectedId, ref selectedNode); this.Items.Add(treeBranch); this.ItemList.Add(treeBranch.ID, treeBranch); rowNode = (XElement)rowNode.NextNode; } // Select the selectedNode, or the first node if selectedNode is null try { if (selectedNode == null && Items.Count > 0) { ((TreeViewItemEx)this.Items[0]).IsExpanded = true; } if (selectedNode != null) { selectedNode.IsSelected = true; } } catch (Exception ex) { ApplicationEx.DebugException(ex); } }