Esempio n. 1
0
        private void Image_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
        {
            if (tcMain.Items.Count == 0 || (tcMain.Items[0] as BaseUserControl).filePath.Equals(String.Empty))
            {
                if ((userControls[3] as BaseUserControl).filePath.Equals(String.Empty))
                {
                    return;
                }
                mLightList = (userControls[3] as BaseMakerLightUserControl).GetData();
            }
            else
            {
                if (userControls[userControls.IndexOf((BaseUserControl)tcMain.Items[0])].IsMakerLightUserControl())
                {
                    BaseMakerLightUserControl baseMakerLightUserControl = tcMain.Items[0] as BaseMakerLightUserControl;
                    mLightList = baseMakerLightUserControl.GetData();
                }
            }
            mLightList = Business.LightBusiness.Copy(mLightList);
            UserControl userControl = null;

            if (sender == iPlayer)
            {
                //DeviceModel deviceModel =  FileBusiness.CreateInstance().LoadDeviceModel(AppDomain.CurrentDomain.BaseDirectory + @"Device\" + playerDefault);
                //bToolChild.Width = deviceModel.DeviceSize;
                //bToolChild.Height = deviceModel.DeviceSize + 31;
                //bToolChild.Visibility = Visibility.Visible;
                //加入播放器页面
                userControl = new PlayerUserControl(mw, mLightList);
            }
            else if (sender == iPaved)
            {
                //加入平铺页面
                userControl = new ShowPavedUserControl(mw, mLightList);
            }
            else if (sender == iExport)
            {
                userControl = new ExportUserControl(mw, mLightList);
            }
            else if (sender == iPianoRoll)
            {
                userControl = new ShowPianoRollUserControl(mw, mLightList);
            }
            else if (sender == iData)
            {
                userControl = new DataGridUserControl(mw, mLightList);
            }
            else if (sender == iMy3D)
            {
                userControl = new My3DUserControl(mw, mLightList);
            }
            gTool.Children.Clear();
            gTool.Children.Add(userControl);
            gToolBackGround.Visibility = Visibility.Visible;
            DoubleAnimation daV = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.5)));

            userControl.BeginAnimation(OpacityProperty, daV);
        }
        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;
        }