Esempio n. 1
0
 public static void Application_Activated()
 {
     // Restart audio tracks
     for (int i = 0; i < AudioHandles.Count; ++i)
     {
         AudioHandle audioHandle = AudioHandles[i];
         audioHandle.resume(true);
     }
 }
Esempio n. 2
0
        public static bool csWork(String action, String actionData)
        {
            if (action == "CCDeviceAudioManager::Reset")
            {
                MainPage.m_d3dInterop.csActionResult("CCDeviceAudioManager::Reseted", "");

                for (int i = 0; i < AudioHandles.Count; ++i)
                {
                    AudioHandle audioHandle = AudioHandles[i];
                    if (audioHandle.mediaElement != null)
                    {
                        audioHandle.stop();
                    }
                }

                return(true);
            }
            else if (action == "CCDeviceAudioManager::Prepare")
            {
                MainPage.m_d3dInterop.csActionResult("CCDeviceAudioManager::Prepare", "");

                String[] split = Regex.Split(actionData, ", ");
                if (split.Length == 3)
                {
                    String id   = split[0];
                    String url  = split[1];
                    String path = split[2];

                    Prepare(id, url, path);
                }

                return(true);
            }
            else if (action == "CCDeviceAudioManager::Play")
            {
                MainPage.m_d3dInterop.csActionResult("CCDeviceAudioManager::Play", "");

                String[] split = Regex.Split(actionData, ", ");
                if (split.Length == 5)
                {
                    String id      = split[0];
                    String url     = split[1];
                    String path    = split[2];
                    bool   restart = split[3].Equals("true");
                    bool   loop    = split[4].Equals("true");

                    AudioHandle audioHandle = Prepare(id, url, path);
                    if (audioHandle != null)
                    {
                        audioHandle.play(restart, loop);
                    }
                }

                return(true);
            }
            else if (action == "CCDeviceAudioManager::Stop")
            {
                MainPage.m_d3dInterop.csActionResult("CCDeviceAudioManager::Stop", "");

                AudioHandle audioHandle = Get(actionData);
                if (audioHandle != null)
                {
                    audioHandle.stop();
                }

                return(true);
            }
            else if (action == "CCDeviceAudioManager::Pause")
            {
                MainPage.m_d3dInterop.csActionResult("CCDeviceAudioManager::Pause", "");

                AudioHandle audioHandle = Get(actionData);
                if (audioHandle != null)
                {
                    audioHandle.pause();
                }

                return(true);
            }
            else if (action == "CCDeviceAudioManager::Resume")
            {
                MainPage.m_d3dInterop.csActionResult("CCDeviceAudioManager::Resume", "");

                AudioHandle audioHandle = Get(actionData);
                if (audioHandle != null)
                {
                    audioHandle.resume(false);
                }

                return(true);
            }
            else if (action == "CCDeviceAudioManager::SetTime")
            {
                MainPage.m_d3dInterop.csActionResult("CCDeviceAudioManager::SetTime", "");

                return(true);
            }
            else if (action == "CCDeviceAudioManager::SetVolume")
            {
                MainPage.m_d3dInterop.csActionResult("CCDeviceAudioManager::SetVolume", "");

                return(true);
            }

            return(false);
        }