public void LengthValueChangedTest() { LShapeItem l = new LShapeItem(); int start = 3; Bullnose bullnose = new Bullnose("r"); l.Lengths[start].Type = bullnose; for (int i = start; i < l.Lengths.Count; i++) { Assert.AreEqual(bullnose.Model, l.Lengths[i].Type.Model); } }
private void Initialize() { StreamReader reader = new StreamReader("Bullnoses.xaml"); DependencyObject obj = XamlReader.Load(reader.BaseStream) as DependencyObject; Panel panel = ((System.Windows.Controls.Panel)((obj as Window).Content)); /*foreach (UIElement element in panel.Children) * { * if (element is StackPanel) * { * StackPanel item = element as StackPanel; * string model = (item.Name == null) ? string.Empty : item.Name; * string name = (item.Name == null) ? string.Empty : item.Name; * Bullnose bullnose = new Bullnose(model); * //todo: get the name by get rid of number at behind * bullnoses.Add(new BullnoseViewModel(bullnose, DeepClone(item))); * } * }*/ for (int i = panel.Children.Count - 1; i >= 0; i--) { if (panel.Children[i] is StackPanel) { StackPanel item = panel.Children[i] as StackPanel; string model = (item.Name == null) ? string.Empty : item.Name; string name = (item.Name == null) ? string.Empty : item.Name; Bullnose bullnose = new Bullnose(model); bullnoses.Insert(0, new BullnoseViewModel(bullnose, DeepClone(item))); } panel.Children.RemoveAt(i); } (obj as Window).Close(); }
public BullnoseViewModel(Bullnose bullnose, StackPanel stackPanel) { this.bullnose = bullnose; this.content = stackPanel; }