Exemplo n.º 1
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (Pedalthread != null)
                Pedalthread.Abort();

            var res = AsyncHelpers.RunSync(() => TrySaveUnsavedChanges());

            if (!res || !TrySaveSpeakersDatabase())
            {
                e.Cancel = true;
                return;
            }


            SaveGlobalSetup();

            foreach (Window win in App.Current.Windows)
            {
                if (win != this)
                    try { win.Close(); }
                    catch { };
            }

            if (MWP != null)
            {
                MWP.Dispose();
                MWP = null;
            }


            _WavReader.Stop();

            if (_api != null)
                _api.Cancel();

            FilePaths.DeleteTemp();

            if (PedalProcess != null && !PedalProcess.HasExited)
                PedalProcess.Kill();


            Environment.Exit(0); //Force close application
        }
Exemplo n.º 2
0
        /// <summary>
        /// inicializuje MWP - prehravac audia, pokud neni null, zavola dispose a opet ho vytvori
        /// </summary>
        /// <returns></returns>
        private bool InitializeAudioPlayer()
        {
            try
            {
                if (MWP != null)
                {
                    MWP.Dispose();
                    MWP = null;
                }
                MWP = new DXWavePlayer(Settings.Default.OutputDeviceIndex, 4800, ReadAudioDataFromWaveform);
                return true;
            }
            catch
            {
                return false;
            }

        }