public void SetPosition(OverlayItemPosition position)
        {
            this.position = position;
            if (this.position != null)
            {
                if (this.position.PositionType == OverlayEffectPositionType.Percentage)
                {
                    if (this.position.Horizontal == 25 && this.position.Vertical == 25)
                    {
                        this.TopLeftPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else if (this.position.Horizontal == 50 && this.position.Vertical == 25)
                    {
                        this.TopPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else if (this.position.Horizontal == 75 && this.position.Vertical == 25)
                    {
                        this.TopRightPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else if (this.position.Horizontal == 25 && this.position.Vertical == 50)
                    {
                        this.LeftPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else if (this.position.Horizontal == 50 && this.position.Vertical == 50)
                    {
                        this.CenterPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else if (this.position.Horizontal == 75 && this.position.Vertical == 50)
                    {
                        this.RightPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else if (this.position.Horizontal == 25 && this.position.Vertical == 75)
                    {
                        this.BottomLeftPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else if (this.position.Horizontal == 50 && this.position.Vertical == 75)
                    {
                        this.BottomPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else if (this.position.Horizontal == 75 && this.position.Vertical == 75)
                    {
                        this.BottomRightPositionButton_Click(this, new RoutedEventArgs());
                    }
                    else
                    {
                        this.PercentagePositionButton_Click(this, new RoutedEventArgs());
                    }

                    this.PercentagePositionHorizontalSlider.Value = this.position.Horizontal;
                    this.PercentagePositionVerticalSlider.Value   = this.position.Vertical;
                }
                else
                {
                    this.PixelsPositionButton_Click(this, new RoutedEventArgs());

                    this.PixelPositionHorizontalTextBox.Text = this.position.Horizontal.ToString();
                    this.PixelPositionVerticalTextBox.Text   = this.position.Vertical.ToString();
                }
            }
        }
Пример #2
0
 public OverlayAction(string overlayName, OverlayItemBase item, OverlayItemPosition position, OverlayItemEffects effects)
     : this()
 {
     this.OverlayName = overlayName;
     this.Item        = item;
     this.Position    = position;
     this.Effects     = effects;
 }
Пример #3
0
        private async Task SendEffectPacket(string type, OverlayItemBase item, OverlayItemPosition position, OverlayItemEffects effects)
        {
            JObject jobj = new JObject();

            if (effects != null)
            {
                jobj.Merge(JObject.FromObject(effects));
            }
            if (position != null)
            {
                jobj.Merge(JObject.FromObject(position));
            }
            jobj.Merge(JObject.FromObject(item));
            await this.SendPacket(type, jobj);
        }
Пример #4
0
        public async Task SendItem(OverlayItemBase item, OverlayItemPosition position, OverlayItemEffects effects)
        {
            if (item is OverlayImageItem)
            {
                OverlayImageItem imageItem = (OverlayImageItem)item;
                this.httpListenerServer.SetLocalFile(imageItem.FileID, imageItem.FilePath);
            }
            else if (item is OverlayVideoItem)
            {
                OverlayVideoItem videoItem = (OverlayVideoItem)item;
                this.httpListenerServer.SetLocalFile(videoItem.FileID, videoItem.FilePath);
            }

            await this.SendEffectPacket(item.ItemType, item, position, effects);
        }
        public override ActionBase GetAction()
        {
            string type = (string)this.TypeComboBox.SelectedItem;

            if (!string.IsNullOrEmpty(type))
            {
                if (type.Equals(ShowHideWidgetOption))
                {
                    if (this.WidgetNameComboBox.SelectedIndex >= 0)
                    {
                        OverlayWidget widget = (OverlayWidget)this.WidgetNameComboBox.SelectedItem;
                        return(new OverlayAction(widget.Item.ID, this.ShowHideWidgetCheckBox.IsChecked.GetValueOrDefault()));
                    }
                }
                else
                {
                    OverlayActionTypeEnum overlayType = EnumHelper.GetEnumValueFromString <OverlayActionTypeEnum>(type);

                    if (this.OverlayNameComboBox.SelectedIndex < 0)
                    {
                        return(null);
                    }
                    string overlayName = (string)this.OverlayNameComboBox.SelectedItem;

                    double duration;
                    if (double.TryParse(this.DurationTextBox.Text, out duration) && duration > 0 && this.EntranceAnimationComboBox.SelectedIndex >= 0 &&
                        this.VisibleAnimationComboBox.SelectedIndex >= 0 && this.ExitAnimationComboBox.SelectedIndex >= 0)
                    {
                        OverlayEffectEntranceAnimationTypeEnum entrance = EnumHelper.GetEnumValueFromString <OverlayEffectEntranceAnimationTypeEnum>((string)this.EntranceAnimationComboBox.SelectedItem);
                        OverlayEffectVisibleAnimationTypeEnum  visible  = EnumHelper.GetEnumValueFromString <OverlayEffectVisibleAnimationTypeEnum>((string)this.VisibleAnimationComboBox.SelectedItem);
                        OverlayEffectExitAnimationTypeEnum     exit     = EnumHelper.GetEnumValueFromString <OverlayEffectExitAnimationTypeEnum>((string)this.ExitAnimationComboBox.SelectedItem);

                        OverlayItemEffects effect = new OverlayItemEffects(entrance, visible, exit, duration);

                        OverlayItemPosition position = this.ItemPosition.GetPosition();

                        OverlayItemBase item = null;

                        if (overlayType == OverlayActionTypeEnum.Image)
                        {
                            item = this.ImageItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.Text)
                        {
                            item = this.TextItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.YouTube)
                        {
                            item = this.YouTubeItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.Video)
                        {
                            item = this.VideoItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.WebPage)
                        {
                            item = this.WebPageItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.HTML)
                        {
                            item = this.HTMLItem.GetItem();
                        }

                        if (item != null)
                        {
                            return(new OverlayAction(overlayName, item, position, effect));
                        }
                    }
                }
            }
            return(null);
        }
 public OverlayItemPositionControl(OverlayItemPosition position)
     : this()
 {
     this.position = position;
 }
Пример #7
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            await this.RunAsyncOperation(async() =>
            {
                if (string.IsNullOrEmpty(this.NameTextBox.Text))
                {
                    await MessageBoxHelper.ShowMessageDialog("A name must be specified");
                    return;
                }

                if (this.TypeComboBox.SelectedIndex < 0)
                {
                    await MessageBoxHelper.ShowMessageDialog("A widget type must be selected");
                    return;
                }

                if (this.OverlayNameComboBox.SelectedIndex < 0)
                {
                    await MessageBoxHelper.ShowMessageDialog("An overlay to use must be selected");
                    return;
                }
                string overlayName = (string)this.OverlayNameComboBox.SelectedItem;

                OverlayItemPosition position = this.ItemPosition.GetPosition();
                if (position == null)
                {
                    return;
                }

                OverlayItemBase item = null;
                OverlayWidgetTypeEnum overlayType = EnumHelper.GetEnumValueFromString <OverlayWidgetTypeEnum>((string)this.TypeComboBox.SelectedItem);
                if (overlayType == OverlayWidgetTypeEnum.Image)
                {
                    item = this.ImageItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.Text)
                {
                    item = this.TextItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.YouTube)
                {
                    item = this.YouTubeItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.Video)
                {
                    item = this.VideoItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.WebPage)
                {
                    item = this.WebPageItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.HTML)
                {
                    item = this.HTMLItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.ProgressBar)
                {
                    item = this.ProgressBarItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.EventList)
                {
                    item = this.EventListItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.GameQueue)
                {
                    item = this.GameQueueItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.ChatMessages)
                {
                    item = this.ChatMessagesItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.MixerClip)
                {
                    item = this.MixerClipItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.Leaderboard)
                {
                    item = this.LeaderboardItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.Timer)
                {
                    item = this.TimerItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.TimerTrain)
                {
                    item = this.TimerTrainItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.StreamBoss)
                {
                    item = this.StreamBossItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.GameStats)
                {
                    item = this.GameStatsItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.SongRequests)
                {
                    item = this.SongRequestsItem.GetItem();
                }

                if (item == null)
                {
                    await MessageBoxHelper.ShowMessageDialog("There are missing Widget details");
                    return;
                }

                if (this.Widget == null)
                {
                    this.Widget = new OverlayWidget(this.NameTextBox.Text, overlayName, item, position, this.DontRefreshToggleButton.IsChecked.GetValueOrDefault());
                    ChannelSession.Settings.OverlayWidgets.Add(this.Widget);
                }
                else
                {
                    item.ID = this.Widget.Item.ID;

                    this.Widget.Name        = this.NameTextBox.Text;
                    this.Widget.OverlayName = overlayName;
                    this.Widget.Item        = item;
                    this.Widget.Position    = position;
                    this.Widget.DontRefresh = this.DontRefreshToggleButton.IsChecked.GetValueOrDefault();
                }

                this.Close();
            });
        }