Exemplo n.º 1
0
        public void ResetPosition(bool showHelp = true)
        {
            if (window.ScheduleGrid.Children.Contains(this))
            {
                window.ScheduleGrid.Children.Remove(this);
            }
            if (!originalParent.Children.Contains(this))
            {
                originalParent.Children.Add(this);
            }
            Margin = originalMargin;
            Height = originalHeight;
            SectionType.Content = type;
            BG.RadiusX          = radius.X;
            BG.RadiusY          = radius.Y;
            onGrid = false;
            if (showHelp)
            {
                searchParent.Dragging_Info.Visibility = Visibility.Visible;
            }
            Grid.SetZIndex(this, -10);

            for (int i = 0; i < sections.Length; i++)
            {
                for (int j = 0; j < sections[i].Length; j++)
                {
                    GridSection g = sections[i][j];
                    g.SetStay(false);
                    g.ShadowConnected();
                }
            }
        }
Exemplo n.º 2
0
 private void Window_MouseMove(object sender, MouseEventArgs e)
 {
     if (released == null)
     {
         foreach (UIElement ui in ScheduleGrid.Children)
         {
             GridSection gs = ui as GridSection;
             if (gs != null)
             {
                 bool anyHovering = false;
                 foreach (GridSection g in gs.connected)
                 {
                     Point p = Mouse.GetPosition(g);
                     anyHovering = anyHovering || IsHoveringGridSection(g, p);
                 }
                 if (anyHovering)
                 {
                     gs.HighlightConnected();
                 }
                 else
                 {
                     gs.ShadowConnected();
                 }
             }
         }
         if (IsHoveringGarbage(TrashEmpty) || IsHoveringGarbage(TrashFull))
         {
             Garbage_MouseEnter();
         }
         else
         {
             Garbage_MouseLeave();
         }
     }
 }
Exemplo n.º 3
0
        // Make rectangle
        public void OnGridPlace(bool SetHeight = false)
        {
            BG.RadiusX          = 0;
            BG.RadiusY          = 0;
            SectionType.Content = name + " " + type;
            placedOnce          = true;
            onGrid = true;

            for (int i = 0; i < sections.Length; i++)
            {
                for (int j = 0; j < sections[i].Length; j++)
                {
                    GridSection g = sections[i][j];
                    if (Grid.GetRow(g) == Grid.GetRow(this) && Grid.GetColumn(g) == Grid.GetColumn(this))
                    {
                        Grid.SetRowSpan(this, Grid.GetRowSpan(g));
                        g.SetStay(true);
                        g.HighlightConnected();
                        g.ShowConnected();
                        if (SetHeight)
                        {
                            Height = g.Height;
                        }
                        break;
                    }
                    else
                    {
                        g.SetStay(false);
                        g.ShadowConnected();
                        g.HideConnected();
                    }
                }
            }

            if (originalParent.Children.Count == 0)
            {
                searchParent.Dragging_Info.Visibility = Visibility.Collapsed;
                bool alreadyPlaced = false;
                foreach (UIElement ui in window.ListOfCourses.Children)
                {
                    CourseListItem cli = ui as CourseListItem;
                    if (cli != null && cli.name == name)
                    {
                        alreadyPlaced = true;
                        break;
                    }
                }

                if (!alreadyPlaced)
                {
                    window.ListOfCourses.Children.Add(new CourseListItem(this, other, window));
                }
            }
        }