private void Ok_btn_Click(object sender, RoutedEventArgs e) { if (LayerIndex < 0) { return; } Layer l = Global.project.layers[LayerIndex]; Global.LayersType t = Global.GetLayerType(l); Layer newItem = (Layer)Activator.CreateInstance(Global.GetLayerObject(t)); newItem.CloneCreator(l, txt_name.Text); Global.project.layers.Insert(LayerIndex, newItem); DialogResult = true; }
private void Br_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { foreach (object i in items_view.Children) { if (i is Border o) { o.BorderBrush = Brushes.Transparent; } } Border br = (Border)sender; itemSelected = (Global.LayersType)(int) br.Tag; br.BorderBrush = Brushes.Black; LoadDescription((int)br.Tag); ValidateOperation(); RangePanel.Visibility = (itemSelected == Global.LayersType.Range ? Visibility.Hidden : Visibility.Visible); if (e.ClickCount == 2 && ok_btn.IsEnabled) { Ok_btn_Click(ok_btn, new RoutedEventArgs()); } } }