/// <summary> /// 初期化。 /// 描画コンポーネント初期化、オーディオデバイス監視処理の初期化。 /// </summary> public void Initialize() { // Initialize UI. trayComponent = new TrayComponent(); volumeWindow = new WindowVolume(); optionWindow = new WindowOption(); trayComponent.Initialize(); //trayComponent.IconSource = optionWindow.Icon; trayComponent.DefaultIcon = optionWindow.Icon; // データバインディングが終了するまで待つ // 待ち方がわからないので遅延処理する、という愚策 //Task.Run(async () => { // await Task.Delay(200); // State = 1; //}); //State = 1; //tester = new VolumeWatcher.Sandbox.RecorderTest(); #if DEBUG tester?.Start(); optionWindow.Show(); #endif }
/// <summary> /// /// </summary> /// <param name="window"></param> /// <param name="main"></param> public void SetBinding(WindowOption window, VolumeWatcherMain main) { // 参照モデルの設定 model = main.model; // Command初期化 KeyboardHookCommand = new KeyboardHookCommand(main); RegisterStartupCommand.StartupName = model.StartupName; // Binding初期化 IsKeyHook = model.IsKeyHook; // ピークメータ表示用タイマ StatusTimer.Interval = new TimeSpan(PEAKMETER_RENDER_INTERVAL); StatusTimer.Tick += (o, el) => { var renderMeter = main.VolumeMonitor1.AudioDevice?.AudioMeterInformation; var captureMeter = main.CaptureMonitor.AudioDevice?.AudioMeterInformation; if (StatusTimer.IsEnabled) { RenderPeakValue = (int)Math.Round((renderMeter?.PeakValue ?? 0) * 100); CapturePeakValue = (int)Math.Round((captureMeter?.PeakValue ?? 0) * 100); } }; }