public new bool MouseDown(Point position)
 {
     var room = editor.GetRoomFromPosition(position);
     if (room != null)
     {
         var itemInfo = new NewItem
         {
             RoomTitle = room.Title
         };
         if (itemInfo.ShowDialog() == true)
         {
             Item item;
             if (itemInfo.SpecificLocation)
             {
                 item = new CoordinateItem { Location = position };
             }
             else
             {
                 item = new RoomItem();
             }
             item.Room = room;
             item.Title = itemInfo.Title;
             item.QRCode = itemInfo.QRCode;
             item.Visible = itemInfo.Visible;
             editor.Items.Add(item);
         }
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #2
0
        public void FillWithJsonObject(JContainer dict, Scheme scheme)
        {
            Rooms = dict["rooms"].Select(r =>
            {
                Room room = new Room();
                room.FillWithJsonObject((JContainer)r, scheme);
                return room;
            }).ToArray();

            Items = dict["items"].Select(i =>
            {
                Item item;
                string locType = (string)i["location_type"];
                if (locType.Equals("room"))
                    item = new RoomItem();
                else
                    item = new CoordinateItem();
                item.FillWithJsonObject((JContainer)i, scheme);
                return item;
            }).ToArray();
        }
예제 #3
0
 private UIElement BuildItemVisual(CoordinateItem item)
 {
     var binding = new Binding
     {
         Path = new PropertyPath("ItemRadius"),
         Source = this
     };
     var geometry = new EllipseGeometry
         {
             Center = item.Location,
         };
     BindingOperations.SetBinding(geometry, EllipseGeometry.RadiusXProperty, binding);
     BindingOperations.SetBinding(geometry, EllipseGeometry.RadiusYProperty, binding);
     var path = new Path
     {
         Fill = new SolidColorBrush(Colors.Blue),
         Data = geometry,
         ToolTip = item.Title
     };
     return path;
 }