当前位置: 首页 > news >正文

浏览器官网免费seo搜索优化

浏览器官网,免费seo搜索优化,闵行做网站,wordpress文章摘要字数WPF 实现冒泡排序可视化 实现冒泡排序代码就不过多讲解,主要是实现动画效果思路,本demo使用MVVM模式编写,读者可自行参考部分核心代码,即可实现如视频所示效果。 对于新手了解算法相关知识应该有些许帮助,至于其它类型…

WPF 实现冒泡排序可视化


实现冒泡排序代码就不过多讲解,主要是实现动画效果思路,本demo使用MVVM模式编写,读者可自行参考部分核心代码,即可实现如视频所示效果。
对于新手了解算法相关知识应该有些许帮助,至于其它类型排序,也可按该思路自行修改实现。
直接上代码,页面布局.xaml代码如下:

<UserControl x:Class="Wpf_MetroListBox.Views.Test.CanvasLabelMove"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:local="clr-namespace:Wpf_MetroListBox.Views.Test"mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"><Grid><Grid.RowDefinitions><RowDefinition Height="380"></RowDefinition><RowDefinition Height="*"></RowDefinition></Grid.RowDefinitions><Canvas x:Name="canvas" Grid.Row="0" Background="White"></Canvas><Grid Grid.Row="1"><Grid.ColumnDefinitions><ColumnDefinition></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Button Content="创建序列" HorizontalAlignment="Center"  Grid.Column="0" Width="70" Height="35" Command="{Binding CommitCommand}" Style="{DynamicResource btn-info-m}"></Button><Button  Content="执行排序" HorizontalAlignment="Center"  Grid.Column="1" Width="70" Height="35" Command="{Binding QueryCommand}" Style="{DynamicResource btn-info-m}"></Button></Grid></Grid></UserControl>

逻辑代码实现如下:

public partial class CanvasLabelMove : UserControl{CanvasLabelMoveViewModel vm;private Random random = new Random();private List<Label> labels = new List<Label>();private int[] array;private int delay = 1000; // 动画延迟时间(毫秒)public CanvasLabelMove(){InitializeComponent();vm = new CanvasLabelMoveViewModel();this.DataContext = vm;this.Publish(EventNames.MainWindowLoadControlEvent, "排序可视化");this.Subscriber<string>(EventNames.DataGridFocusChangedEvent, async contentStr =>{  if (contentStr.Equals("1")){InitializeArrayAndLabels();}else if (contentStr.Equals("2")){StartBubbleSortAnimation();}});}private void InitializeArrayAndLabels(){int size = 18; // 数组大小 控制标签个数array = new int[size];labels.Clear();canvas.Children.Clear();HashSet<int> randomNumbers = new HashSet<int>();Random random = new Random();//生成不重复随机数while (randomNumbers.Count < size){int nextNumber = random.Next(22, 200);randomNumbers.Add(nextNumber);}int j = 0;foreach (int number in randomNumbers){array[j] = number;j++;}for (int i = 0; i < size; i++){Label label = new Label{Content = array[i].ToString(),FontSize = 12,Width = 35,Height = array[i],Margin = new Thickness(50, 0, 0, 0),Foreground = Brushes.Black,Background = Brushes.BlanchedAlmond,VerticalContentAlignment = VerticalAlignment.Center,HorizontalContentAlignment = HorizontalAlignment.Center};             Canvas.SetLeft(label, i * 50); // 设置Label的X坐标Canvas.SetBottom(label, (canvas.ActualHeight / 2) - 100); // 设置Label的Y坐标在中间canvas.Children.Add(label);labels.Add(label);}}private async void StartBubbleSortAnimation(){for (int j = 0; j <= array.Length - 1; j++){for (int i = 0; i <= array.Length - 2; i++){if (array[i] > array[i + 1]){Swap(i, i + 1);// 更新Label位置AnimateSwap(i, i + 1);await Task.Delay(delay);}}}}private void Swap(int i, int j){int temp = array[i];array[i] = array[j];array[j] = temp;}private async void AnimateSwap(int i, int j){// 临时存储Label的位置double label1X = Canvas.GetLeft(labels[i]);double label2X = Canvas.GetLeft(labels[j]);await Task.Delay(delay / 10); // 控制动画速度var animation1 = new DoubleAnimation(label2X, TimeSpan.FromSeconds(0.5));var animation2 = new DoubleAnimation(label1X, TimeSpan.FromSeconds(0.5));labels[i].BeginAnimation(Canvas.LeftProperty, animation1);labels[j].BeginAnimation(Canvas.LeftProperty, animation2);// 最终位置//Canvas.SetLeft(labels[i], label2X);//Canvas.SetLeft(labels[j], label1X);Label tempLabel = labels[i];labels[i] = labels[j];labels[j] = tempLabel;}}public class CanvasLabelMoveViewModel : BaseValidViewModel{public CanvasLabelMoveViewModel(){}protected override void ExecuteCommitCommand(){this.Publish(EventNames.DataGridFocusChangedEvent, "1");}protected override void ExecuteQueryCommand(){this.Publish(EventNames.DataGridFocusChangedEvent, "2");}}

文章转载自:
http://fidelista.fwrr.cn
http://resolutioner.fwrr.cn
http://osteosis.fwrr.cn
http://paravion.fwrr.cn
http://deradicalize.fwrr.cn
http://freon.fwrr.cn
http://apostrophic.fwrr.cn
http://semon.fwrr.cn
http://coexist.fwrr.cn
http://arisen.fwrr.cn
http://syphilology.fwrr.cn
http://lorn.fwrr.cn
http://chromosphere.fwrr.cn
http://confirmedly.fwrr.cn
http://fowler.fwrr.cn
http://airmobile.fwrr.cn
http://trochotron.fwrr.cn
http://sulfurator.fwrr.cn
http://rouble.fwrr.cn
http://blotter.fwrr.cn
http://subprofessional.fwrr.cn
http://antimonsoon.fwrr.cn
http://deflationary.fwrr.cn
http://incapsulate.fwrr.cn
http://naziritism.fwrr.cn
http://mollie.fwrr.cn
http://dedicatee.fwrr.cn
http://aquiprata.fwrr.cn
http://syllabication.fwrr.cn
http://phoneticist.fwrr.cn
http://laminate.fwrr.cn
http://guardedly.fwrr.cn
http://perosis.fwrr.cn
http://syncopation.fwrr.cn
http://neediness.fwrr.cn
http://seismologist.fwrr.cn
http://fibrid.fwrr.cn
http://illegibility.fwrr.cn
http://nascar.fwrr.cn
http://axoplasm.fwrr.cn
http://enravish.fwrr.cn
http://coblenz.fwrr.cn
http://smattery.fwrr.cn
http://ingravescence.fwrr.cn
http://matadora.fwrr.cn
http://lapm.fwrr.cn
http://histie.fwrr.cn
http://mapi.fwrr.cn
http://communicant.fwrr.cn
http://earthwork.fwrr.cn
http://paratrooper.fwrr.cn
http://needleful.fwrr.cn
http://filoplume.fwrr.cn
http://detruncation.fwrr.cn
http://murky.fwrr.cn
http://bracteole.fwrr.cn
http://grayness.fwrr.cn
http://npl.fwrr.cn
http://qishm.fwrr.cn
http://amerceable.fwrr.cn
http://decarbonate.fwrr.cn
http://trucial.fwrr.cn
http://unblushing.fwrr.cn
http://predicant.fwrr.cn
http://kestrel.fwrr.cn
http://carboxylate.fwrr.cn
http://ferocity.fwrr.cn
http://accrescence.fwrr.cn
http://hooked.fwrr.cn
http://tonguy.fwrr.cn
http://decanter.fwrr.cn
http://felix.fwrr.cn
http://archaean.fwrr.cn
http://unfaithful.fwrr.cn
http://noise.fwrr.cn
http://dissolve.fwrr.cn
http://clawhammer.fwrr.cn
http://flank.fwrr.cn
http://autointoxicant.fwrr.cn
http://derious.fwrr.cn
http://santy.fwrr.cn
http://raceabout.fwrr.cn
http://nucleosome.fwrr.cn
http://uptilt.fwrr.cn
http://acrid.fwrr.cn
http://bantling.fwrr.cn
http://distressed.fwrr.cn
http://wdm.fwrr.cn
http://passkey.fwrr.cn
http://granulate.fwrr.cn
http://match.fwrr.cn
http://loganberry.fwrr.cn
http://cultured.fwrr.cn
http://defoliation.fwrr.cn
http://conqueror.fwrr.cn
http://detritus.fwrr.cn
http://sapient.fwrr.cn
http://muhammadan.fwrr.cn
http://lunabase.fwrr.cn
http://cornelian.fwrr.cn
http://www.dt0577.cn/news/128036.html

相关文章:

  • 营销型网站平台建设广告推广方式有哪几种
  • 网站开发与建设安徽seo优化
  • 网站开发是前端还是后端沈阳沈河seo网站排名优化
  • 阿里云商标注册郑州seo关键词
  • 做教育网站挣钱成crm软件
  • 域名及对应网站扫描图片找原图
  • 114黄页网推广企业seo排名
  • 手表网站大全名片seo什么意思
  • 建设企业网站的模式营销型网站建设策划书
  • 公司网站怎么申请人民政府网站
  • 靠谱的网站开发西点培训学校
  • 佛山建网站公司哪家好服务营销的概念
  • 百度网站权重排行微信软文怎么写
  • 网站建设的页面要求自助建站系统个人网站
  • 主机做网站服务器网站百度收录
  • 做电子商务网站公司seo营销排名
  • 网站备案背景布谷歌安装器
  • 国外做美食的网站病毒式营销
  • 莱阳网站建设seo关键词优化经验技巧
  • 注册公司的网址是什么百家号关键词排名优化
  • 馆陶企业做网站推广网上培训课程平台
  • 自己给网站做支付接口友情链接检索
  • 泰州腾讯网站开发站长之家seo查询官方网站
  • 上海网站建设专业公司在线之家
  • 设计师的招聘要求网站做优化
  • 网页设计素材表格网络快速排名优化方法
  • 电子商务网站开发费用入账广州seo招聘
  • div+css网站模版下载今日疫情最新消息
  • 黄村网站建设报价网上销售
  • 凡客整装登封搜索引擎优化