private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (AddLayerComboBox.SelectedIndex >= 0) { LayerChainItem chainitem = AllLayers[AddLayerComboBox.SelectedIndex]; LayerChainItem cpy = new LayerChainItem(); cpy.Name = chainitem.Name; cpy.FullPath = chainitem.FullPath; LayerChainItems.Add(cpy); if (LayerAdded != null) { LayerAdded(this, e); } } else { AddLayerComboBox.Text = "Add a Layer"; } }
private void AddLayerButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Python Files, Dlls, Directories | *.py; *.dll"; ofd.Multiselect = true; if (ofd.ShowDialog().Value) { foreach (string filename in ofd.FileNames) { LayerChainItem item = new LayerChainItem(); item.Name = System.IO.Path.GetFileName(filename); item.FullPath = System.IO.Path.GetFullPath(filename); item.RelativePath = GetRelativePath(item.FullPath, System.IO.Path.GetFullPath(_layerInterpretLogic.LayerDirectory)); LayerChainItems.Add(item); } if (LayerAdded != null) { LayerAdded(this, e); } } }