public void SetRemoteItem(RemoteBoardItemModel item) { if (this.remoteControl.CurrentBoard != null && this.remoteControl.CurrentGroup != null && item != null && item.Command != null) { this.RemoveRemoteItem(); this.item = item; this.item.SetValuesFromCommand(); this.item.Size = RemoteBoardItemSizeEnum.OneByOne; this.item.XPosition = this.xPosition; this.item.YPosition = this.yPosition; this.NameTextBlock.Text = this.item.Name; this.DeleteButton.Visibility = System.Windows.Visibility.Visible; if (item is RemoteBoardButtonModel) { RemoteBoardButtonModel button = this.item as RemoteBoardButtonModel; this.NameTextBlock.Foreground = new BrushConverter().ConvertFromString(button.TextColor) as SolidColorBrush; this.BackgroundColor.Fill = new BrushConverter().ConvertFromString(button.BackgroundColor) as SolidColorBrush; } if (!this.remoteControl.CurrentGroup.Items.Contains(this.item)) { this.remoteControl.CurrentGroup.Items.Add(this.item); } return; } }
public void ClearCommand() { this.item = null; this.NameTextBlock.Text = ""; this.DeleteButton.Visibility = System.Windows.Visibility.Collapsed; this.NameTextBlock.Foreground = Brushes.Black; this.BackgroundColor.Fill = Brushes.Transparent; }