private void SendFileBtn_Click(object sender, RoutedEventArgs e) { if (imagePicked) { EV3.ConnectToBrick(); if (EV3.Connected) { EV3.Disconnect(); if (imagePicked) { SendFileBtn.IsEnabled = false; FileConverter.ConvertFile(System.IO.Path.ChangeExtension(FileLoader.filePath, ".rtf")); //FileSender.ConnectAndSend(); companion = new Process(); companion.StartInfo.UseShellExecute = true; companion.StartInfo.Arguments = FileConverter.outputPath; companion.StartInfo.FileName = "EV3Comm.exe"; companion.StartInfo.CreateNoWindow = true; companion.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; //companion.EnableRaisingEvents = true; //companion.Exited += Companion_Exited; try { companion.Start(); } catch (Exception) { UIMessage.ShowError("Companion app not found. Is there EV3Comm.exe in the same directory as this executable?"); companion.Dispose(); } SendFileBtn.IsEnabled = true; } } else { UIMessage.ShowError("Cannot connect to EV3. Make sure it's plugged in via USB and turned on."); } EV3.Disconnect(); } }
public MainPage() { InitializeComponent(); // アプリ開始時にEV3がWiFiで取得したアドレスに接続 _ev3 = new EV3("192.168.1.108", 6789); }