Home.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using ShareWifi.Utils.Net;
  11. using ShareWifi.Views.Components;
  12. using ShareWifi.Model;
  13. namespace ShareWifi.Views
  14. {
  15. public partial class Home : UserControl
  16. {
  17. WifiModel wifiModel;
  18. public Home()
  19. {
  20. InitializeComponent();
  21. }
  22. public static Home getInstance()
  23. {
  24. return new Home();
  25. }
  26. public override bool Equals(object obj)
  27. {
  28. return obj is Home home &&
  29. EqualityComparer<WifiModel>.Default.Equals(wifiModel, home.wifiModel);
  30. }
  31. private void btnGenerate_Click(object sender, EventArgs e)
  32. {
  33. string ssid = WifiUtils.getSSID();
  34. if (ssid != "" || ssid != null)
  35. {
  36. //查找密码
  37. string v = WifiUtils.getSSDIPassword(ssid);
  38. //生成二维码
  39. btnGenerate.Text = v;
  40. }
  41. else
  42. {
  43. SimpleAlert simpleAlert = SimpleAlert.getInstance();
  44. simpleAlert.Show("请链接 WIFI 后才可以分享!");
  45. }
  46. }
  47. }
  48. }