Пример #1
0
        private void ImportMessage(List <FileItem> images, List <FileItem> videos, MessageInfo messageInfo)
        {
            if ((images == null || images.Count == 0) && (videos == null || videos.Count == 0) && messageInfo == null)
            {
                return;
            }
            List <MessageFileItem> listFiles    = new List <MessageFileItem>();
            List <MessageInfo>     listMessages = new List <MessageInfo>();
            MessageInfo            message      = null;
            MessageItem            messageItem  = null;

            //bool isValid = false;
            //if (images != null && images.Count > 0)
            //{

            //MessageFileItem messageFile = null;

            AddFiles(images, listFiles);
            AddFiles(videos, listFiles);
            message          = LibraryGroup.Current.Messages.GetByName(messageInfo.Name);
            messageItem      = new MessageItem();
            messageItem.Item = messageInfo.Copy() as MessageInfo;
            if (message != null)
            {
                messageItem.IsValid = false;
            }
            else
            {
                messageItem.IsValid = true;
            }
            //Batch load file :rename file and message
            ImportMessageRename(listFiles, messageItem);
            //}
        }
Пример #2
0
            public VideoLayerCollection[] OnPlay()
            {
                _playlistControl.LoadModelInfo();

                _playlistControl.trackBar1.PlayValue = 0;
                origPlayValue = _playlistControl.trackBar1.PlayValue;
                _playlistControl.playPanel.Visible = true;
                _msgs = new List <VideoLayerCollection>();
                foreach (PlaylistItemControl item in _playlistControl.dragDropControl.Controls)
                {
                    switch (item.PlaylistItem.Target.Type)
                    {
                    case LibraryType.Message:
                        //ProWrite.DES.DESHelper.CreateVideo(item.PlaylistItem.Target.Copy() as MessageInfo, "d:\\aaa.mpeg");
                        var msg = NewLayer(item.PlaylistItem.Target.Copy() as MessageInfo,
                                           item.PlaylistItem.Target.Length, "", true, null);
                        msg.Zoom = _playlistControl._Zoom;
                        _msgs.Add(msg);

                        //_msgs.Add(NewLayer(item.PlaylistItem.Target.Copy() as MessageInfo, item.PlaylistItem.Target.Length, "", true, null));
                        break;

                    case LibraryType.TimeSliceGroup:
                        TimeSliceGroupInfo group   = null;
                        MessageInfo        message = null;
                        group = LibraryGroup.Current.TimeSliceGroups.GetByName(item.PlaylistItem.Target.Name);
                        if (group.Items != null && group.Items.Length > 0)
                        {
                            for (int i = 0; i < group.Items.Length; i++)
                            {
                                if (group.Items[i].Name == ((TimeSliceGroupAdapterInfo)item.PlaylistItem).CurrentMessageAdapterName && group.Items[i].Target != null && group.Items[i].IsActive)
                                {
                                    message = group.Items[i].Target as MessageInfo;
                                    break;
                                }
                            }
                            if (message == null)
                            {
                                DataGate.SetPlaylistTimeSlieceGroupCurrentMessageAdapterName(_playlistControl._model, false);
                                for (int i = 0; i < group.Items.Length; i++)
                                {
                                    if (group.Items[i].Name == ((TimeSliceGroupAdapterInfo)item.PlaylistItem).CurrentMessageAdapterName && group.Items[i].Target != null && group.Items[i].IsActive)
                                    {
                                        message = group.Items[i].Target as MessageInfo;
                                        break;
                                    }
                                }
                            }
                        }

                        if (message != null)
                        {
                            _msgs.Add(NewLayer(message.Copy() as MessageInfo, group.Length, group.Name, true, LibraryType.TimeSliceGroup));
                        }
                        break;

                    case LibraryType.Playlist:
                        //add by michael 2008-12-8
                        // edit by Louis 2009-1-5
                        PlaylistInfo list = LibraryGroup.Current.Playlists.GetByName(item.PlaylistItem.Target.Name);
                        if (list != null && list.AllMessages.Length > 0)
                        {
                            _msgs.Add(NewLayer(list.AllMessages[0].Copy() as MessageInfo, list.AllMessages[0].Length, list.Name, true, LibraryType.Playlist));
                            for (int i = 1; i < list.AllMessages.Length; i++)
                            {
                                _msgs.Add(NewLayer(list.AllMessages[i].Copy() as MessageInfo, list.AllMessages[i].Length, list.Name, false, LibraryType.Playlist));
                            }
                        }
                        //foreach (MessageInfo mes in list.AllMessages)
                        //{
                        //    _msgs.Add(NewLayer(mes.Copy() as MessageInfo, mes.Length, list.Name, LibraryType.Playlist));
                        //}
                        break;
                    }
                }
                if (_msgs.Count > 0)
                {
                    _playlistControl.EnableControl(false);
                }
                return(_msgs.ToArray());
            }