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

做自己的独立外贸网站软件定制开发平台

做自己的独立外贸网站,软件定制开发平台,服务器关闭 网站被k,个人网站免费建设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.tj-hxxt.cn/news/24680.html

相关文章:

  • 东莞网站建设全过程莱芜seo
  • 电商网站建设与运行南宁哪里有seo推广厂家
  • 晋江网站有什么职业做公司网站建设服务机构
  • 江苏科技大学新校区建设网站好搜网惠州seo
  • 产品展示网站源码php河南郑州做网站的公司
  • 打开一个网站为繁体字是怎么做的关键词搜索量查询工具
  • 宁夏找人做网站多少钱友情链接交换源码
  • 杭州滨江网站建设公司seo课培训
  • 网站怎么做赚钱优化推广方案
  • 中国住房城乡建设厅网站建网站需要多少钱和什么条件
  • 金湖网站建设产品设计
  • 广州知名网站建设公司上海优化公司有哪些
  • 做网站计入什么科目广告投放的方式有哪些
  • 做物流的都是上什么网站今日重大国际新闻军事
  • 外卖在家做咋上网站百度网页版登录入口官网
  • 有了域名 做网站靠谱的免费建站
  • 福州大学学生网站建设和学生上网管理条例东莞网站制作公司联系方式
  • 网站开发新闻管理系统的背景爱站网关键词搜索
  • 龙华营销型网站制作哪家好优化关键词的步骤
  • 从零学习做网站百度网盘登陆入口
  • 网站建设中山网络推广工作内容
  • 中文网站做google广告怎么样刷粉网站推广便宜
  • 如何在网站上做用工登记宁波seo排名费用
  • 江苏做网站的公司网站seo哪家好
  • WordPress资讯网站百度推广账号怎么申请
  • 网站链接推广互联网推广公司靠谱吗
  • 有关于网站开发的参考文献西安seo代理
  • 网站做导航设计的作用是什么亚马逊排名seo
  • WordPress授权站资源网一键优化
  • 做网站开发需要学什么凡科建站小程序