WPF 實現 Gitee 泡泡菜單「完」

?WPF 實現 Gitee 泡泡菜單「完」

氣泡菜單「完」

作者:WPFDevelopersOrg

原文鏈接: ? ?https://github.com/WPFDevelopersOrg/WPFDevelopers

  • 框架使用大于等于.NET40

  • Visual Studio 2022;

  • 項目使用 MIT 開源許可協議;

a3c2d24798b68dce62df76f74e154fed.png
  • 需要實現泡泡菜單需要使用Canvas畫布進行添加內容;

  • 保證顏色隨機,位置不重疊;

  • 點擊泡泡獲得當前泡泡的值;

1) BubblleCanvas.cs 代碼如下;

using?System.Windows;
using?System.Windows.Controls;
using?WPFDevelopers.Helpers;
using?WPFDevelopers.Utilities;namespace?WPFDevelopers.Controls
{public?class?BubblleCanvas?:?Canvas{private?double?_bubbleItemX;private?double?_bubbleItemY;private?int?_number;private?double?_size;private?const?int?_maxSize?=?120;protected?override?Size?ArrangeOverride(Size?arrangeSize){var?width?=?arrangeSize.Width;var?height?=?arrangeSize.Height;double?left?=?0d,?top?=?0d;for?(var?y?=?0;?y?<?(int)height?/?_maxSize;?y++){double?yNum?=?y?+?1;yNum?=?_maxSize?*?yNum;for?(var?x?=?0;?x?<?(int)width?/?_maxSize;?x++){if?(_number?>?InternalChildren.Count?-?1)return?arrangeSize;var?item?=?InternalChildren[_number]?as?FrameworkElement;if?(DoubleUtil.IsNaN(item.ActualWidth)?||?DoubleUtil.IsZero(item.ActualWidth)?||?DoubleUtil.IsNaN(item.ActualHeight)?||?DoubleUtil.IsZero(item.ActualHeight))ResizeItem(item);_bubbleItemX?=?Canvas.GetLeft(item);_bubbleItemY?=?Canvas.GetTop(item);if?(double.IsNaN(_bubbleItemX)?||?double.IsNaN(_bubbleItemY)){double?xNum?=?x?+?1;xNum?=?_maxSize?*?xNum;_bubbleItemX?=?ControlsHelper.NextDouble(left,?xNum?-?_size?*?ControlsHelper.NextDouble(0.6,?0.9));var?_width?=?_bubbleItemX?+?_size;_width?=?_width?>?width???width?-?(width?-?_bubbleItemX)?-?_size?:?_bubbleItemX;_bubbleItemX?=?_width;_bubbleItemY?=?ControlsHelper.NextDouble(top,?yNum?-?_size?*?ControlsHelper.NextDouble(0.6,?0.9));var?_height?=?_bubbleItemY?+?_size;_height?=?_height?>?height???height?-?(height?-?_bubbleItemY)?-?_size?:?_bubbleItemY;_bubbleItemY?=?_height;}Canvas.SetLeft(item,?_bubbleItemX);Canvas.SetTop(item,?_bubbleItemY);left?=?left?+?_size;_number++;item.Arrange(new?Rect(new?Point(_bubbleItemX,?_bubbleItemY),?new?Size(_size,?_size)));}left?=?0d;top?=?top?+?_maxSize;}return?arrangeSize;}private?void?ResizeItem(FrameworkElement?item){if?(DoubleUtil.GreaterThanOrClose(item.DesiredSize.Width,?55))_size?=?ControlsHelper.GetRandom.Next(80,?_maxSize);else_size?=?ControlsHelper.GetRandom.Next(55,?_maxSize);item.Width?=?_size;item.Height?=?_size;}}
}

2) ControlsHelper.cs 代碼如下;

  • 隨機Double值;

  • 隨機顏色;

private?static?long?_tick?=?DateTime.Now.Ticks;public?static?Random?GetRandom?=?new?Random((int)(_tick?&?0xffffffffL)?|?(int)(_tick?>>?32));public?static?double?NextDouble(double?miniDouble,?double?maxiDouble){if?(GetRandom?!=?null){return?GetRandom.NextDouble()?*?(maxiDouble?-?miniDouble)?+?miniDouble;}else{return?0.0d;}}public?static?Brush?RandomBrush(){var?R?=?GetRandom.Next(255);var?G?=?GetRandom.Next(255);var?B?=?GetRandom.Next(255);var?color?=?Color.FromRgb((byte)R,?(byte)G,?(byte)B);var?solidColorBrush?=?new?SolidColorBrush(color);return?solidColorBrush;}

3) BubbleControl.cs 代碼如下;

using?System;
using?System.Collections.Generic;
using?System.Collections.ObjectModel;
using?System.Diagnostics;
using?System.Linq;
using?System.Windows;
using?System.Windows.Controls;
using?System.Windows.Input;
using?System.Windows.Media;
using?System.Windows.Shapes;
using?WPFDevelopers.Helpers;namespace?WPFDevelopers.Controls
{[TemplatePart(Name?=?BorderTemplateName,?Type?=?typeof(Border))][TemplatePart(Name?=?EllipseTemplateName,?Type?=?typeof(Ellipse))][TemplatePart(Name?=?RotateTransformTemplateName,?Type?=?typeof(RotateTransform))]public?class?BubblleControl?:?Control{private?const?string?BorderTemplateName?=?"PART_Border";private?const?string?EllipseTemplateName?=?"PART_Ellipse";private?const?string?RotateTransformTemplateName?=?"PART_EllipseRotateTransform";private?const?string?ListBoxTemplateName?=?"PART_ListBox";private?static?readonly?Type?_typeofSelf?=?typeof(BubblleControl);private?ObservableCollection<BubblleItem>?_items?=?new?ObservableCollection<BubblleItem>();private?Border?_border;private?Ellipse?_ellipse;private?RotateTransform?_rotateTransform;private?Brush[]?brushs;private?ItemsControl?_listBox;private?static?RoutedCommand?_clieckCommand;class?BubblleItem{public?string?Text?{?get;?set;?}public?Brush?Bg?{?get;?set;?}}static?BubblleControl(){InitializeCommands();DefaultStyleKeyProperty.OverrideMetadata(_typeofSelf,?new?FrameworkPropertyMetadata(_typeofSelf));}#region?Eventpublic?static?readonly?RoutedEvent?ClickEvent?=?EventManager.RegisterRoutedEvent("Click",?RoutingStrategy.Bubble,?typeof(RoutedEventHandler),?_typeofSelf);public?event?RoutedEventHandler?Click{add?{?AddHandler(ClickEvent,?value);?}remove?{?RemoveHandler(ClickEvent,?value);?}}#endregion#region?Commandprivate?static?RoutedCommand?_clickCommand?=?null;private?static?void?InitializeCommands(){_clickCommand?=?new?RoutedCommand("Click",?_typeofSelf);CommandManager.RegisterClassCommandBinding(_typeofSelf,?new?CommandBinding(_clickCommand,?OnClickCommand,?OnCanClickCommand));}public?static?RoutedCommand?ClickCommand{get?{?return?_clickCommand;?}}private?static?void?OnClickCommand(object?sender,?ExecutedRoutedEventArgs?e){var?ctrl?=?sender?as?BubblleControl;ctrl.SetValue(SelectedTextPropertyKey,?e.Parameter?.ToString());ctrl.RaiseEvent(new?RoutedEventArgs(ClickEvent));}private?static?void?OnCanClickCommand(object?sender,?CanExecuteRoutedEventArgs?e){e.CanExecute?=?true;}#endregion#region?readonly?Propertiesprivate?static?readonly?DependencyPropertyKey?SelectedTextPropertyKey?=DependencyProperty.RegisterReadOnly("SelectedText",?typeof(string),?_typeofSelf,?new?PropertyMetadata(null));public?static?readonly?DependencyProperty?SelectedTextProperty?=?SelectedTextPropertyKey.DependencyProperty;public?string?SelectedText{get?{?return?(string)GetValue(SelectedTextProperty);?}}public?new?static?readonly?DependencyProperty?BorderBackgroundProperty?=DependencyProperty.Register("BorderBackground",?typeof(Brush),?typeof(BubblleControl),new?PropertyMetadata(null));public?new?static?readonly?DependencyProperty?EarthBackgroundProperty?=DependencyProperty.Register("EarthBackground",?typeof(Brush),?typeof(BubblleControl),new?PropertyMetadata(Brushes.DarkOrchid));public?Brush?BorderBackground{get?=>?(Brush)this.GetValue(BorderBackgroundProperty);set?=>?this.SetValue(BorderBackgroundProperty,?(object)value);}public?Brush?EarthBackground{get?=>?(Brush)this.GetValue(EarthBackgroundProperty);set?=>?this.SetValue(EarthBackgroundProperty,?(object)value);}#endregion#region?Propertypublic?static?readonly?DependencyProperty?ItemsSourceProperty?=DependencyProperty.Register("ItemsSource",?typeof(IEnumerable<string>),?typeof(BubblleControl),?new?PropertyMetadata(null,?OnItemsSourcePropertyChanged));public?IEnumerable<string>?ItemsSource{get?{?return?(IEnumerable<string>)GetValue(ItemsSourceProperty);?}set?{?SetValue(ItemsSourceProperty,?value);?}}private?static?void?OnItemsSourcePropertyChanged(DependencyObject?obj,?DependencyPropertyChangedEventArgs?e){var?ctrl?=?obj?as?BubblleControl;var?newValue?=?e.NewValue?as?IEnumerable<string>;if?(newValue?==?null){ctrl._items.Clear();return;}foreach?(var?item?in?newValue){ctrl._items.Add(new?BubblleItem?{?Text?=?item,?Bg?=?ControlsHelper.RandomBrush()?});}}#endregion#region?Overridepublic?override?void?OnApplyTemplate(){base.OnApplyTemplate();_border?=?GetTemplateChild(BorderTemplateName)?as?Border;_ellipse?=?GetTemplateChild(EllipseTemplateName)?as?Ellipse;_rotateTransform?=?GetTemplateChild(RotateTransformTemplateName)?as?RotateTransform;Loaded?+=?delegate{var?point?=?_border.TranslatePoint(new?Point(_border.ActualWidth?/?2,?_border.ActualHeight?/?2),_ellipse);_rotateTransform.CenterX?=?point.X?-?_ellipse.ActualWidth?/?2;_rotateTransform.CenterY?=?point.Y?-?_ellipse.ActualHeight?/?2;};_listBox?=?GetTemplateChild(ListBoxTemplateName)?as?ItemsControl;_listBox.ItemsSource?=?_items;}#endregion}
}

4) BubblleControl.xaml 代碼如下;

<ResourceDictionary?xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:controls="clr-namespace:WPFDevelopers.Controls"><ResourceDictionary.MergedDictionaries><ResourceDictionary?Source="Basic/ControlBasic.xaml"/><ResourceDictionary?Source="Basic/Animations.xaml"/></ResourceDictionary.MergedDictionaries><Style?TargetType="controls:BubblleControl"?BasedOn="{StaticResource?ControlBasicStyle}"><Setter?Property="Width"?Value="400"/><Setter?Property="Height"?Value="400"/><Setter?Property="Background"?Value="{StaticResource?WhiteSolidColorBrush}"/><Setter?Property="BorderThickness"?Value="1"/><Setter?Property="BorderBrush"?Value="{StaticResource?SecondaryTextSolidColorBrush}"/><Setter?Property="BorderBackground"?Value="{StaticResource?BaseSolidColorBrush}"/><Setter?Property="Template"><Setter.Value><ControlTemplate?TargetType="controls:BubblleControl"><Grid?Width="{TemplateBinding?Width}"?Height="{TemplateBinding?Height}"><Border?BorderBrush="{TemplateBinding?BorderBrush}"BorderThickness="{TemplateBinding?BorderThickness}"?Background="{TemplateBinding?BorderBackground}"?Margin="45"CornerRadius="400"x:Name="PART_Border"><Ellipse?Fill="{TemplateBinding?Background}"?Margin="20"/></Border><Ellipse?Fill="{TemplateBinding?EarthBackground}"Width="26"?Height="26"RenderTransformOrigin=".5,.5"x:Name="PART_Ellipse"VerticalAlignment="Top"?Margin="0,35,0,0"><Ellipse.RenderTransform><RotateTransform?x:Name="PART_EllipseRotateTransform"></RotateTransform></Ellipse.RenderTransform><Ellipse.Triggers><EventTrigger?RoutedEvent="Loaded"><BeginStoryboard><Storyboard><DoubleAnimation?Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)"RepeatBehavior="Forever"From="0"?To="360"Duration="00:00:13"></DoubleAnimation></Storyboard></BeginStoryboard></EventTrigger></Ellipse.Triggers></Ellipse><ItemsControl?x:Name="PART_ListBox"ItemsSource="{TemplateBinding?ItemsSource}"><ItemsControl.ItemTemplate><DataTemplate><Grid><Grid?Width="{TemplateBinding?Width}"?Height="{TemplateBinding?Height}"><Ellipse?Fill="{Binding?Bg}"Opacity=".4"/><Ellipse?Stroke="{Binding?Bg}"?StrokeThickness=".8"/></Grid><TextBlock?VerticalAlignment="Center"?HorizontalAlignment="Center"Padding="10,0"><Hyperlink?Foreground="{Binding?Bg}"Command="{x:Static?controls:BubblleControl.ClickCommand}"CommandParameter="{Binding?Text}"FontWeight="Normal"><TextBlock?Text="{Binding?Text}"TextAlignment="Center"TextTrimming="CharacterEllipsis"ToolTip="{Binding?Text}"/></Hyperlink></TextBlock></Grid></DataTemplate></ItemsControl.ItemTemplate><ItemsControl.ItemsPanel><ItemsPanelTemplate><controls:BubblleCanvas/></ItemsPanelTemplate></ItemsControl.ItemsPanel></ItemsControl></Grid></ControlTemplate></Setter.Value></Setter></Style></ResourceDictionary>

5) BubblleControlExample.xaml 代碼如下;

  • TabItem隨機 是自動設置位置和顏色;

  • TabItem自定義 可以自行定義展示的內容;

<UserControl?x:Class="WPFDevelopers.Samples.ExampleViews.BubblleControlExample"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"?xmlns:d="http://schemas.microsoft.com/expression/blend/2008"?xmlns:wpfdev="https://github.com/WPFDevelopersOrg/WPFDevelopers"xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews"xmlns:sys="clr-namespace:System;assembly=mscorlib"mc:Ignorable="d"?d:DesignHeight="450"?d:DesignWidth="800"><Grid><TabControl><TabItem?Header="隨機"><wpfdev:BubblleControl?x:Name="MyBubblleControl"??Click="BubblleControl_Click"><wpfdev:BubblleControl.ItemsSource><x:Array?Type="sys:String"><sys:String>WPF</sys:String><sys:String>ASP.NET</sys:String><sys:String>WinUI</sys:String><sys:String>WebAPI</sys:String><sys:String>Blazor</sys:String><sys:String>MAUI</sys:String><sys:String>Xamarin</sys:String><sys:String>WinForm</sys:String><sys:String>UWP</sys:String></x:Array></wpfdev:BubblleControl.ItemsSource></wpfdev:BubblleControl></TabItem><TabItem?Header="自定義"><wpfdev:BubblleCanvas?Width="400"?Height="400"><Grid><Grid?Width="60"?Height="60"><Ellipse?Fill="MediumSpringGreen"Opacity=".4"/><Ellipse?Stroke="MediumSpringGreen"?StrokeThickness=".8"/></Grid><TextBlock?VerticalAlignment="Center"?HorizontalAlignment="Center"Padding="10,0"><Hyperlink?Foreground="MediumSpringGreen"FontWeight="Normal"Command="{Binding?ClickCommand,RelativeSource={RelativeSource?AncestorType=local:BubblleControlExample}}"><TextBlock?Text="WPF"TextAlignment="Center"TextTrimming="CharacterEllipsis"/></Hyperlink></TextBlock></Grid><Grid><Grid?Width="60"?Height="60"><Ellipse?Fill="Brown"Opacity=".4"/><Ellipse?Stroke="Brown"?StrokeThickness=".8"/></Grid><TextBlock?VerticalAlignment="Center"?HorizontalAlignment="Center"Padding="10,0"><Hyperlink?Foreground="Brown"FontWeight="Normal"Command="{Binding?ClickCommand,RelativeSource={RelativeSource?AncestorType=local:BubblleControlExample}}"><TextBlock?Text="MAUI"TextAlignment="Center"TextTrimming="CharacterEllipsis"/></Hyperlink></TextBlock></Grid><Grid><Grid?Width="60"?Height="60"><Ellipse?Fill="DeepSkyBlue"Opacity=".4"/><Ellipse?Stroke="DeepSkyBlue"?StrokeThickness=".8"/></Grid><TextBlock?VerticalAlignment="Center"?HorizontalAlignment="Center"Padding="10,0"><Hyperlink?Foreground="DeepSkyBlue"FontWeight="Normal"Command="{Binding?ClickCommand,RelativeSource={RelativeSource?AncestorType=local:BubblleControlExample}}"><TextBlock?Text="Blazor"TextAlignment="Center"TextTrimming="CharacterEllipsis"/></Hyperlink></TextBlock></Grid></wpfdev:BubblleCanvas></TabItem></TabControl></Grid>
</UserControl>

6) BubblleControlExample.xaml.cs 代碼如下;

using?System.Windows;
using?System.Windows.Controls;
using?System.Windows.Input;
using?WPFDevelopers.Samples.Helpers;namespace?WPFDevelopers.Samples.ExampleViews
{///?<summary>///?BubbleControlExample.xaml?的交互邏輯///?</summary>public?partial?class?BubblleControlExample?:?UserControl{public?BubblleControlExample(){InitializeComponent();}public?ICommand?ClickCommand?=>?new?RelayCommand(delegate{WPFDevelopers.Minimal.Controls.MessageBox.Show("點擊完成。");});private?void?BubblleControl_Click(object?sender,?System.Windows.RoutedEventArgs?e){MessageBox.Show($"點擊了“?{MyBubblleControl.SelectedText}開發者?”.",?"提示",MessageBoxButton.OK,MessageBoxImage.Information);}}
}
9efd37399eca33e98ef192791a2fdfd6.png

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

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

相關文章

BZOJ 4516: [Sdoi2016]生成魔咒 [后綴自動機]

4516: [Sdoi2016]生成魔咒 題意&#xff1a;詢問一個字符串每個前綴有多少不同的子串 做了一下SDOI2016R1D2&#xff0c;題好水啊隨便AK 強行開map上SAM 每個狀態的貢獻就是\(Max(s)-Min(s)1\) 插入的時候維護一下就行了 #include <iostream> #include <cstdio> #i…

Fiddler抓包5-接口測試(Composer)

前言 Fiddler最大的優勢在于抓包&#xff0c;我們大部分使用的功能也在抓包的功能上&#xff0c;fiddler做接口測試也是非常方便的。 對應沒有接口測試文檔的時候&#xff0c;可以直接抓完包后&#xff0c;copy請求參數&#xff0c;修改下就可以了。 一、Composer簡介 點開右側…

【GlobalMapper精品教程】038:模擬水位上升(洪水淹沒分析)案例教程

基于數字高程模型 ( DEM )格網模型,實現給定水深情況下洪水淹沒區的計算模型,討論洪水淹沒演進過程可視化實現的關鍵技術,以三維可視化方式,動態而形象地模擬在指定洪水水位下的洪水淹沒演進過程。 文章目錄 一、洪水淹沒效果二、洪水淹沒實現三、查詢淹沒區域面積參考教程…

【.NET6+Avalonia】開發支持跨平臺的仿WPF應用程序以及基于ubuntu系統的演示

前言&#xff1a;隨著跨平臺越來越流行&#xff0c;.net core支持跨平臺至今也有好幾年的光景了。但是目前基于.net的跨平臺&#xff0c;大多數還是在使用B/S架構的跨平臺上&#xff1b;至于C/S架構&#xff0c;大部分人可能會選擇QT進行開發&#xff0c;或者很早之前還有一款M…

SOA架構和MSA架構之間的關系

目錄 一、傳統架構&#xff1a;簡單單體模式 二、分布式架構&#xff1a;面向服務架構&#xff08;SOA&#xff09; 1、服務與SOA 2、SOA戰略 3、SOA的兩大基石&#xff1a;RPC和MQ 三、分布式架構&#xff1a;微服務架構&#xff08;MSA&#xff09; 什么是微服務 微服…

Linux系統文件與目錄權限管理

Linux文件目錄權限管理 一、Linux文件屬性及權限 1、Linux文件及目錄權限及屬性說明 &#xff08;1&#xff09;權限及屬性說明 &#xff08;2&#xff09;文件權限說明 三種權限說明&#xff1a;r 讀 read w 寫 write x 執行 excute 2、修改文件屬主及屬組 &#xff08;1&am…

一個文本分詞程序

WordMap類從分詞庫中讀入分詞 將分詞存入unordered_map<std::string, int> 中 #pragma once #include<istream> #include<unordered_map> #include<string> #include<ctime> class WordMap { public:WordMap(const std::string& filename);…

scala學習手記28 - Execute Around模式

我們訪問資源需要關注對資源的鎖定、對資源的申請和釋放&#xff0c;還有考慮可能遇到的各種異常。這些事項本身與代碼的邏輯操作無關&#xff0c;但我們不能遺漏。也就是說進入方法時獲取資源&#xff0c;退出方法時釋放資源。這種處理就進入了Execute Around模式的范疇。 在s…

【時序數據庫InfluxDB】Windows環境下配置InfluxDB+數據可視化,以及使用 C#進行簡單操作的代碼實例...

前言&#xff1a;如題。直接上手擼&#xff0c;附帶各種截圖&#xff0c;就不做介紹了。1、influxDB的官網下載地址 https://portal.influxdata.com/downloads/打開以后&#xff0c;如下圖所示&#xff0c;可以選擇版本號&#xff0c;以及平臺。此處咱們選擇windows平臺。不過…

官宣 微軟跨平臺 UI 框架 .NET MAUI 6 正式發布

微軟宣布 .NET MAUI 已正式 GA。 .NET MAUI (.NET Multi-platform App UI) 是一個跨平臺 UI 框架&#xff08;前身是 Xamarin.Forms&#xff09;&#xff0c;用于通過 C# 和 XAML 創建原生移動和桌面應用。基于 .NET MAUI&#xff0c;開發者可在單個共享代碼庫中創建同時支持 A…

92. Reverse Linked List II

Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m 2 and n 4, return 1->4->3->2->5->NULL. Note:Given m, n satisfy the following condition:1 ≤ m ≤ n ≤ lengt…

Reset

在常用的代碼中&#xff0c;我們使用AddForm.form.reset();或者AddForm.getForm().reset();來將FormPanel重置。 但是當頁面增加和修改公用一個formpanel時&#xff0c;當先點擊修改時&#xff0c;窗體修改顯示出數據&#xff0c;關閉窗體后&#xff08;window.hide()&#xff…

《.NET物聯網從零開始》系列

近日搞硬件網關時&#xff0c;那些殘存的數電、模電和通信原理的記憶時常在腦海中縈繞&#xff1b;想起來多年前看張高興的博客學會了.netcore樹莓派進行物聯網開發。使用dragonboard(龍板)搭載windows 10 iot系統&#xff0c;配合光電傳感器和rfid實現了一個項目原型。碰巧逛g…

設計好接口的 36 個錦囊(原則)

目錄 設計好接口的 36 個錦囊 | 接口參數校驗 | 修改老接口時&#xff0c;注意接口的兼容性 | 設計接口時&#xff0c;充分考慮接口的可擴展性 | 接口考慮是否需要防重處理 | 重點接口&#xff0c;考慮線程池隔離 | 調用第三方接口要考慮異常和超時處理 | 接口實現考慮…

嵌入式第11次實驗

嵌入式軟件設計第11次實驗報告 學號&#xff1a;140201236 姓名&#xff1a;沈樟偉 組別&#xff1a;第2組 實驗地點&#xff1a;D19 一、實驗目的&#xff1a; 1、了解短信AT指令的使用方法。 2、掌握使用短信AT指令驅動SIM900A發送和接收短信的方…

Linux文件系統之df

df用于查看當前掛載的文件系統-a 查看所有的文件系統可以自己指定容量單位&#xff0c;-BM -BG 但是還是h的選項好用-i 查看inode的使用信息-l(L) 顯示本地文件系統--output 可以指定管理員想要看的列--outputField_List可用的字段有source fstype itotal iused iavail ipcent …

普通老實人的生活

2019獨角獸企業重金招聘Python工程師標準>>> 有一個朋友&#xff0c;他家有一套營業房&#xff0c;租給了兩個年輕人&#xff0c;合同簽訂為半年&#xff0c;房租7000&#xff0c;合同到期當天&#xff0c;乙方一直沒有聯系甲方&#xff0c;說明續租或不續租&#x…

如何在 C# 中運行 Python 代碼

前言Python是一門強大的編程語言。特別的是&#xff0c;它還具有眾多出色的庫&#xff08;例如numPy&#xff0c;sciPy&#xff0c;pandas等&#xff09;&#xff0c;可以顯著簡化和加速開發。因此&#xff0c;在解決某些問題時&#xff0c;通過 Python 實現可能是最理想的方式…

Ubuntu開機默認進入命令行模式/用戶圖形界面

一、開機默認進入命令行模式 # 輸入命令&#xff1a; sudo systemctl set-default multi-user.target # 重啟&#xff1a; reboot要進入圖形界面&#xff0c;只需要輸入命令startx 從圖形界面切換回命令行&#xff1a;ctrlaltF7 二、開機默認進入圖形用戶界面 # 輸入命令&…

數組查找數字5

public class Second {/*** param args*/public static void main(String[] args) {// TODO Auto-generated method stubint []a{2,1,3,4,5};for (int i0;i<a.length-1;i){if(a[i]!5){i;}}System.out.println("這組數里有5呢"); }} 轉載于:https://www.cnblogs.co…