private void ToolItem_Click(object sender, RoutedEventArgs e) { foreach (var item in Tools.Children.OfType <ToolItem>()) { if (item.Name == ((ToolItem)sender).Name) { if (_currentTool == item.Name) { item.Active = false; _currentTool = ""; ToolDeActive?.Invoke(item.Name); } else { item.Active = true; _currentTool = item.Name; ToolActive?.Invoke(item.Name); } continue; } if (item.Active) { ToolDeActive?.Invoke(item.Name); } item.Active = false; } }
private void GoCenter_Click(object sender, RoutedEventArgs e) { ToolActive?.Invoke(((ToolItem)sender).Name); CancelToolItem(((ToolItem)sender).Name); }