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

先搭建网站还是先做ui网络广告推广方式

先搭建网站还是先做ui,网络广告推广方式,中国十大网络安全龙头,新疆住房建设厅网站1、在项目中用nuget引入Hardcodet.NotifyIcon.Wpf。如下图所示。 2、在App.xaml中创建托盘界面&#xff0c;代码是写在 App.xaml 里面 注意在application中一定要加入这一行代码&#xff1a; xmlns:tb"http://www.hardcodet.net/taskbar" 然后在<Application.R…

1、在项目中用nuget引入Hardcodet.NotifyIcon.Wpf。如下图所示。

2、在App.xaml中创建托盘界面,代码是写在 App.xaml 里面

注意在application中一定要加入这一行代码: xmlns:tb="http://www.hardcodet.net/taskbar"

然后在<Application.Resources>中加入如下代码
 

    <Application.Resources><ContextMenu x:Shared="false" x:Key="SysTrayMenu"><MenuItem Height="25" Header="显示界面" Command="{Binding NotifyCommand}" CommandParameter="1"></MenuItem><MenuItem Height="25" Header="隐藏界面" Command="{Binding NotifyCommand}" CommandParameter="0"></MenuItem><Separator /><MenuItem Height="25" Header="退出服务" Command="{Binding NotifyCommand}" CommandParameter="99"></MenuItem></ContextMenu><tb:TaskbarIcon x:Key="Taskbar" ToolTipText=""DoubleClickCommand="{Binding NotifyCommand}"  DoubleClickCommandParameter="1"ContextMenu="{StaticResource SysTrayMenu}" IconSource="/jqsw.ico"><tb:TaskbarIcon.TrayToolTip><Border Background="LightYellow" CornerRadius="5" Opacity="0.8" Padding="10"><StackPanel Orientation="Vertical"><TextBlock Text="温湿度数据采集服务网口版" Foreground="Red"/><!--<TextBlock Text="{Binding SystemTime}" Foreground="Red"/>--></StackPanel></Border></tb:TaskbarIcon.TrayToolTip></tb:TaskbarIcon></Application.Resources>

3、创建ViewModelBase类。再创建TaskbarIconViewModel类继承ViewModelBase类

internal class ViewModelBase : INotifyPropertyChanged{public event PropertyChangedEventHandler  PropertyChanged ;protected void RaisePropertyChanged(string property){PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));}}internal class TaskbarIconViewModel : ViewModelBase{private string systemTime;public string SystemTime{get { return systemTime; }set { systemTime = value; RaisePropertyChanged("SystemTime"); }}public DelegateCommand NotifyCommand{get{return new DelegateCommand((type) =>{if (type.ToString() == "0")Application.Current.MainWindow.Hide();if (type.ToString() == "1"){Application.Current.MainWindow.Show();Application.Current.MainWindow.Activate();}if (type.ToString() == "99")Application.Current.Shutdown();});}}} 

、在App.xaml.cs中写入如下代码:

private static System.Threading.Mutex mutex;protected override void OnStartup(StartupEventArgs e){mutex = new System.Threading.Mutex(true, "TemCollSrvTwo");if (mutex.WaitOne(0, false)){base.OnStartup(e);}else{MessageBox.Show("程序已经在运行!", "提示");this.Shutdown();} mTaskbarIcon = (TaskbarIcon)FindResource("Taskbar");mTaskbarIcon.DataContext = new TaskbarIconViewModel();}public static TaskbarIcon  mTaskbarIcon;4031

5、效果展示

http://www.hkea.cn/news/3713/

相关文章:

  • 南京行业门户网站百度广告价格
  • 建设一个平台网站需要多少钱聚名网官网
  • 谷歌有趣的网站开封网站快速排名优化
  • 医院网站建设的特点安徽网站开发哪家好
  • 定安网站制作最新新闻国内大事件
  • c asp.net 做网站全网营销方案
  • 个人业务网站建设产品线上推广方式都有哪些
  • 上海 网站建设google短视频培训课程
  • 深圳租房建设局网站首页百度世界排名
  • 甘肃电子商务网站建设网络营销网站推广方案
  • 做网站需要的执照宁波seo行者seo09
  • 网站建设的网络百度快速收录教程
  • 网站中文域名怎么做bing搜索 国内版
  • 网站优化的基本思想与原则整站优化加盟
  • 专门找事做的网站百度渠道开户
  • wordpress 4.8.6下载搜索关键词排名优化软件
  • 哪个网站可以做电视背景墙品牌推广策略
  • 做1个自己的贷款网站seo图片优化
  • 山西做网站运营的公司免费发布推广信息的平台
  • WordPress腾讯对象存储宁波正规seo快速排名公司
  • wordpress企业网站教程免费推广的途径与原因
  • 网站建设whjzyhapp推广策划方案
  • 教育培训网站建设ppt无锡做网站的公司
  • 做网站设计多少钱灰色行业关键词推广
  • 怎么给钓鱼网站做防红安徽网站建设优化推广
  • 惠州网站建设一般多少钱seo独立站
  • 虚拟主机网站301跳转2023网站推广入口
  • 做营销网站公司腾讯会议多少钱一个月
  • 郑州电子商务网站建设看片子用什么app免费苹果手机
  • 网站404页面做晚了网站推广方案有哪些