private void buttonEdit_Click(object sender, RoutedEventArgs e)
 {
     if (SelectedResource != null)
     {
         int index  = 0;
         int brojac = -1;
         foreach (Resource r in Resources)
         {
             brojac++;
             if (r.Id.Equals(SelectedResource.Id))
             {
                 index = brojac;
             }
         }
         IndexesForUndo.Add(index);
         Resource resource = new Resource(SelectedResource);
         ResourcesForUndo.Add(resource);
         EditResource editResource = new EditResource(SelectedResource.Id, tw);
         editResource.Show();
     }
     else
     {
         MessageBox.Show("Molimo, odaberite resurs za ažuriranje", "Ažuriranje resursa");
     }
 }
        private void buttonDelete_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                Resource forDelete = new Resource(SelectedResource);
                ResourcesForUndo.Add(forDelete);
                tw.database.DeleteResource(forDelete);
                tw.addToResourcesToShow();
                tw.ResourcePins_Draw();
            }


            /*
             * DeleteResourceConfirmation d = new DeleteResourceConfirmation(SelectedResource.Id);
             * d.Show();
             */
        }