static void Main(string[] args) { //作業ディレクトリだけでなく"dlls"というフォルダのライブラリも実行中に参照できるよう設定を変更 PathModifier.AddEnvironmentPath("dlls", PathModifyMode.RelativeToEntryAssembly); //HelloWorldの対象とするマシンのアドレスをIPとポート(ポートは通常9559)で指定 string address = "tcp://127.0.0.1:9559"; var session = QiSession.Create(address); Console.WriteLine($"Connected? {session.IsConnected}"); if (!session.IsConnected) { Console.WriteLine("end program because there is no connection"); return; } //最も基本的なモジュールの一つとして合成音声のモジュールを取得 var tts = session.GetService("ALTextToSpeech"); //"say"関数に文字列引数を指定して実行 tts["say"].Call("this is test"); session.Close(); session.Destroy(); }
private void encryptToolStripMenuItem_Click(object sender, EventArgs e) { string sourceName = PathModifier.RemoveLastBackSlash(searchBar.Text) + @"\" + filesListView.FocusedItem.Text; if (saveFile.ShowDialog() == DialogResult.OK) { CryptoLogic.EncryptFile(sourceName, saveFile.FileName); MessageBox.Show("Succesfully Encrypted!"); } }
private void filesListView_MouseDoubleClick(object sender, MouseEventArgs e) { string pathToShow = String.Format(@"{0}\{1}", PathModifier.RemoveLastBackSlash(searchBar.Text), filesListView.SelectedItems[0].Text); if (Directory.Exists(pathToShow)) { searchBar.Text = pathToShow; FillFileListView(new DirectoryInfo(pathToShow)); FillNodes(pathToShow); } }
//実質エントリポイント protected override void OnStartup(StartupEventArgs e) { PathModifier.AddEnvironmentPaths( Path.Combine(Environment.CurrentDirectory, "qi_framework_dlls") ); //MetroRadiance標準だとMainWindow閉じるだけではアプリケーション終了しない気がするんだけど仕様? MainWindow = new MagicMirrorDockWindow(); MainWindow.Closed += (_, __) => Shutdown(); MainWindow.Show(); base.OnStartup(e); }
/// <summary> /// This method will Update the searchBar text if the user clicks on the back button. /// </summary> private void UpdateSearchBarTextWhenGoBack() { string path = PathModifier.CreateSearchBarText(searchBar.Text); if (path != null) { searchBar.Text = path; } else { MessageBox.Show("You are already in the root Directory."); } }
static void Main(string[] args) { PathModifier.AddEnvironmentPath("dlls", PathModifyMode.RelativeToEntryAssembly); string address = "tcp://127.0.0.1:9559"; var s = QiSession.Create(address); string text = "^start(animation/Stand/Gestures/Hey_1) " + "Hello, this is a typical sample sentence for animated say module, to check some autonomous motion suited for the conversation " + "^wait(animation/Stand/Gestures/Hey_1)"; //AnimatedSay::sayの第二引数に渡す、モーションのモードを表す単一ペアの辞書 var config = QiMap.Create(new[] { new KeyValuePair <QiString, QiString>("bodyLanguageMode", "contextual") }); var animatedSpeech = s.GetService("ALAnimatedSpeech"); var res = animatedSpeech["say"].Call(text, config); Console.WriteLine(res.ContentValueKind); }
private void compressFileToolStripMenuItem_Click(object sender, EventArgs e) { string fullName = PathModifier.RemoveLastBackSlash(searchBar.Text) + @"\" + filesListView.FocusedItem.Text; Compresser.ArchiveFile(new DirectoryInfo(searchBar.Text), new FileInfo(fullName)); }
static void Main(string[] args) { PathModifier.AddEnvironmentPath("dlls", PathModifyMode.RelativeToEntryAssembly); string input = ""; try { Console.WriteLine("Please input address to connect (i.e. 'tcp://127.0.0.1:9559')"); string address = Console.ReadLine(); var session = QiSession.Create(address); if (!session.IsConnected) { Console.WriteLine("Failed to connect. Program ends..."); return; } while (true) { Console.WriteLine("Choose sample by input number 1, 2, 3, 4 or 5."); Console.WriteLine("1. Motion Pose Initialize"); Console.WriteLine("2. Motion Stiffness On"); Console.WriteLine("3. Sensor Read"); Console.WriteLine("4. Get camera image to local"); Console.WriteLine("5. Video Recording"); Console.WriteLine("6. Speech Recognition / Robot Speech Logging"); Console.WriteLine("7. Sound IO"); input = Console.ReadLine(); if ((new string[] { "1", "2", "3", "4", "5", "6", "7" }).Contains(input)) { break; } Console.WriteLine("could not verify input, please try again."); } if (input == "1") { MotionPosesInit.Execute(session); } else if (input == "2") { MotionStiffnessOn.Execute(session); } else if (input == "3") { Sensors.Execute(session); } else if (input == "4") { VisionRetrieveImage.Execute(session); } else if (input == "5") { VisionVideoRecording.Execute(session); } else if (input == "6") { DialogLogging.Execute(session); } else if (input == "7") { SoundIO.Execute(session); } } catch (DllNotFoundException) { //アンマネージドのDLLを実行ファイルの"dll"に置くのを忘れていたケース Console.WriteLine($"Failed to load dll file. Unmanaged libraries are required to put at 'dlls' folder"); Console.WriteLine("Ends program..."); } Console.WriteLine("Press ENTER to quit program"); Console.ReadLine(); }