[源码下载]

背水一战 Windows 10 (103) - 通知(Toast): 基础, 按计划显示 toast 通知

作者:webabcd

介绍
背水一战 Windows 10 之 通知(Toast)

  • 基础
  • 按计划显示 toast 通知

示例
1、本例用于演示当通过 toast 激活 app 时(前台方式激活),如何获取相关信息
Notification/Toast/Demo.xaml

  1. <Page
  2. x:Class="Windows10.Notification.Toast.Demo"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:local="using:Windows10.Notification.Toast"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. mc:Ignorable="d">
  9.  
  10. <Grid Background="Blue">
  11.  
  12. <TextBlock Name="lblMsg" VerticalAlignment="Center" HorizontalAlignment="Center" />
  13.  
  14. </Grid>
  15. </Page>

Notification/Toast/Demo.xaml.cs

  1. /*
  2. * 本例用于演示当通过 toast 激活 app 时(前台方式激活),如何获取相关信息
  3. *
  4. *
  5. * 在 App.xaml.cs 中 override void OnActivated(IActivatedEventArgs args),以获取相关的 toast 信息
  6. *
  7. * ToastNotificationActivatedEventArgs - 通过 toast 激活应用程序时(前台方式激活)的事件参数
  8. * Argument - 由 toast 传递过来的参数
  9. * UserInput - 由 toast 传递过来的输入框数据
  10. * Kind - 此 app 被激活的类型(ActivationKind 枚举)
  11. * 比如,如果是通过“打开文件”激活的话,则此值为 File
  12. * PreviousExecutionState - 此 app 被激活前的状态(ApplicationExecutionState 枚举)
  13. * 比如,如果此 app 被激活前就是运行状态的或,则此值为 Running
  14. * SplashScreen - 获取此 app 的 SplashScreen 对象
  15. * User - 获取激活了此 app 的 User 对象
  16. */
  17.  
  18. using System;
  19. using Windows.ApplicationModel.Activation;
  20. using Windows.UI.Xaml.Controls;
  21. using Windows.UI.Xaml.Navigation;
  22.  
  23. namespace Windows10.Notification.Toast
  24. {
  25. public sealed partial class Demo : Page
  26. {
  27. private ToastNotificationActivatedEventArgs _toastArgs;
  28.  
  29. public Demo()
  30. {
  31. this.InitializeComponent();
  32. }
  33.  
  34. protected override void OnNavigatedTo(NavigationEventArgs e)
  35. {
  36. // 获取 ToastNotificationActivatedEventArgs 对象(从 App.xaml.cs 传来的)
  37. _toastArgs = e.Parameter as ToastNotificationActivatedEventArgs;
  38.  
  39. if (_toastArgs != null)
  40. {
  41. // 获取 toast 的参数
  42. lblMsg.Text = "argument: " + _toastArgs.Argument;
  43. lblMsg.Text += Environment.NewLine;
  44.  
  45. // 获取 toast 的 输入框数据
  46. // UserInput 是一个 ValueSet 类型的数据,其继承自 IEnumerable 接口,可以 foreach(不能 for)
  47. foreach (string key in _toastArgs.UserInput.Keys)
  48. {
  49. lblMsg.Text += $"key:{key}, value:{_toastArgs.UserInput[key]}";
  50. lblMsg.Text += Environment.NewLine;
  51. }
  52. }
  53. }
  54. }
  55. }

2、本例用于演示 toast 的基础
Notification/Toast/Basic.xaml

  1. <Page
  2. x:Class="Windows10.Notification.Toast.Basic"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:local="using:Windows10.Notification.Toast"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. mc:Ignorable="d">
  9.  
  10. <Grid Background="Transparent">
  11. <StackPanel Margin="10 0 10 10">
  12.  
  13. <Button Name="buttonShowToast1" Content="显示 toast" Click="buttonShowToast1_Click" Margin="5" />
  14.  
  15. <Button Name="buttonShowToast2" Content="显示 toast(设置 toast 的过期时间)" Click="buttonShowToast2_Click" Margin="5" />
  16.  
  17. <Button Name="buttonShowToast3" Content="显示 toast(无 toast 通知 UI,仅放置于操作中心)" Click="buttonShowToast3_Click" Margin="5" />
  18.  
  19. </StackPanel>
  20. </Grid>
  21. </Page>

Notification/Toast/Basic.xaml.cs

  1. /*
  2. * 本例用于演示 toast 的基础
  3. * 单击 toast 激活 app 后(前台方式激活),如何获取相关信息请参见 Demo.xaml.cs 中的代码
  4. *
  5. *
  6. * ToastNotification - toast 通知
  7. * Content - 一个 Windows.Data.Xml.Dom.XmlDocument 类型的对象(在构造函数中需要传递此对象),用于描述 toast 的 xml
  8. * SuppressPopup - 默认值为 false
  9. * false - 弹出 toast 通知,并放置于操作中心
  10. * true - 不弹出 toast 通知,仅放置于操作中心
  11. * ExpirationTime - 过期时间,超过这个时间就会从操作中心中移除
  12. * ToastNotificationPriority - 优先级(Default 或 High)
  13. * Group, Tag - 用于标识 toast 对象(前 16 个字符相同则认为相同)
  14. * 同 group 且同 tag 则视为同一 toast,即新 toast 会更新旧 toast
  15. * 系统会将所用未指定 group 的 toast 视为同 group
  16. * 系统会将所用未指定 tag 的 toast 视为不同 tag
  17. * Activated - 通过 toast 激活 app 时触发的事件
  18. * Dismissed - 弹出的 toast 通知 UI 消失时触发的事件
  19. * Failed - 弹出 toast 通知时失败
  20. *
  21. * ToastNotificationManager - toast 通知管理器
  22. * CreateToastNotifier() - 创建 ToastNotifier 对象
  23. * History - 获取 ToastNotificationHistory 对象
  24. *
  25. * ToastNotifier - toast 通知器
  26. * Show(ToastNotification notification) - 弹出指定的 toast 通知
  27. * Hide(ToastNotification notification) - 移除指定的 toast 通知
  28. * Setting - 获取系统的通知设置
  29. * Enabled - 通知可被显示
  30. * DisabledForApplication - 用户禁用了此应用程序的通知
  31. * DisabledForUser - 用户禁用了此计算机此账户的所有通知
  32. * DisabledByGroupPolicy - 管理员通过组策略禁止了此计算机上的所有通知
  33. * DisabledByManifest - 应用程序未在 Package.appxmanifest 中设置“应用图标”(其实你要是不设置的话编译都不会通过)
  34. *
  35. * ToastNotificationHistory - 本 app 的 toast 通知历史
  36. * Clear() - 全部清除(从操作中心中移除)
  37. * RemoveGroup() - 清除指定 group 的通知(从操作中心中移除)
  38. * Remove() - 清除指定 tag 的通知或清除指定 tag 和 group 的通知(从操作中心中移除)
  39. * GetHistory() - 获取历史数据,一个 ToastNotification 类型对象的集合(已被从操作中心中移除的是拿不到的)
  40. *
  41. *
  42. *
  43. * 注:本例是通过 xml 来构造 toast 的,另外也可以通过 NuGet 的 Microsoft.Toolkit.Uwp.Notifications 来构造 toast(其用 c# 对 xml 做了封装)
  44. */
  45.  
  46. using System;
  47. using System.Diagnostics;
  48. using Windows.Data.Xml.Dom;
  49. using Windows.UI.Notifications;
  50. using Windows.UI.Xaml;
  51. using Windows.UI.Xaml.Controls;
  52.  
  53. namespace Windows10.Notification.Toast
  54. {
  55. public sealed partial class Basic : Page
  56. {
  57. public Basic()
  58. {
  59. this.InitializeComponent();
  60. }
  61.  
  62. // 弹出 toast 通知
  63. private void buttonShowToast1_Click(object sender, RoutedEventArgs e)
  64. {
  65. // 清除本 app 的之前的全部 toast 通知
  66. // ToastNotificationManager.History.Clear();
  67.  
  68. // 用于描述 toast 通知的 xml 字符串
  69. string toastXml = $@"
  70. <toast activationType='foreground' launch='Notification-Toast-Basic-Arguments 1'>
  71. <visual>
  72. <binding template='ToastGeneric'>
  73. <text>toast - title</text>
  74. <text>toast - content 1 {DateTime.Now.ToString("mm:ss")}</text>
  75. </binding>
  76. </visual>
  77. </toast>";
  78.  
  79. // 将 xml 字符串转换为 Windows.Data.Xml.Dom.XmlDocument 对象
  80. XmlDocument toastDoc = new XmlDocument();
  81. toastDoc.LoadXml(toastXml);
  82.  
  83. // 实例化 ToastNotification 对象
  84. ToastNotification toast = new ToastNotification(toastDoc);
  85. // 系统会将所用未指定 group 的 toast 视为同 group
  86. // 同 group 且同 tag 则视为同一 toast,即新 toast 会更新旧 toast
  87. toast.Tag = "";
  88.  
  89. toast.Activated += Toast_Activated;
  90. toast.Dismissed += Toast_Dismissed;
  91. toast.Failed += Toast_Failed;
  92.  
  93. // 弹出 toast 通知
  94. ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();
  95. toastNotifier.Show(toast);
  96. }
  97.  
  98. // 弹出 toast 通知(设置 toast 的过期时间)
  99. private void buttonShowToast2_Click(object sender, RoutedEventArgs e)
  100. {
  101. // 清除本 app 的之前的全部 toast 通知
  102. // ToastNotificationManager.History.Clear();
  103.  
  104. string toastXml = $@"
  105. <toast activationType='foreground' launch='Notification-Toast-Basic-Arguments 2'>
  106. <visual>
  107. <binding template='ToastGeneric'>
  108. <text>toast - title</text>
  109. <text>toast - content 2 {DateTime.Now.ToString("mm:ss")}</text>
  110. </binding>
  111. </visual>
  112. </toast>";
  113.  
  114. XmlDocument toastDoc = new XmlDocument();
  115. toastDoc.LoadXml(toastXml);
  116.  
  117. ToastNotification toast = new ToastNotification(toastDoc);
  118. DateTimeOffset expirationTime = DateTimeOffset.UtcNow.AddSeconds();
  119. toast.ExpirationTime = expirationTime; // 30 秒后 toast 通知将从操作中心中移除
  120.  
  121. // 系统会将所用未指定 group 的 toast 视为同 group
  122. // 系统会将所用未指定 tag 的 toast 视为不同 tag(此时虽然获取 tag 时其为空字符串,但是系统会认为其是一个随机值)
  123. // 每次弹出此 toast 时都会被认为是一个全新的 toast
  124. // toast.Tag = "2";
  125.  
  126. toast.Activated += Toast_Activated;
  127. toast.Dismissed += Toast_Dismissed;
  128. toast.Failed += Toast_Failed;
  129.  
  130. ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();
  131. toastNotifier.Show(toast);
  132. }
  133.  
  134. // 弹出 toast 通知(无 toast 通知 UI,仅放置于操作中心)
  135. private void buttonShowToast3_Click(object sender, RoutedEventArgs e)
  136. {
  137. // 清除本 app 的之前的全部 toast 通知
  138. // ToastNotificationManager.History.Clear();
  139.  
  140. string toastXml = $@"
  141. <toast activationType='foreground' launch='Notification-Toast-Basic-Arguments 3'>
  142. <visual>
  143. <binding template='ToastGeneric'>
  144. <text>toast - title</text>
  145. <text>toast - content 3 {DateTime.Now.ToString("mm:ss")}</text>
  146. </binding>
  147. </visual>
  148. </toast>";
  149.  
  150. XmlDocument toastDoc = new XmlDocument();
  151. toastDoc.LoadXml(toastXml);
  152.  
  153. ToastNotification toast = new ToastNotification(toastDoc);
  154. toast.SuppressPopup = true; // 不会弹出 toast 通知 UI,但是会放置于操作中心
  155. toast.Tag = "";
  156.  
  157. toast.Activated += Toast_Activated;
  158. toast.Dismissed += Toast_Dismissed;
  159. toast.Failed += Toast_Failed;
  160.  
  161. ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();
  162. toastNotifier.Show(toast);
  163. }
  164.  
  165. private void Toast_Activated(ToastNotification sender, object args)
  166. {
  167. Debug.WriteLine(sender.Tag + " Toast_Activated");
  168. }
  169.  
  170. private void Toast_Dismissed(ToastNotification sender, ToastDismissedEventArgs args)
  171. {
  172. Debug.WriteLine(sender.Tag + " Toast_Dismissed");
  173. }
  174.  
  175. private void Toast_Failed(ToastNotification sender, ToastFailedEventArgs args)
  176. {
  177. Debug.WriteLine(sender.Tag + " Toast_Failed");
  178. }
  179. }
  180. }

3、演示如何按计划显示 toast 通知(在指定的时间显示指定的 toast 通知)
Notification/Toast/Schedule.xaml

  1. <Page
  2. x:Class="Windows10.Notification.Toast.Schedule"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:local="using:Windows10.Notification.Toast"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. mc:Ignorable="d">
  9.  
  10. <Grid Background="Transparent">
  11. <StackPanel Margin="10 0 10 10">
  12.  
  13. <!--显示当前 app 的全部 ScheduledToastNotification 对象列表-->
  14. <ListBox Name="listBox" Width="800" Height="400" Margin="5" HorizontalAlignment="Left">
  15. <ListBox.ItemTemplate>
  16. <DataTemplate>
  17. <StackPanel Orientation="Horizontal">
  18. <TextBlock Text="{Binding Id}" VerticalAlignment="Center" />
  19. <TextBlock Text="{Binding Tag}" Margin="15 0 0 0" VerticalAlignment="Center" />
  20. <HyperlinkButton Name="btnRemoveScheduledToast" Content="删除此 ScheduledToastNotification" Tag="{Binding Id}" Margin="15 0 0 0" Click="btnRemoveScheduledToast_Click" />
  21. </StackPanel>
  22. </DataTemplate>
  23. </ListBox.ItemTemplate>
  24. </ListBox>
  25.  
  26. <Button Name="btnAddScheduledToast" Content="添加指定的 ScheduledToastNotification 到计划列表中" Click="btnAddScheduledToast_Click" Margin="5" />
  27.  
  28. </StackPanel>
  29. </Grid>
  30. </Page>

Notification/Toast/Schedule.xaml.cs

  1. /*
  2. * 演示如何按计划显示 toast 通知(在指定的时间显示指定的 toast 通知)
  3. *
  4. * ScheduledToastNotification - 按计划显示 Toast 通知
  5. * Content - Toast 的内容,XmlDocument 类型的数据,只读,其需要在构造函数中指定
  6. * DeliveryTime - 显示 Toast 通知的时间,只读,其需要在构造函数中指定
  7. * SnoozeInterval - 循环显示 Toast 通知的间隔时长(60 秒 - 60 分之间),只读,其需要在构造函数中指定(经测试,此逻辑无效)
  8. * MaximumSnoozeCount - 循环的最大次数(1 - 5 次),只读,其需要在构造函数中指定(经测试,此逻辑无效)
  9. * Id - ScheduledToastNotification 的标识
  10. * Group, Tag - 用于标识 toast 对象(前 16 个字符相同则认为相同)
  11. * 同 group 且同 tag 则视为同一 toast,即新 toast 会更新旧 toast
  12. * 系统会将所用未指定 group 的 toast 视为同 group
  13. * 系统会将所用未指定 tag 的 toast 视为不同 tag
  14. * SuppressPopup - 默认值为 false
  15. * false - 弹出 toast 通知,并放置于操作中心
  16. * true - 不弹出 toast 通知,仅放置于操作中心
  17. *
  18. * ToastNotifier - toast 通知器
  19. * AddToSchedule() - 将指定的 ScheduledToastNotification 对象添加到计划列表
  20. * RemoveFromSchedule() - 从计划列表中移除指定的 ScheduledToastNotification 对象
  21. * GetScheduledToastNotifications() - 获取当前 app 的全部 ScheduledToastNotification 对象列表
  22. */
  23.  
  24. using System;
  25. using System.Collections.Generic;
  26. using Windows.Data.Xml.Dom;
  27. using Windows.UI.Notifications;
  28. using Windows.UI.Xaml;
  29. using Windows.UI.Xaml.Controls;
  30. using Windows.UI.Xaml.Navigation;
  31.  
  32. namespace Windows10.Notification.Toast
  33. {
  34. public sealed partial class Schedule : Page
  35. {
  36. public Schedule()
  37. {
  38. this.InitializeComponent();
  39. }
  40.  
  41. protected override void OnNavigatedTo(NavigationEventArgs e)
  42. {
  43. ShowScheduledToasts();
  44. }
  45.  
  46. // 添加指定的 ScheduledToastNotification 到计划列表中
  47. private void btnAddScheduledToast_Click(object sender, RoutedEventArgs e)
  48. {
  49. string toastXml = $@"
  50. <toast activationType='foreground' launch='Notification-Toast-Schedule-Arguments'>
  51. <visual>
  52. <binding template='ToastGeneric'>
  53. <text>toast - title</text>
  54. <text>toast - content {DateTime.Now.ToString("mm:ss")}</text>
  55. </binding>
  56. </visual>
  57. </toast>";
  58.  
  59. // 将 xml 字符串转换为 Windows.Data.Xml.Dom.XmlDocument 对象
  60. XmlDocument toastDoc = new XmlDocument();
  61. toastDoc.LoadXml(toastXml);
  62.  
  63. // 实例化 ScheduledToastNotification 对象(15 秒后显示此 Toast 通知,然后每隔 60 秒再显示一次 Toast,循环显示 5 次)
  64. // 但是经测试,只会显示一次,无法循环显示,不知道为什么
  65. // ScheduledToastNotification toastNotification = new ScheduledToastNotification(toastDoc, DateTime.Now.AddSeconds(15), TimeSpan.FromSeconds(60), 5);
  66.  
  67. // 实例化 ScheduledToastNotification 对象(15 秒后显示此 Toast 通知)
  68. ScheduledToastNotification toastNotification = new ScheduledToastNotification(toastDoc, DateTime.Now.AddSeconds());
  69.  
  70. toastNotification.Id = new Random().Next(, ).ToString();
  71. toastNotification.Tag = toastDoc.GetElementsByTagName("text")[].InnerText;
  72.  
  73. // 将指定的 ScheduledToastNotification 添加进计划列表
  74. ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();
  75. toastNotifier.AddToSchedule(toastNotification);
  76.  
  77. ShowScheduledToasts();
  78. }
  79.  
  80. // 删除指定的 ScheduledToastNotification 对象
  81. private void btnRemoveScheduledToast_Click(object sender, RoutedEventArgs e)
  82. {
  83. string notificationId = (string)(sender as FrameworkElement).Tag;
  84.  
  85. // 获取当前 app 的全部 ScheduledToastNotification 对象列表
  86. ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();
  87. IReadOnlyList<ScheduledToastNotification> notifications = toastNotifier.GetScheduledToastNotifications();
  88.  
  89. int notificationCount = notifications.Count;
  90. for (int i = ; i < notificationCount; i++)
  91. {
  92. if (notifications[i].Id == notificationId)
  93. {
  94. // 从计划列表中移除指定的 ScheduledToastNotification 对象
  95. toastNotifier.RemoveFromSchedule(notifications[i]);
  96. break;
  97. }
  98. }
  99.  
  100. ShowScheduledToasts();
  101. }
  102.  
  103. // 显示当前 app 的全部 ScheduledToastNotification 列表
  104. private void ShowScheduledToasts()
  105. {
  106. // 获取当前 app 的全部 ScheduledToastNotification 对象列表
  107. ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();
  108. IReadOnlyList<ScheduledToastNotification> notifications = toastNotifier.GetScheduledToastNotifications();
  109.  
  110. listBox.ItemsSource = notifications;
  111. }
  112. }
  113. }

OK
[源码下载]

背水一战 Windows 10 (103) - 通知(Toast): 基础, 按计划显示 toast 通知的更多相关文章

  1. 背水一战 Windows 10 (110) - 通知(Tile): secondary tile 模板之基础, secondary tile 模板之文本

    [源码下载] 背水一战 Windows 10 (110) - 通知(Tile): secondary tile 模板之基础, secondary tile 模板之文本 作者:webabcd 介绍背水一 ...

  2. 背水一战 Windows 10 (109) - 通知(Tile): 按计划显示 tile 通知, 轮询服务端以更新 tile 通知

    [源码下载] 背水一战 Windows 10 (109) - 通知(Tile): 按计划显示 tile 通知, 轮询服务端以更新 tile 通知 作者:webabcd 介绍背水一战 Windows 1 ...

  3. 背水一战 Windows 10 (108) - 通知(Tile): application tile 基础, secondary tile 基础

    [源码下载] 背水一战 Windows 10 (108) - 通知(Tile): application tile 基础, secondary tile 基础 作者:webabcd 介绍背水一战 Wi ...

  4. 背水一战 Windows 10 (107) - 通知(Toast): 提示音, 特定场景

    [源码下载] 背水一战 Windows 10 (107) - 通知(Toast): 提示音, 特定场景 作者:webabcd 介绍背水一战 Windows 10 之 通知(Toast) 提示音 特定场 ...

  5. 背水一战 Windows 10 (106) - 通知(Toast): 通过 toast 打开协议, 通过 toast 选择在指定的时间之后延迟提醒或者取消延迟提醒

    [源码下载] 背水一战 Windows 10 (106) - 通知(Toast): 通过 toast 打开协议, 通过 toast 选择在指定的时间之后延迟提醒或者取消延迟提醒 作者:webabcd ...

  6. 背水一战 Windows 10 (105) - 通知(Toast): 带按钮的 toast, 带输入的 toast(文本输入框,下拉选择框)

    [源码下载] 背水一战 Windows 10 (105) - 通知(Toast): 带按钮的 toast, 带输入的 toast(文本输入框,下拉选择框) 作者:webabcd 介绍背水一战 Wind ...

  7. 背水一战 Windows 10 (104) - 通知(Toast): 纯文本 toast, 短时 toast, 长时 toast, 图文 toast

    [源码下载] 背水一战 Windows 10 (104) - 通知(Toast): 纯文本 toast, 短时 toast, 长时 toast, 图文 toast 作者:webabcd 介绍背水一战 ...

  8. 背水一战 Windows 10 (121) - 后台任务: 推送通知

    [源码下载] 背水一战 Windows 10 (121) - 后台任务: 推送通知 作者:webabcd 介绍背水一战 Windows 10 之 后台任务 推送通知 示例演示如何接收推送通知/WebA ...

  9. 背水一战 Windows 10 (118) - 后台任务: 后台下载任务(任务分组,并行或串行执行,组完成后通知)

    [源码下载] 背水一战 Windows 10 (118) - 后台任务: 后台下载任务(任务分组,并行或串行执行,组完成后通知) 作者:webabcd 介绍背水一战 Windows 10 之 后台任务 ...

随机推荐

  1. jvm排查问题常用命令及注释

    本文将介绍JDK自带的JVM排查工具.其提供的排查工具有: (1)jps:JVM Process Status Tool,显示系统内所有的JVM进程: (2)jstat:JVM Statistics ...

  2. Taro-ui TabBar组件使用路由跳转

    1. 安装taro-ui (此处使用cnpm) cnpm install taro-ui 2. 全局引入样式 app.scss sass :@import "~taro-ui/dist/st ...

  3. http 6000端口 chrome ERR_UNSAFE_PORT

    参考原因 折腾了半天.chrome的提示真不够意思,还是火狐的提示厉害,知道真相的我眼泪流下来.

  4. ES6基本使用

    var let 度可用于声明变量. 区别:1.let:只在let命令所在代码块内有效 2.let 不存在变量提升(内部影响不到外部) var b = []; ;j<;j++){ let d=j; ...

  5. C# 使用运算符重载 简化结果判断

    执行某个方法后, 一般都要对执行结果判断, 如果执行不成功, 还需要显示错误信息, 我先后使用了下面几种方式 /// <summary> /// 返回int类型结果, msg输出错误信息 ...

  6. spring微服务架构-脑图

    spring团队对新一代软件开发的思索.为什么软件开发是spring boot?为什么软件开发是spring cloud?如何使用spring cloud搭建微服务. 清晰脑图查看

  7. grunt压缩js代码

    安装node.js的环境和grunt插件在上一篇已经将过,点击这里跳到上一篇 所以我们直接从压缩插件的安装开始讲 起 1.安装uglify插件 目录结构如下: 命令行:npm install grun ...

  8. java--利用DecimalFormat.java类将给定的数字进行格式化

    1.数字格式化元素:# 任意数字, 千分位. 小数点0 不够补0 2.实例 //及得import java.text.DecimalFormat import java.text.DecimalFor ...

  9. cytoscape.js

    http://js.cytoscape.org/ HTML 报告中插入动态网络关系图利器

  10. Python 验证码识别-- tesserocr

    Python 验证码识别-- tesserocr tesserocr 是 Python 的一个 OCR 识别库 ,但其实是对 tesseract 做的一 层 Python API 封装,所以它的核心是 ...