/// <summary> /// Shows specific widget /// </summary> /// <param name="widget">Widget to show</param> /// <param name="position">X position to show widget</param> /// <returns></returns> public override float ShowWidget(ElementManager widget, WindowsStyleProperties style) { // Create control Control control = null; if (ElementIndex.ContainsKey(widget.Identifier)) { control = ElementIndex[widget.Identifier]; control.Location = new Point(0, style.YPosition); } else { control = CreateElement(widget, style); } // Calculate bottom position int newBottom = control.Height + control.Location.Y; // Check if form has enough space, extend if needed if (_widgetContainer.Height < newBottom) { _widgetContainer.Height = newBottom + (int)InitialPosition; } // Add control to form _widgetContainer.Controls.Add(control); // Return bottom return(newBottom); }
/// <summary> /// Updates the view of a specific widget /// </summary> /// <param name="widget">Target widget</param> public override void UpdateView(ElementManager widget) { if (widget.Active == true) { if (!ElementIndex.ContainsKey(widget.Identifier)) { // TODO: ADD WIDGET ON CORRECT POSITION IN VIEW ShowWidget(widget, DefaultStyle); } else { _elementFactory.UpdateElement(widget, ElementIndex[widget.Identifier]); } } else if (ElementIndex.ContainsKey(widget.Identifier)) { DestroyElement(widget.Identifier); } }