Beispiel #1
0
 private void OnSelectedItemChanged(DisplayDER displayDER)
 {
     if (!dragging)
     {
         dragging           = true;
         SelectedDisplayDER = new DisplayDER(displayDER);
         DragDrop.DoDragDrop(listView, SelectedDisplayDER, DragDropEffects.Move);
     }
 }
Beispiel #2
0
        private void fillList()
        {
            foreach (var item in NetworkEntitiesViewModel.DERs.ToList())
            {
                DisplayDER displayDER = new DisplayDER(item);

                DisplayDERs.Add(displayDER);

                checkCanvas(displayDER);
            }
            UpdateCanvasOnViewChange();
        }
Beispiel #3
0
 private void checkCanvas(DisplayDER displayDER)
 {
     for (int i = 1; i < MainCanvas.Children.Count; i++)   // prodi kroz svaki canvas
     {
         Canvas canvas = (Canvas)MainCanvas.Children[i];
         if (canvas.Resources["taken"] != null) // proveri da li je canvas zauzet, ako jeste pronadi mu id i promeni mu vrednosti
         {
             if (!string.IsNullOrWhiteSpace(((TextBlock)(canvas).Children[1]).Text))
             {
                 if (int.Parse(((TextBlock)(canvas).Children[1]).Text) == displayDER.Id)
                 {
                     if (!tempList.Contains(int.Parse(((TextBlock)(canvas).Children[1]).Text)))
                     {
                         tempList.Add(int.Parse(((TextBlock)(canvas).Children[1]).Text));
                     }
                 }
             }
         }
     }
 }
Beispiel #4
0
        private void OnMouseLeftButtonDownCanvas(Canvas canvas)
        {
            if (!dragging)
            {
                if (canvas.Resources["taken"] != null)
                {
                    dragging           = true;
                    SelectedDisplayDER = new DisplayDER(new DisplayDER(NetworkEntitiesViewModel.DERs.FirstOrDefault(x => x.Id == int.Parse(((TextBlock)(canvas).Children[1]).Text))));
                    if (DragDrop.DoDragDrop(listView, SelectedDisplayDER, DragDropEffects.Move) != DragDropEffects.None)
                    {
                        canvas.Background = Brushes.Azure;
                        canvas.Resources.Remove("taken");

                        ((TextBlock)(canvas).Children[0]).Text       = "Slobodno mesto";
                        ((TextBlock)(canvas).Children[0]).Foreground = Brushes.Black;
                        ((TextBlock)(canvas).Children[1]).Text       = "";
                        ((TextBlock)(canvas).Children[1]).Foreground = Brushes.Transparent;
                    }
                }
                dragging = false;
            }
        }
Beispiel #5
0
 private void OnMouseLeftButtonUp(ListView listView)
 {
     selectedDisplayDER    = null;
     listView.SelectedItem = null;
     dragging = false;
 }