protected void OnWidgetSelected(HomeWidget widget)
        {
            newWidgetLocation       = new NewWidgetLocation(widget);
            newWidgetLocation.color = new TouchColor("grey2", 0.5);
            Put(newWidgetLocation, widget.x, widget.y);
            newWidgetLocation.Visible = false;

            Remove(trashButton);
            Put(trashButton, 755, 435);
            trashButton.Visible = true;
            hoveredOverTrash    = false;
        }
 protected void OnWidgetUnselected(HomeWidget widget)
 {
     if (hoveredOverTrash)
     {
         tileBoard.FreeTiles(newWidgetLocation);
         Remove(widget);
         widgets.Remove(widget);
     }
     else
     {
         if (!tileBoard.containsConflictTiles)
         {
             widget.row    = newWidgetLocation.placement.row;
             widget.column = newWidgetLocation.placement.column;
             Remove(widget);
             Put(widget, widget.x, widget.y);
         }
     }
     newWidgetLocation.Visible = false;
     trashButton.Visible       = false;
 }
Example #3
0
        public static HomeWidget GetNewHomeWidget(string type, string name, string group, int row, int column)
        {
            HomeWidget widget = null;

            switch (type)
            {
            case "Timer": {
                widget = new DeluxeTimerWidget(name, row, column);
                break;
            }

            case "LinePlot": {
                if (linePlots.ContainsKey(name))
                {
                    widget = linePlots[name].CreateInstance(group, row, column);
                }
                else
                {
                    Logger.AddWarning(string.Format("Unknown line plot for main window: {0}", name));
                }

                break;
            }

            case "BarPlot": {
                if (barPlots.ContainsKey(name))
                {
                    widget = barPlots[name].CreateInstance(group, row, column);
                }
                else
                {
                    Logger.AddWarning(string.Format("Unknown bar plot for main window: {0}", name));
                }

                break;
            }

            case "CurvedBarPlot": {
                if (curvedBarPlots.ContainsKey(name))
                {
                    widget = curvedBarPlots[name].CreateInstance(group, row, column);
                }
                else
                {
                    Logger.AddWarning(string.Format("Unknown bar plot for main window: {0}", name));
                }

                break;
            }

            case "Button": {
                widget = new ButtonWidget(name, row, column);
                break;
            }

            default:
                Logger.AddWarning(string.Format("Unknown widget for main window: {0}", type));
                break;
            }

            return(widget);
        }
 public NewWidgetLocation(HomeWidget widget) : base(widget.width, widget.height)
 {
     placement = new HomeWidgetPlacement(widget.row, widget.column, widget.columnWidth, widget.rowHeight);
 }
 public void FreeTiles(HomeWidget widget)
 {
     FreeTiles(widget.pairs);
 }
 public void OccupyTiles(HomeWidget widget)
 {
     OccupyTiles(widget.pairs);
 }