public ToolBoxWindowSettings() { expanderList = ExpanderData.LoadUserData(); InitializeComponent(); ListViewGroups.ItemsSource = expanderList; }
private void ButtonUpdateItem_Click(object sender, RoutedEventArgs e) { if ((ListViewElements.SelectedItem != null) && (ListViewElements.SelectedItem is ToolBoxItem)) { ToolBoxItem item = ListViewElements.SelectedItem as ToolBoxItem; if (item != null) { //Находим группу которой принадлежит выделенный элемент ExpanderData selectedGroup = null; foreach (ExpanderData data in expanderList) { if (data.Items.Contains(item)) { selectedGroup = data; break; } } ToolBoxItemProperty tprop = new ToolBoxItemProperty(item); if (tprop.ShowDialog() == true) { ListViewElements.ItemsSource = null; selectedGroup.Items.Remove(item); selectedGroup.Items.Add(tprop.ToolBoxItem); ListViewElements.ItemsSource = selectedGroup.Items; } } } }
public ToolBoxItemProperty(ExpanderData expanderData) { ToolBoxItem = new ToolBoxItem(expanderData); InitializeComponent(); Title = "New ToolboxItem Data"; LoadIcons(); ComboBoxIconPath.SelectedIndex = 0; }
private void LoadAllData() { string CurDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); expanderList = ExpanderData.LoadUserData(); expanderList.AddRange(ExpanderData.LoadSystemData()); }
private void ListViewGroupClick(object sender, MouseButtonEventArgs e) { ExpanderData data = ((ListViewItem)sender).Content as ExpanderData; if (data != null) { ListViewElements.ItemsSource = data.Items; } }
public ExpanderItem() { ExpanderData = new ExpanderData(); InitializeComponent(); Title = "New Expander Data"; LoadIcons(); ComboBoxIconPath.SelectedIndex = 0; ComboBoxTypeOfElements.ItemsSource = ExpanderData.TypeOfElementsAlloved; ComboBoxTypeOfElements.SelectedItem = ExpanderData.TypeOfElements; }
private void ButtonNewGroup_Click(object sender, RoutedEventArgs e) { ExpanderItem window = new ExpanderItem(); if (window.ShowDialog() == true) { ExpanderData data = window.ExpanderData; expanderList.Add(data); ListViewGroups.ItemsSource = null; ListViewGroups.ItemsSource = expanderList; } }
private void ButtonDeleteGroup_Click(object sender, RoutedEventArgs e) { if ((ListViewGroups.SelectedItem != null) && (ListViewGroups.SelectedItem is ExpanderData)) { ExpanderData data = ListViewGroups.SelectedItem as ExpanderData; if (data != null) { expanderList.Remove(data); ListViewGroups.ItemsSource = null; ListViewGroups.ItemsSource = expanderList; ListViewElements.ItemsSource = null; } } }
private void ButtonNewItem_Click(object sender, RoutedEventArgs e) { if ((ListViewGroups.SelectedItem != null) && (ListViewGroups.SelectedItem is ExpanderData)) { ExpanderData selectedGroup = ListViewGroups.SelectedItem as ExpanderData; if (selectedGroup != null) { ToolBoxItemProperty tprop = new ToolBoxItemProperty(selectedGroup); if (tprop.ShowDialog() == true) { ListViewElements.ItemsSource = null; selectedGroup.Items.Add(tprop.ToolBoxItem); ListViewElements.ItemsSource = selectedGroup.Items; } } } }
private void ButtonUpdateGroup_Click(object sender, RoutedEventArgs e) { if ((ListViewGroups.SelectedItem != null) && (ListViewGroups.SelectedItem is ExpanderData)) { ExpanderData data = ListViewGroups.SelectedItem as ExpanderData; if (data != null) { ExpanderItem window = new ExpanderItem(data); if (window.ShowDialog() == true) { ExpanderData newdata = window.ExpanderData; expanderList.Remove(data); expanderList.Add(newdata); ListViewGroups.ItemsSource = null; ListViewGroups.ItemsSource = expanderList; } } } }
public static List <ExpanderData> LoadDatafromXml(System.IO.Stream stream) { List <ExpanderData> res = new List <ExpanderData>(); try { XmlDocument _doc = new XmlDocument(); _doc.Load(stream); XmlNodeList nodes = _doc.SelectNodes("/ExpanderList/ExpanderData"); foreach (XmlNode node in nodes) { ExpanderData data = new ExpanderData(); data.Caption = node.SelectSingleNode("Caption").InnerText; data.IconPath = node.SelectSingleNode("IconPath").InnerText; data.Description = node.SelectSingleNode("Description").InnerText; data.TypeOfElements = node.SelectSingleNode("TypeOfElements").InnerText; XmlNodeList EdpanderDataItems = node.SelectNodes("ToolBoxItem"); foreach (XmlNode nodeitem in EdpanderDataItems) { ToolBoxItem item = new ToolBoxItem(data); item.Caption = nodeitem.SelectSingleNode("Caption").InnerText; item.Command = nodeitem.SelectSingleNode("Command").InnerText; item.Description = nodeitem.SelectSingleNode("Description").InnerText; item.IconPath = nodeitem.SelectSingleNode("IconPath").InnerText; data.items.Add(item); } res.Add(data); } } catch (Exception ex) { Schematix.Core.Logger.Log.Error("Load ToolBox data error.", ex); return(res); } return(res); }
public ExpanderItem(ExpanderData ExpanderData) { this.ExpanderData = ExpanderData; InitializeComponent(); Title = "Update Expander Data For " + ExpanderData.Caption; TextBoxCaption.Text = ExpanderData.Caption; TextBoxDescription.Text = ExpanderData.Description; LoadIcons(); for (int i = 0; i < ExpanderData.Icons.Length; i++) { if (ExpanderData.Icons[i].Equals(ExpanderData.GetOriginalIconPath())) { ComboBoxIconPath.SelectedIndex = i; break; } } ComboBoxTypeOfElements.ItemsSource = ExpanderData.TypeOfElementsAlloved; ComboBoxTypeOfElements.SelectedItem = ExpanderData.TypeOfElements; }
public ToolBoxItem(ExpanderData expanderData) { this.expanderData = expanderData; }
private void ButtonOK_Click(object sender, RoutedEventArgs e) { ExpanderData.SaveToXML(expanderList); DialogResult = true; Close(); }