Beispiel #1
0
        private void Play()
        {
            if (suc == null)
            {
                SetData(mw.GetData());
                playLpd.Play();
            }
            else
            {
                if (!(suc as BaseUserControl).filePath.Equals(String.Empty))
                {
                    String strAudioResources = (suc as ScriptUserControl).AudioResources;
                    if (!strAudioResources.Contains(@"\"))
                    {
                        //说明是不完整路径
                        strAudioResources = mw.LastProjectPath + @"Audio\" + strAudioResources;
                    }
                    if (File.Exists(strAudioResources))
                    {
                        SetTime(suc.GetData(), strAudioResources, suc.nowTimeP, suc.nowTimeI);
                    }
                    else
                    {
                        SetData(suc.GetData());
                    }
                }


                if (File.Exists(AudioResources))
                {
                    if (isFirst)
                    {
                        //初始化进度条
                        mediaElement.Source = new Uri(AudioResources, UriKind.Relative);
                        isFirst             = false;
                    }

                    mediaElement.Play();
                }
                else
                {
                    playLpd.Play();
                }
            }
        }
        private void ShowData()
        {
            if (showModel == -1)
            {
                return;
            }
            List <Light> mLightList = mw.GetData();

            UserControl userControl = null;

            if (showModel == 0)
            {
                //DeviceModel deviceModel =  FileBusiness.CreateInstance().LoadDeviceModel(AppDomain.CurrentDomain.BaseDirectory + @"Device\" + playerDefault);
                //bToolChild.Width = deviceModel.DeviceSize;
                //bToolChild.Height = deviceModel.DeviceSize + 31;
                //bToolChild.Visibility = Visibility.Visible;
                //加入播放器页面
                if (!(mw.editUserControl.userControls[3] as BaseUserControl).filePath.Equals(String.Empty))
                {
                    String strAudioResources = (mw.editUserControl.userControls[3] as ScriptUserControl).AudioResources;
                    if (!strAudioResources.Contains(@"\"))
                    {
                        //说明是不完整路径
                        strAudioResources = mw.LastProjectPath + @"Audio\" + strAudioResources;
                    }
                    if (File.Exists(strAudioResources))
                    {
                        userControl = new PlayerUserControl(mw, mLightList, strAudioResources, (mw.editUserControl.userControls[3] as ScriptUserControl).nowTimeP, (mw.editUserControl.userControls[3] as ScriptUserControl).nowTimeI);
                    }
                    else
                    {
                        userControl = new PlayerUserControl(mw, mLightList);
                    }
                }
                else
                {
                    userControl = new PlayerUserControl(mw, mLightList);
                }
            }
            else if (showModel == 1)
            {
                //加入平铺页面
                userControl = new ShowPavedUserControl(mw, mLightList);
            }
            else if (showModel == 2)
            {
                userControl = new ExportUserControl(mw, mLightList);
            }
            else if (showModel == 3)
            {
                userControl = new ShowPianoRollUserControl(mw, mLightList);
            }
            else if (showModel == 4)
            {
                userControl = new DataGridUserControl(mw, mLightList);
            }
            else if (showModel == 5)
            {
                userControl = new My3DUserControl(mw, mLightList);
            }

            spBottomTool.Children.Clear();
            spBottomTool.Children.Add(userControl);
            //spPlay.Children.Clear();
            //Point point = iPlay.TranslatePoint(new Point(0, 0), this);
            //spPlay.Margin = new Thickness(0, point.Y + SystemParameters.CaptionHeight, 0, 0);
            //spPlay.Children.Add(userControl);
            //gToolBackGround.Visibility = Visibility.Visible;
        }