public void DestroyWidget(Widget widget) { Contract.ArgumentNotNull(widget, "widget"); // in case special widgets are destroyed manually, set them to 0 if (widget == _logo) { _logo = null; } else if (widget == _statsPanel) { _statsPanel = null; } else if (widget == _fpsLabel) { _fpsLabel = null; } _trays[(int)widget.TrayLocation].RemoveChild(widget.Name); var wList = _widgets[(int)widget.TrayLocation]; wList.Remove(widget); //if (widget == mExpandedMenu) setExpandedMenu(0); widget.Cleanup(); //mWidgetDeathRow.push_back(widget); AdjustTrays(); }
void MoveWidgetToTray(Widget widget, TrayLocation trayLoc, int place = -1) { Contract.ArgumentNotNull(widget, "widget"); // remove widget from old tray var wList = _widgets[(int)widget.TrayLocation]; if (wList.Contains(widget)) { wList.Remove(widget); _trays[(int)widget.TrayLocation].RemoveChild(widget.Name); } // insert widget into new tray at given position, or at the end if unspecified or invalid if (place == -1 || place > (int)_widgets[(int)trayLoc].Count) { place = (int)_widgets[(int)trayLoc].Count; } _widgets[(int)trayLoc].Insert(place, widget); _trays[(int)trayLoc].AddChild(widget.OverlayElement); widget.OverlayElement.HorizontalAlignment = _trayWidgetAlign[(int)trayLoc]; // adjust trays if necessary if (widget.TrayLocation != TrayLocation.None || trayLoc != TrayLocation.None) { AdjustTrays(); } widget.TrayLocation = trayLoc; }
public void Send(IMessage message) { Contract.ArgumentNotNull(message, nameof(message)); //Проверка получателя var recipient = message.Recipient as IUser; if (recipient == null) { return; } if (string.IsNullOrWhiteSpace(recipient.JabberID)) { return; } var text = SR.T($"Сообщение из ELMA:\r\n Автор: {message.AuthorText}\r\n Тема: {message.Subject}\r\n Текст сообщения: {message.FullMessageText}\r\n {message.URL}"); client.SendTextMessageAsync(long.Parse(recipient.JabberID), text); }