private void FormVolume_FormClosed(object sender, FormClosedEventArgs e) { //ミキサーが開けなかった時はnullで飛んでくる if (_mixer != null) { _mixer.Dispose(); _mixer = null; } }
private void FormVolume_Load(object sender, EventArgs e) { try { _mixer = new MixerAPI(); } catch (MixerAPI.MixerException ex) { System.Diagnostics.Debug.WriteLine("Cannot open Mixer device" + ex.ToString()); Close(); return; } //何故か勝手に大きさ変えられてしまう Size = new System.Drawing.Size(82, 162); cbMute.Checked = _mixer.Mute; tbVolume.Value = (int)_mixer.Volume; toolTip1.SetToolTip(tbVolume, string.Format("音量:{0}", tbVolume.Value)); toolTip1.SetToolTip(cbMute, cbMute.Checked ? "ミュートしています" : "ミュートしていません"); }
private void FormVolume_Load(object sender, EventArgs e) { try { _mixer = new MixerAPI(); } catch (MixerAPI.MixerException ex) { System.Diagnostics.Debug.WriteLine("Cannot open Mixer device" + ex.ToString()); Close(); return; } //何故か勝手に大きさ変えられてしまう Size = new System.Drawing.Size(82, 162); cbMute.Checked = _mixer.Mute; tbVolume.Value = (int)_mixer.Volume; toolTip1.SetToolTip(tbVolume,string.Format("音量:{0}",tbVolume.Value)); toolTip1.SetToolTip(cbMute, cbMute.Checked ? "ミュートしています" : "ミュートしていません"); }
// string _fiddlerOverrideGateway; /// <summary> /// コンストラクタ /// </summary> /// <param name="bPortable">設定を保存しない時true</param> public FormMain(bool bPortable) { InitializeComponent(); IntPtr ptr = Handle; _bPortable = bPortable; MouseWheel += FormMain_MouseWheel; MouseEnter += FormMain_MouseEnter; _sysProxy = System.Net.WebRequest.DefaultWebProxy; var asm = System.Reflection.Assembly.GetExecutingAssembly(); imageListSlotItemType.Images.AddStrip(new Bitmap( asm.GetManifestResourceStream("KCB2.SlotItemsSmallIcon.bmp"))); imageListSlotItemType.TransparentColor = Color.FromArgb(255, 0, 255); deckMemberList.SlotItemIconImageList = imageListSlotItemType; #if RESTORE_VOLUME ///起動時の音量設定を覚えておく using (var mixer = new MixerAPI()) { bootVol = mixer.Volume; bootMute = mixer.Mute; } #endif // WebRequestの同時処理数を引き上げる if (ServicePointManager.DefaultConnectionLimit < 20) { Debug.WriteLine(string.Format("ServicePointManager.DefaultConnectionLimit {0} -> 20", ServicePointManager.DefaultConnectionLimit)); ServicePointManager.DefaultConnectionLimit = 20; } //スレッドプール数を増やす int minWorkerThread, minCompletionPortThread; ThreadPool.GetMinThreads(out minWorkerThread, out minCompletionPortThread); Debug.WriteLine(string.Format("ManagedThread minWorkder:{0} minCompPortThread:{1}", minWorkerThread, minCompletionPortThread)); if (minWorkerThread < 20) { Debug.WriteLine(string.Format("minWorkerThread {0} -> 20", minWorkerThread)); ThreadPool.SetMinThreads(20, minCompletionPortThread); } _httProxy = new HTTProxy(); _httProxy.BeforeRequest += new HTTProxy.HTTProxyCallbackHandler(_httProxy_BeforeRequest); _httProxy.AfterSessionCompleted += new HTTProxy.HTTProxyCallbackHandler(_httProxy_AfterSessionCompleted); ///過去の設定を引っ張ってる場合。 if (Properties.Settings.Default.ProxyPort <= 0) Properties.Settings.Default.ProxyPort = 8088; _gsWrapper = new GSpread.SpreadSheetWrapper(); if (!_httProxy.Start(Properties.Settings.Default.ProxyPort)) MessageBox.Show("HttpListenerの起動に失敗しました。情報は取得されません。\n設定を確認してください"); else UpdateProxyConfiguration(); _logManager = new LogManager.LogManager(this); // _fiddlerOverrideGateway = Properties.Settings.Default.FiddlerOverrideGateway; #if !DEBUG if (Properties.Settings.Default.UseDevMenu) #endif { _watchSession = true; _logLastJSON = new RingBuffer<JSONData>(Properties.Settings.Default.SkipbackJSON+1); } deckMemberList.UpdateDeckStatus = UpdateDeckConditionTime; ///縦横切替を使うかどうか switchViewModeToolStripMenuItem.Visible = false; setLogStore(); }
private void FormMain_Resize(object sender, EventArgs e) { if (Properties.Settings.Default.MuteOnMinimize) { try { using (var mixer = new MixerAPI()) { //ウィンドウが最小化された。 if (WindowState == FormWindowState.Minimized) { bMuted = mixer.Mute; mixer.Mute = true; } else { mixer.Mute = bMuted; } } } catch (MixerAPI.MixerException ex) { //RDP経由するとMixerが開けなくてコンストラクタが例外を投げる Debug.WriteLine("MixerException:" + ex.ToString()); } } }
private void FormMain_FormClosed(object sender, FormClosedEventArgs e) { #if DEBUG testerWnd.Close(); #endif if(_logWnd != null) _logWnd.Close(); #if RESTORE_VOLUME ///起動時の設定を戻す using (var mixer = new MixerAPI()) { mixer.Volume = bootVol; mixer.Mute = bootMute; } #endif if (WindowState == FormWindowState.Normal) Properties.Settings.Default.MainFormLocation = Location; if (WindowState == FormWindowState.Minimized) Visible = false; _httProxy.Stop(); if (!_bPortable) { Debug.WriteLine("Save Configuration"); Properties.Settings.Default.Save(); } }