private void TypeSelection(object sender, RoutedEventArgs e) { var form = new ResourceTypeSelection(manager, resource); form.ShowDialog(); if (resource.Type == null) { resTypeName.Text = "Tip: Niste izabrali tip!"; resTypeName.Foreground = Brushes.Red; return; } resTypeName.Text = "Tip: " + resource.Type.Name; resTypeName.Foreground = Brushes.Black; // bug ako je null tip }
private void ResourceTypePicker(object sender, RoutedEventArgs e) { Resource resource = dgrMain.SelectedItem as Resource; Resource fake_resource = new Resource(); if (resource == null) { MessageBox.Show("Morate prvo odabrati resurs", "Greška", MessageBoxButton.OK, MessageBoxImage.Error); return; } fake_resource.Type = resource.Type; var form = new ResourceTypeSelection(manager, fake_resource); form.ShowDialog(); resType.Text = "Tip: " + fake_resource.Type.Name; new_resource_type = fake_resource.Type; }