public F1_Main() { CatCore core = new CatCore(); InitializeComponent(); core.CatInit(); }
public static bool connectwifi(string ssid, string password = "******", connectmode mode = connectmode.auto) { try { ssid = ssid.Trim(); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string wifitool = config.AppSettings.Settings["wifitool"].Value; string command = $"connect /ssid:{ssid} /password:{password} /username: /domain:"; string wifi_tool_path = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, wifitool, SearchOption.AllDirectories).FirstOrDefault(); if (wifi_tool_path != null) { var p = CatCore.runexe2(wifi_tool_path, command); p.Start(); p.WaitForExit(); Console.WriteLine(p.StandardOutput.ReadToEnd()); Console.WriteLine(p.StandardError.ReadToEnd()); var wifi = new Wifi(); if (wifi.GetAccessPoints().Where(x => x.IsConnected).Select(x => x.Name).FirstOrDefault() == ssid) { return(true); } } } catch (Exception e) { Console.WriteLine($"connectwifi FAIL"); //Console.WriteLine(e.ToString()); } return(false); }
private void F1_Main_Shown(object sender, EventArgs e) { CatCore core = new CatCore(); Task mainRun = new Task(() => core.Execute()); if(CatCore.device != null) lb_sn.Text = CatCore.device.sn; lb_task_index.Text = CatReg.task_id; lb_task_name.Text = CatReg.task_name; lb_task_status.Text = CatReg.task_status; lb_pvt.Text = CatReg.winpvt_version; lb_pws.Text = CatReg.pws_version; lb_app_version.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString(); if (CatCore.device != null) mainRun.Start(); }