コード例 #1
0
        void MainWindow_Closed(object sender, EventArgs e)
        {
            mWasapiCtrl.Term();

            // 設定ファイルを書き出す。
            PreferenceStore.Save(mPref);

            Application.Current.Shutdown(0);
        }
コード例 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            mPref = PreferenceStore.Load();

            if (0 != string.CompareOrdinal(Thread.CurrentThread.CurrentUICulture.Name, mPref.CultureString))
            {
                // カルチャーをセットする。
                CultureInfo newCulture = new CultureInfo(mPref.CultureString);
                Thread.CurrentThread.CurrentCulture   = newCulture;
                Thread.CurrentThread.CurrentUICulture = newCulture;
            }

            comboBoxLang.SelectedIndex = CultureStringToIdx(Thread.CurrentThread.CurrentUICulture.Name);

            int hr = 0;

            hr = mWasapiCtrl.Init();
            AddLog(string.Format("RecPcmWin version {0}\r\n", AssemblyVersion));
            AddLog(string.Format("wasapi.Init() {0:X8}\r\n", hr));

            Closed += new EventHandler(MainWindow_Closed);

            CreateDeviceList();

            UpdateUITexts();

            PreferenceToUI();

            int currentSec = 0;
            int maxSec     = (int)((long)mPref.RecordingBufferSizeMB * 1024 * 1024 / GetBytesPerSec(mPref));

            UpdateDurationLabel(currentSec, maxSec);

            mLevelMeterUC.SetParamChangedCallback(LevelMeterUCParamChanged);

            mWasapiStateChangedDelegate = new Wasapi.WasapiCS.StateChangedCallback(WasapiStatusChanged);
            mWasapiCtrl.RegisterStateChangedCallback(mWasapiStateChangedDelegate);

            mInitialized = true;
        }