/// <summary> /// 記録停止ボタン /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStop_Click(object sender, RoutedEventArgs e) { if (m != null) { m.Dispose(); m = null; } // HotKeyの登録削除 UnregisterHotKey(); this.btnStart.IsEnabled = true; this.btnStop.IsEnabled = false; }
/// <summary> /// 記録開始ボタン /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStart_Click(object sender, RoutedEventArgs e) { try { if (!System.IO.Directory.Exists(setting.SaveDir)) { System.IO.Directory.CreateDirectory(setting.SaveDir); } } catch (Exception ex) { MessageBox.Show("保存フォルダの作成に失敗しました。\n" + ex.Message); return; } try { if (_captureList == null) { _captureList = new System.Collections.ObjectModel.ObservableCollection <CaptureEntry>(); listView1.DataContext = _captureList; } if (m == null) { m = new MouseHook(); m.MouseHooked += new MouseHookedEventHandler(m_MouseHooked); } // HotKeyの登録 SetupHotKey(); this.btnStart.IsEnabled = false; this.btnStop.IsEnabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
/// <summary> /// 記録開始ボタン /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStart_Click(object sender, RoutedEventArgs e) { try { if (!System.IO.Directory.Exists(setting.SaveDir)) System.IO.Directory.CreateDirectory(setting.SaveDir); } catch (Exception ex) { MessageBox.Show("保存フォルダの作成に失敗しました。\n" + ex.Message); return; } try { if (_captureList == null) { _captureList = new System.Collections.ObjectModel.ObservableCollection<CaptureEntry>(); listView1.DataContext = _captureList; } if (m == null) { m = new MouseHook(); m.MouseHooked += new MouseHookedEventHandler(m_MouseHooked); } // HotKeyの登録 SetupHotKey(); this.btnStart.IsEnabled = false; this.btnStop.IsEnabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }