/// <summary> /// 点击同步按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSyncButtonClick(object sender, RoutedEventArgs e) { Button button = sender as Button; button.IsEnabled = false; var selected = (DeviceSyncListViewModel)((ListViewItem)DeviceSyncListView.ContainerFromElement(button)).Content; var taskArgs = new DeviceSyncTaskArgs { ThatButton = button, Item = selected, Device = DeviceListCombobox.SelectedItem as MediaDevice, DevicePath = ((DeviceDriverViewModel)DriverListCombobox.SelectedItem).ValueView }; //将任务添加进队列 mSyncTaskQueue.Enqueue(taskArgs); if (mSyncFileBgWorker.IsBusy) { //任务正在运行则直接返回 return; } //如果任务没有运行, 则开启一个任务 mSyncFileBgWorker.RunWorkerAsync(); }
/// <summary> /// 打开文件夹图标点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnOpenFolderClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { var selected = (DeviceSyncListViewModel)((ListViewItem)DeviceSyncListView.ContainerFromElement((DependencyObject)sender)).Content; System.Diagnostics.Process.Start(selected.PcFolderNameView); }