Ejemplo n.º 1
0
        private void TrackView_ItemClicked(object sender, ClearUC.ItemClickedEventArgs e)
        {
            PageItemCollection PageItems = CurrentItems;
            OrderManager       om        = new OrderManager();

            LAPP.IO.FileItem playF = null;
            int index = TrackView.Items.IndexOf(e.Item);

            for (int i = 0; PageItems.Count > i; i++)
            {
                if (PageItems[i].ListItem == TrackView.Items[index])
                {
                    playF = (LAPP.IO.FileItem)PageItems[i];
                    break;
                }
            }

            if (playF != null)
            {
                om.Scan(PageItems);

                PlayFile?.Invoke(this, new PlayFileEventArgs()
                {
                    Manager = om, File = playF
                });
            }
        }
Ejemplo n.º 2
0
        private void PlayList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TreeView      tree = (TreeView)sender;
            PlaylistModel pm   = (PlaylistModel)tree.SelectedItem;

            PlayFile.PlayFileFromPlayList(pm);
            UnSelectItem(tree);
        }
Ejemplo n.º 3
0
        private void RegisterViews()
        {
            IPlayFile playFile   = new PlayFile();
            var       initPlayer = playFile.MediaPlayerService.VideoPlayer;

            playFile   = null;
            initPlayer = null;
        }
Ejemplo n.º 4
0
        public async void Handle(PlayFile message)
        {
            var playlistItem = await LoadModel(message.Model);

            EventAggregator.Publish(new AddItemsMessage {
                Queue = new List <Client.Common.Models.PlaylistItem>(new[] { playlistItem })
            });
            EventAggregator.Publish(new PlayItemAtIndexMessage(PlaylistItems.Count - 1));
        }
Ejemplo n.º 5
0
        private void OpenPlaylist_executed(object sender, ExecutedRoutedEventArgs e)
        {
            PlaylistModel pm = (PlaylistModel)e.Parameter;

            if (pm != null)
            {
                PlayFile.PlayFileFromPlayList(pm);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 创建文件播放
        /// </summary>
        /// <param name="file">文件路径</param>
        /// <param name="CycMode">播放模式</param>
        /// <param name="term">终端id</param>
        /// <returns>大于0: 返回广播会话ID -1:会话创建失败</returns>
        public static int FilePlayStart(string file, int CycMode, params uint[] term)
        {
            PlayFile f = new PlayFile()
            {
                fid = 0, fvol = 10, fname = file
            };

            PlayFile[] FList = new PlayFile[] { f };
            int        cnt   = term.Length;

            return(ITCAPI.FilePlayStart(ref FList, 1, term, cnt, 500, CycMode, 0, 0));
        }
Ejemplo n.º 7
0
        public Discord.Embed FormatPlay(PlayFile playFile)
        {
            var game         = playFile.Games.FirstOrDefault();
            var location     = playFile.Locations.FirstOrDefault();
            var play         = playFile.Plays.FirstOrDefault();
            var playerScores = play?.PlayerScores;
            var players      = playFile.Players;

            var builder = new Discord.EmbedBuilder()
                          .WithTitle(game?.Name ?? "None")
                          .WithDescription(BuildDescription(location, play))
                          .WithFooter(BuildFooter(game))
                          .WithThumbnailUrl(game.UrlThumb)
                          .WithColor(Discord.Color.Green);

            if (DateTimeOffset.TryParse(play.EntryDate, out DateTimeOffset timestamp))
            {
                builder.WithTimestamp(timestamp.ToLocalTime());
            }

            if (play.UsesTeams)
            {
                var teams = playerScores.GroupBy(x => x.Team).OrderBy(g => g.Key);
                var i     = 1;
                foreach (var team in teams)
                {
                    var teamWon  = team.Any(x => x.Winner);
                    var teamName = $"\r\nTeam {i++}{(teamWon ? " :trophy:" : "")}";

                    var sb = new StringBuilder();

                    foreach (var playerScore in team)
                    {
                        var playerData = players.FirstOrDefault(x => x.Id == playerScore.PlayerRefId);
                        if (playerData == null)
                        {
                            continue;
                        }

                        sb.AppendLine($"{playerData.Name}{(string.IsNullOrEmpty(playerScore.Score) ? "" : $" - {playerScore.Score}")}");
                        sb.AppendLine($"```{(string.IsNullOrEmpty(playerScore.TeamRole) ? "" : $"Role: {playerScore.TeamRole}\r\n")}BGG: {(string.IsNullOrEmpty(playerData.BggUsername) ? "Not set" : playerData.BggUsername)}```");
                    }

                    builder.AddField(x =>
                    {
                        x.Name  = teamName;
                        x.Value = sb.ToString();
                    });
                }
            }
Ejemplo n.º 8
0
        public static int FilePlayStart(string file, int fCount, int CycMode, params int[] term)
        {
            PlayFile[] FList = new PlayFile[fCount];
            string[]   name  = file.Split(new char[] { ';' });
            for (int i = 0; i < fCount; i++)
            {
                FList[i].fid   = 0;
                FList[i].fvol  = 10;
                FList[i].fname = name[i];
            }


            int cnt = term.Length;

            return(FilePlayStart(ref FList, fCount, term, cnt, 500, CycMode, 0, 0));
        }
Ejemplo n.º 9
0
        public static int FilePlayStart(string file, int CycMode, params int[] term)
        {
            PlayFile f = new PlayFile();

            f.fid  = 0;
            f.fvol = 10;

            f.fname = file;


            PlayFile[] FList = new PlayFile[] { f };

            int cnt = term.Length;

            return(FilePlayStart(ref FList, 1, term, cnt, 500, CycMode, 0, 0));
        }
Ejemplo n.º 10
0
        public static int FilePlayStart(string file, int CycMode, params int[] term)
        {
            PlayFile f = new PlayFile();

            f.fid = 0;
            f.fvol = 10;

            f.fname = file;


            PlayFile[] FList = new PlayFile[] { f };
            
            int cnt=term.Length;

            return FilePlayStart(ref FList, 1, term, cnt, 500, CycMode, 0, 0);
        }
Ejemplo n.º 11
0
        public async Task Notify(string fileName, Stream stream, PlayFile playFile, ulong sender)
        {
            var targets = await _subscriberContext.Subscribers.AsNoTracking().ToAsyncEnumerable().Where(x => playFile.Players.Any(p => p.Name == x.PlayerName)).Select(s => s.DiscordId).Distinct().ToListAsync();

            foreach (var target in targets)
            {
                if (target == sender)
                {
                    continue;
                }

                var channel = await _client.GetUser(target)?.GetOrCreateDMChannelAsync();

                if (channel != null)
                {
                    stream.Seek(0, SeekOrigin.Begin);
                    await channel.SendFileAsync(stream, fileName, "A play file that included you was shared!");
                }
            }
        }
Ejemplo n.º 12
0
 protected virtual void OnPlayFile(PlayFileEventArgs pea)
 {
     PlayFile?.Invoke(this, pea);
 }
Ejemplo n.º 13
0
 public void Handle(PlayFile message)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 14
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     PlayFile?.Invoke(new object(), new EventArgs());
 }
Ejemplo n.º 15
0
        public static extern int FilePlayStart(ref PlayFile[] pFList, int fCount, int[] pTList, int tCount,
										 int Grade, int CycMode, int CycCount, int CycTime);