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

                DisplayDERs.Add(displayDER);

                checkCanvas(displayDER);
            }
            UpdateCanvasOnViewChange();
        }
예제 #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));
                     }
                 }
             }
         }
     }
 }
예제 #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;
            }
        }
예제 #5
0
 private void OnMouseLeftButtonUp(ListView listView)
 {
     selectedDisplayDER    = null;
     listView.SelectedItem = null;
     dragging = false;
 }