silverlight 做一个QQ式的消息提示窗

本文介绍如何使用C#在Silverlight应用中实现Toast通知功能,通过创建自定义的消息提示窗,并提供了完整的代码示例。

消息提示窗英文名叫Toastnotifications,Toast是吐司的意思,就是烤面包片

起初看到这个名字挺费解,这跟吐司有什么关系,后来终于明白,老外烤吐司的时候是这么做的,把很多面包片放进吐司机里,就是专门烤吐司的面包机,待烤好以后,吐司机会把面包弹起来,此时就是弹出的提示窗口一样,这种比喻很形像

下面进入正题,直接上代码

MainPage xaml部分

<UserControl x:Class="NotifyApplication.MainPage" 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" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <Button Height="30" Width="200" Content="Display Notify Window" Click="Button_Click"/> </Grid> </UserControl>

code部分主要是一个用来调出提示框的按钮

using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace NotifyApplication { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { if(App.Current.IsRunningOutOfBrowser) { var notify = new NotificationWindow(); var win = new NotifyWindow { Header = {Text = "Custom Message Header"}, Description = {Text = "This is a custom description."} }; notify.Width = win.Width; notify.Height = win.Height; notify.Content = win; notify.Show(5000); } } } }

提示框是一个用户控件

<UserControl x:Class="NotifyApplication.NotifyWindow" 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" mc:Ignorable="d" Height="75" Width="300"> <Grid x:Name="LayoutRoot" Background="White"> <Border Background="#DDDDDD" BorderBrush="Black" BorderThickness="2"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="0.113*"/> <RowDefinition Height="0.306*"/> <RowDefinition Height="0.582*"/> </Grid.RowDefinitions> <Rectangle Fill="#FF747474" Stroke="White" StrokeThickness="0" Grid.ColumnSpan="2"/> <TextBlock TextWrapping="Wrap" Text="x" HorizontalAlignment="Right" Margin="0,0,5,0" Grid.Row="1" FontFamily="Verdana" FontWeight="Bold" FontSize="13"/> <TextBlock Name="Header" TextWrapping="Wrap" Text="Header Text" Grid.Row="1" FontWeight="Bold" VerticalAlignment="Bottom" FontSize="13" Margin="5,0,5,0" FontFamily="Tahoma"/> <TextBlock Name="Description" TextWrapping="Wrap" Text="Notification Text" Grid.Row="2" FontSize="11" FontFamily="Verdana" Margin="5,0,5,0"/> </Grid> </Border> </Grid> </UserControl>

用这里还没完,要设置成可在浏览器外运行

右键点silverlight 项目-->silverlight 标签页 -->Enable running application out of the browser 打上勾

内容概要:本文围绕六自由度机械臂的人工神经网络(ANN)设计展开,重点研究了正向与逆向运动学求解、正向动力学控制以及基于拉格朗日-欧拉法推导逆向动力学方程,并通过Matlab代码实现相关算法。文章结合理论推导与仿真实践,利用人工神经网络对复杂的非线性关系进行建模与逼近,提升机械臂运动控制的精度与效率。同时涵盖了路径规划中的RRT算法与B样条优化方法,形成从运动学到动力学再到轨迹优化的完整技术链条。; 适合人群:具备一定机器人学、自动控制理论基础,熟悉Matlab编程,从事智能控制、机器人控制、运动学六自由度机械臂ANN人工神经网络设计:正向逆向运动学求解、正向动力学控制、拉格朗日-欧拉法推导逆向动力学方程(Matlab代码实现)建模等相关方向的研究生、科研人员及工程技术人员。; 使用场景及目标:①掌握机械臂正/逆运动学的数学建模与ANN求解方法;②理解拉格朗日-欧拉法在动力学建模中的应用;③实现基于神经网络的动力学补偿与高精度轨迹跟踪控制;④结合RRT与B样条完成平滑路径规划与优化。; 阅读建议:建议读者结合Matlab代码动手实践,先从运动学建模入手,逐步深入动力学分析与神经网络训练,注重理论推导与仿真实验的结合,以充分理解机械臂控制系统的设计流程与优化策略。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值