WPF 按鈕點擊音效實現

WPF 按鈕點擊音效實現

下面我將為您提供一個完整的 WPF 按鈕點擊音效實現方案,包含多種實現方式和高級功能:

完整實現方案

MainWindow.xaml

<Window x:Class="ButtonClickSound.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:ButtonClickSound"mc:Ignorable="d"Title="按鈕點擊音效演示" Height="450" Width="800"WindowStartupLocation="CenterScreen"Background="#FF1E1E1E"><Window.Resources><!-- 音效資源 --><MediaPlayer x:Key="ClickSoundPlayer" Source="sounds/click.wav" Volume="0.7"/><MediaPlayer x:Key="HoverSoundPlayer" Source="sounds/hover.wav" Volume="0.5"/><!-- 按鈕樣式 --><Style x:Key="SoundButtonStyle" TargetType="Button"><Setter Property="Background" Value="#FF252526"/><Setter Property="Foreground" Value="White"/><Setter Property="BorderBrush" Value="#FF3F3F46"/><Setter Property="BorderThickness" Value="1"/><Setter Property="FontSize" Value="18"/><Setter Property="Padding" Value="20,10"/><Setter Property="Margin" Value="10"/><Setter Property="Cursor" Value="Hand"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="Button"><Border x:Name="border" Background="{TemplateBinding Background}"BorderBrush="{TemplateBinding BorderBrush}"BorderThickness="{TemplateBinding BorderThickness}"CornerRadius="8"><ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"Margin="{TemplateBinding Padding}"/></Border><ControlTemplate.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Background" Value="#FF3A80D2"/><Setter Property="BorderBrush" Value="#FF2A70C2"/></Trigger><Trigger Property="IsPressed" Value="True"><Setter Property="Background" Value="#FF2A70C2"/><Setter Property="BorderBrush" Value="#FF1A60B2"/></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style></Window.Resources><Grid><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="*"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><!-- 標題 --><TextBlock Text="按鈕點擊音效演示" Grid.Row="0"FontSize="28"FontWeight="Bold"Foreground="White"HorizontalAlignment="Center"Margin="0,20"/><!-- 按鈕區域 --><Grid Grid.Row="1"><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><!-- 簡單實現 --><StackPanel Grid.Column="0" VerticalAlignment="Center"HorizontalAlignment="Center"><TextBlock Text="簡單實現" FontSize="20"Foreground="#AAAAAA"HorizontalAlignment="Center"Margin="0,0,0,20"/><!-- 直接綁定事件 --><Button Content="事件處理器" Style="{StaticResource SoundButtonStyle}"Click="ButtonWithEventHandler_Click"/><!-- 使用行為 --><Button Content="使用行為" Style="{StaticResource SoundButtonStyle}"local:SoundBehavior.ClickSound="{StaticResource ClickSoundPlayer}"/><!-- 使用命令 --><Button Content="使用命令" Style="{StaticResource SoundButtonStyle}"Command="{Binding PlaySoundCommand}"/></StackPanel><!-- 高級實現 --><StackPanel Grid.Column="1" VerticalAlignment="Center"HorizontalAlignment="Center"><TextBlock Text="高級實現" FontSize="20"Foreground="#AAAAAA"HorizontalAlignment="Center"Margin="0,0,0,20"/><!-- 懸停+點擊音效 --><Button Content="懸停+點擊音效" Style="{StaticResource SoundButtonStyle}"local:SoundBehavior.HoverSound="{StaticResource HoverSoundPlayer}"local:SoundBehavior.ClickSound="{StaticResource ClickSoundPlayer}"/><!-- 自定義音效 --><Button Content="自定義音效" Style="{StaticResource SoundButtonStyle}"local:SoundBehavior.ClickSound="{StaticResource ClickSoundPlayer}"Click="CustomSoundButton_Click"/><!-- 隨機音效 --><Button Content="隨機音效" Style="{StaticResource SoundButtonStyle}"Click="RandomSoundButton_Click"/></StackPanel></Grid><!-- 控制面板 --><Border Grid.Row="2"Background="#202020"CornerRadius="10"Padding="20"Margin="20"HorizontalAlignment="Center"><StackPanel Orientation="Horizontal" Spacing="20"><Button Content="播放點擊音效" Style="{StaticResource SoundButtonStyle}"Click="PlaySound_Click"/><Button Content="停止所有音效" Style="{StaticResource SoundButtonStyle}"Click="StopAllSounds_Click"/><Button Content="切換靜音模式" Style="{StaticResource SoundButtonStyle}"Click="ToggleMute_Click"/></StackPanel></Border></Grid>
</Window>

SoundBehavior.cs (音效行為類)

using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;namespace ButtonClickSound
{public static class SoundBehavior{#region ClickSound 附加屬性public static MediaPlayer GetClickSound(DependencyObject obj){return (MediaPlayer)obj.GetValue(ClickSoundProperty);}public static void SetClickSound(DependencyObject obj, MediaPlayer value){obj.SetValue(ClickSoundProperty, value);}public static readonly DependencyProperty ClickSoundProperty =DependencyProperty.RegisterAttached("ClickSound", typeof(MediaPlayer), typeof(SoundBehavior), new PropertyMetadata(null, OnClickSoundChanged));private static void OnClickSoundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e){if (d is Button button){button.Click -= Button_Click;if (e.NewValue != null){button.Click += Button_Click;}}}private static void Button_Click(object sender, RoutedEventArgs e){if (sender is Button button){var player = GetClickSound(button);if (player != null){player.Position = TimeSpan.Zero;player.Play();}}}#endregion#region HoverSound 附加屬性public static MediaPlayer GetHoverSound(DependencyObject obj){return (MediaPlayer)obj.GetValue(HoverSoundProperty);}public static void SetHoverSound(DependencyObject obj, MediaPlayer value){obj.SetValue(HoverSoundProperty, value);}public static readonly DependencyProperty HoverSoundProperty =DependencyProperty.RegisterAttached("HoverSound", typeof(MediaPlayer), typeof(SoundBehavior), new PropertyMetadata(null, OnHoverSoundChanged));private static void OnHoverSoundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e){if (d is Button button){button.MouseEnter -= Button_MouseEnter;if (e.NewValue != null){button.MouseEnter += Button_MouseEnter;}}}private static void Button_MouseEnter(object sender, MouseEventArgs e){if (sender is Button button){var player = GetHoverSound(button);if (player != null){player.Position = TimeSpan.Zero;player.Play();}}}#endregion}
}

MainWindow.xaml.cs

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;namespace ButtonClickSound
{public partial class MainWindow : Window{// 全局音效播放器private MediaPlayer _globalClickPlayer = new MediaPlayer();// 隨機音效列表private List<MediaPlayer> _randomSounds = new List<MediaPlayer>();private Random _random = new Random();// 靜音狀態private bool _isMuted = false;public ICommand PlaySoundCommand { get; }public MainWindow(){InitializeComponent();LoadSounds();// 初始化命令PlaySoundCommand = new RelayCommand(ExecutePlaySound);DataContext = this;}private void LoadSounds(){try{// 初始化全局點擊音效_globalClickPlayer.Open(new Uri("sounds/click.wav", UriKind.Relative));_globalClickPlayer.Volume = 0.7;// 初始化隨機音效_randomSounds.Add(CreateSoundPlayer("sounds/click1.wav", 0.7));_randomSounds.Add(CreateSoundPlayer("sounds/click2.wav", 0.6));_randomSounds.Add(CreateSoundPlayer("sounds/click3.wav", 0.8));_randomSounds.Add(CreateSoundPlayer("sounds/click4.wav", 0.5));}catch (Exception ex){MessageBox.Show($"加載音效失敗: {ex.Message}", "錯誤", MessageBoxButton.OK, MessageBoxImage.Error);}}private MediaPlayer CreateSoundPlayer(string path, double volume){var player = new MediaPlayer();player.Open(new Uri(path, UriKind.Relative));player.Volume = volume;return player;}#region 簡單實現方法// 方法1: 直接在事件處理器中播放音效private void ButtonWithEventHandler_Click(object sender, RoutedEventArgs e){PlayGlobalClickSound();}// 方法2: 使用命令播放音效private void ExecutePlaySound(){PlayGlobalClickSound();}#endregion#region 高級實現方法// 自定義音效按鈕private void CustomSoundButton_Click(object sender, RoutedEventArgs e){// 創建臨時音效播放器var player = new MediaPlayer();player.Open(new Uri("sounds/special_click.wav", UriKind.Relative));player.Volume = 0.8;player.Play();// 播放完成后自動釋放資源player.MediaEnded += (s, args) => player.Close();}// 隨機音效按鈕private void RandomSoundButton_Click(object sender, RoutedEventArgs e){if (_randomSounds.Count == 0) return;int index = _random.Next(0, _randomSounds.Count);var player = _randomSounds[index];player.Position = TimeSpan.Zero;player.Play();}#endregion#region 控制面板方法private void PlaySound_Click(object sender, RoutedEventArgs e){PlayGlobalClickSound();}private void StopAllSounds_Click(object sender, RoutedEventArgs e){_globalClickPlayer.Stop();foreach (var player in _randomSounds){player.Stop();}}private void ToggleMute_Click(object sender, RoutedEventArgs e){_isMuted = !_isMuted;// 設置全局音量double volume = _isMuted ? 0.0 : 0.7;_globalClickPlayer.Volume = volume;foreach (var player in _randomSounds){player.Volume = volume;}// 更新按鈕文本((Button)sender).Content = _isMuted ? "取消靜音" : "切換靜音模式";}#endregionprivate void PlayGlobalClickSound(){_globalClickPlayer.Position = TimeSpan.Zero;_globalClickPlayer.Play();}}// 命令實現public class RelayCommand : ICommand{private readonly Action _execute;private readonly Func<bool> _canExecute;public event EventHandler CanExecuteChanged{add { CommandManager.RequerySuggested += value; }remove { CommandManager.RequerySuggested -= value; }}public RelayCommand(Action execute, Func<bool> canExecute = null){_execute = execute ?? throw new ArgumentNullException(nameof(execute));_canExecute = canExecute;}public bool CanExecute(object parameter) => _canExecute?.Invoke() ?? true;public void Execute(object parameter) => _execute();}
}

實現方法詳解

1. 簡單實現方法

方法1: 直接在事件處理器中播放音效
private void ButtonWithEventHandler_Click(object sender, RoutedEventArgs e)
{// 創建或使用全局播放器var player = new MediaPlayer();player.Open(new Uri("sounds/click.wav", UriKind.Relative));player.Play();// 或者使用全局播放器_globalClickPlayer.Position = TimeSpan.Zero;_globalClickPlayer.Play();
}
方法2: 使用附加行為
<Button Content="使用行為" local:SoundBehavior.ClickSound="{StaticResource ClickSoundPlayer}"/>

2. 高級實現方法

懸停+點擊音效組合
<Button Content="懸停+點擊音效" local:SoundBehavior.HoverSound="{StaticResource HoverSoundPlayer}"local:SoundBehavior.ClickSound="{StaticResource ClickSoundPlayer}"/>
自定義音效
private void CustomSoundButton_Click(object sender, RoutedEventArgs e)
{// 創建臨時音效播放器var player = new MediaPlayer();player.Open(new Uri("sounds/special_click.wav", UriKind.Relative));player.Play();// 播放完成后自動釋放資源player.MediaEnded += (s, args) => player.Close();
}
隨機音效
private void RandomSoundButton_Click(object sender, RoutedEventArgs e)
{if (_randomSounds.Count == 0) return;int index = _random.Next(0, _randomSounds.Count);var player = _randomSounds[index];player.Position = TimeSpan.Zero;player.Play();
}

3. 使用命令實現

public ICommand PlaySoundCommand { get; }public MainWindow()
{PlaySoundCommand = new RelayCommand(ExecutePlaySound);
}private void ExecutePlaySound()
{PlayGlobalClickSound();
}// XAML
<Button Content="使用命令" Command="{Binding PlaySoundCommand}"/>

高級功能實現

1. 音效管理

// 全局音效管理器
public static class SoundManager
{private static readonly Dictionary<string, MediaPlayer> _sounds = new Dictionary<string, MediaPlayer>();private static double _globalVolume = 0.7;private static bool _isMuted = false;public static void LoadSound(string name, string path, double volume = 1.0){if (_sounds.ContainsKey(name)) return;var player = new MediaPlayer();player.Open(new Uri(path, UriKind.Relative));player.Volume = volume * _globalVolume;_sounds[name] = player;}public static void PlaySound(string name){if (_isMuted || !_sounds.TryGetValue(name, out var player)) return;player.Position = TimeSpan.Zero;player.Play();}public static void SetGlobalVolume(double volume){_globalVolume = volume;foreach (var player in _sounds.Values){player.Volume = volume;}}public static void SetMute(bool isMuted){_isMuted = isMuted;}
}// 使用
SoundManager.LoadSound("click", "sounds/click.wav", 0.7);
SoundManager.PlaySound("click");

2. 3D音效效果

private void PlayPositionalSound(Point position)
{// 計算相對于窗口中心的位置double centerX = ActualWidth / 2;double centerY = ActualHeight / 2;// 計算相對位置 (-1 到 1)double relX = (position.X - centerX) / centerX;double relY = (position.Y - centerY) / centerY;// 創建音效播放器var player = new MediaPlayer();player.Open(new Uri("sounds/click.wav", UriKind.Relative));// 應用平衡效果 (左右聲道)player.Balance = Math.Clamp(relX, -1.0, 1.0);// 應用音量衰減double distance = Math.Sqrt(relX * relX + relY * relY);player.Volume = Math.Clamp(1.0 - distance * 0.5, 0.2, 1.0);player.Play();
}

3. 音效池系統

public class SoundPool
{private readonly List<MediaPlayer> _players = new List<MediaPlayer>();private readonly string _soundPath;private readonly double _volume;private int _currentIndex = 0;public SoundPool(string soundPath, int poolSize = 5, double volume = 1.0){_soundPath = soundPath;_volume = volume;// 初始化播放器池for (int i = 0; i < poolSize; i++){var player = new MediaPlayer();player.Open(new Uri(soundPath, UriKind.Relative));player.Volume = volume;_players.Add(player);}}public void Play(){// 選擇下一個播放器var player = _players[_currentIndex];// 重置位置player.Position = TimeSpan.Zero;player.Play();// 移動到下一個播放器_currentIndex = (_currentIndex + 1) % _players.Count;}
}// 使用
private SoundPool _clickSoundPool = new SoundPool("sounds/click.wav", 5, 0.7);private void Button_Click(object sender, RoutedEventArgs e)
{_clickSoundPool.Play();
}

專業建議

1. 音效文件處理

  • 使用16位PCM WAV格式以獲得最佳兼容性
  • 保持音效文件短小(通常小于500ms)
  • 使用44.1kHz采樣率
  • 預加載常用音效以減少延遲

2. 性能優化

// 預加載音效
private void PreloadSounds()
{// 使用后臺線程預加載Task.Run(() =>{var player = new MediaPlayer();player.Open(new Uri("sounds/click.wav", UriKind.Relative));// 預讀到內存player.Play();player.Pause();player.Position = TimeSpan.Zero;});
}// 使用NAudio進行低延遲播放
private void PlayLowLatencySound(string path)
{using (var audioFile = new AudioFileReader(path))using (var outputDevice = new WaveOutEvent()){outputDevice.Init(audioFile);outputDevice.Play();}
}

3. 無障礙支持

// 檢查用戶是否啟用了聲音
private bool IsSoundEnabled()
{// 檢查系統設置bool systemSoundEnabled = SystemParameters.ClientAudioPlayback;// 檢查用戶偏好bool userPreference = Properties.Settings.Default.SoundEnabled;return systemSoundEnabled && userPreference;
}// 提供視覺反饋替代
private void PlaySoundWithVisualFeedback()
{if (IsSoundEnabled()){PlayGlobalClickSound();}else{// 提供視覺反饋var button = sender as Button;var originalBrush = button.Background;button.Background = Brushes.Gray;// 短暫延遲后恢復Task.Delay(100).ContinueWith(_ => {Dispatcher.Invoke(() => button.Background = originalBrush);});}
}

這個實現提供了多種按鈕點擊音效的實現方式,從簡單的直接事件處理到高級的音效管理系統和3D音效效果。您可以根據項目需求選擇合適的實現方法,

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/84952.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/84952.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/84952.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

C++ list基礎概念、list初始化、list賦值操作、list大小操作、list數據插入

list基礎概念&#xff1a;list中的每一部分是一個Node&#xff0c;由三部分組成&#xff1a;val、next、prev&#xff08;指向上一個節點的指針&#xff09; list初始化的代碼&#xff0c;見下 #include<iostream> #include<list>using namespace std;void printL…

【Pandas】pandas DataFrame equals

Pandas2.2 DataFrame Reindexing selection label manipulation 方法描述DataFrame.add_prefix(prefix[, axis])用于在 DataFrame 的行標簽或列標簽前添加指定前綴的方法DataFrame.add_suffix(suffix[, axis])用于在 DataFrame 的行標簽或列標簽后添加指定后綴的方法DataFram…

【ROS2】創建單獨的launch包

【ROS】郭老二博文之:ROS目錄 1、簡述 項目中,可以創建單獨的launch包來管理所有的節點啟動 2、示例 1)創建launch包(python) ros2 pkg create --build-type ament_python laoer_launch --license Apache-2.02)創建啟動文件 先創建目錄:launch 在目錄中創建文件:r…

GitHub 趨勢日報 (2025年05月23日)

本日報由 TrendForge 系統生成 https://trendforge.devlive.org/ &#x1f310; 本日報中的項目描述已自動翻譯為中文 &#x1f4c8; 今日整體趨勢 Top 10 排名項目名稱項目描述今日獲星總星數語言1All-Hands-AI/OpenHands&#x1f64c;開放式&#xff1a;少代碼&#xff0c;做…

鴻蒙OSUniApp 實現的數據可視化圖表組件#三方框架 #Uniapp

UniApp 實現的數據可視化圖表組件 前言 在移動互聯網時代&#xff0c;數據可視化已成為產品展示和決策分析的重要手段。無論是運營后臺、健康監測、還是電商分析&#xff0c;圖表組件都能讓數據一目了然。UniApp 作為一款優秀的跨平臺開發框架&#xff0c;支持在鴻蒙&#xf…

[ctfshow web入門] web124

信息收集 error_reporting(0); //聽說你很喜歡數學&#xff0c;不知道你是否愛它勝過愛flag if(!isset($_GET[c])){show_source(__FILE__); }else{//例子 c20-1$content $_GET[c];// 長度不允許超過80個字符if (strlen($content) > 80) {die("太長了不會算");}/…

Vue 技術文檔

一、引言 Vue 是一款用于構建用戶界面的漸進式 JavaScript 框架&#xff0c;具有易上手、高性能、靈活等特點&#xff0c;能夠幫助開發者快速開發出響應式的單頁面應用。本技術文檔旨在全面介紹 Vue 的相關技術知識&#xff0c;為開發人員提供參考和指導。 二、環境搭建 2.1…

Nodejs+http-server 使用 http-server 快速搭建本地圖片訪問服務

在開發過程中&#xff0c;我們經常需要臨時查看或分享本地的圖片資源&#xff0c;比如設計稿、截圖、素材等。雖然可以通過壓縮發送&#xff0c;但效率不高。本文將教你使用 Node.js 的一個輕量級工具 —— http-server&#xff0c;快速搭建一個本地 HTTP 圖片預覽服務&#xf…

通義智文開源QwenLong-L1: 邁向長上下文大推理模型的強化學習

&#x1f389; 動態 2025年5月26日: &#x1f525; 我們正式發布&#x1f917;QwenLong-L1-32B——首個采用強化學習訓練、專攻長文本推理的LRM模型。在七項長文本文檔問答基準測試中&#xff0c;QwenLong-L1-32B性能超越OpenAI-o3-mini和Qwen3-235B-A22B等旗艦LRM&#xff0c…

學習如何設計大規模系統,為系統設計面試做準備!

前言 在當今快速發展的技術時代&#xff0c;系統設計能力已成為衡量一名軟件工程師專業素養的重要標尺。隨著云計算、大數據、人工智能等領域的興起&#xff0c;構建高性能、可擴展且穩定的系統已成為企業成功的關鍵。然而&#xff0c;對于許多工程師而言&#xff0c;如何有效…

Python生成ppt(python-pptx)N問N答(如何繪制一個沒有背景的矩形框;如何繪制一個沒有背景的矩形框)

文章目錄 [toc]1. **如何安裝python-pptx庫&#xff1f;**2. **如何創建一個空白PPT文件&#xff1f;**3. **如何添加幻燈片并設置布局&#xff1f;**4. **如何添加文本內容&#xff1f;**5. **如何插入圖片&#xff1f;**6. **如何設置動畫和轉場效果&#xff1f;**9. **如何繪…

命令模式,觀察者模式,狀態模式,享元模式

什么是命令模式&#xff1f; 核心思想是將原本直接調用的方法封裝為對象&#xff08;如AttackCommand&#xff09;&#xff0c;對象包含??執行邏輯??和??上下文信息??&#xff08;如目標、參數&#xff09;。比如&#xff0c;玩家的按鍵操作被封裝成一個命令對象&#…

Window Server 2019--07 PKI、SSL網站與郵件安全

了解PKI、SSL技術的核心原理掌握PKI架構服務器配置掌握證書管理與應用 公鑰基礎設施&#xff08;Public Key Infrastructure&#xff0c;PKI&#xff09;是一個完整的頒發、吊銷、管理數字證書的系統&#xff0c;是支持認證、加密、完整性和可追究性服務的基礎設施。PKI通過第…

從C++編程入手設計模式2——工廠模式

從C編程入手設計模式 工廠模式 ? 我們馬上就要迎來我們的第二個創建型設計模式&#xff1a;工廠方法模式&#xff08;Factory Method Pattern&#xff09;。換而言之&#xff0c;我們希望使用一個這樣的接口&#xff0c;使用其他手段而不是直接創建的方式&#xff08;說的有…

MySQL、PostgreSQL、Oracle 區別詳解

MySQL、PostgreSQL、Oracle 區別詳解 一、基礎架構對比 1.1 數據庫類型 MySQL:關系型數據庫(支持NoSQL插件如MySQL Document Store)PostgreSQL:對象-關系型數據庫(支持JSON等半結構化數據)Oracle:多模型數據庫(關系型+文檔+圖+空間等)關鍵結論:PostgreSQL在數據類型…

window11系統 使用GO語言建立TDengine 連接

目錄 1、安裝GCC、TDengine-client 1、github下載mingw64 軟件包 2、解壓指定目錄、配置環境變量 3、檢驗gcc是否安裝成功 4、安裝TDengine-client 2、配置go環境變量 3、配置Goland 系統變量、重啟Goland&#xff08;該軟件自己也有系統變量&#xff0c;有時候會和win…

VR 賦能病毒分離鑒定:開啟微觀探索新視界

在大眾認知里&#xff0c;VR 技術往往與沉浸式游戲體驗、虛擬社交緊密相連&#xff0c;讓人仿佛置身于奇幻的虛擬世界中&#xff0c;感受著科技帶來的奇妙娛樂享受。而病毒分離鑒定&#xff0c;聽起來則是一個充滿專業性與嚴肅性的科學領域&#xff0c;它關乎病毒的研究、疾病的…

Azure Devops pipeline 技巧和最佳實踐

1. 如何顯示release pipeline ? 解決方法: 登錄devops, 找到organization - pipeline - setting下的Disable creation of classic release pipelines,禁用該選項。 然后在project - pipeline - setting,禁用Disable creation of classic release pipelines 現在可以看到r…

GPU的通信技術

GPU 之間直接通信主要采用了以下幾種技術1&#xff1a; GPUDirect P2P&#xff1a;NVIDIA 開發的技術&#xff0c;用于單機上的 GPU 間高速通信。在沒有該技術時&#xff0c;GPU 間數據交換需先通過 CPU 和 PCIe 總線復制到主機固定的共享內存&#xff0c;再復制到目標 GPU&…

重新測試deepseek Jakarta EE 10編程能力

聽說deepseek做了一個小更新&#xff0c;我重新測試了一下Jakarta EE 10編程能力&#xff1b;有點進步&#xff0c;遺漏的功能比以前少了。 采用Jakarta EE 10 編寫員工信息表維護表&#xff0c;包括員工查詢與搜索、員工列表、新增員工、刪除員工&#xff0c;修改員工&#xf…