public MessageWindow(GoogleVoice.Contact Contact) { InitializeComponent(); this.Contact = Contact; Title = Contact.Name; Tag = Contact.Name + Contact.ID; System.Windows.Forms.Application.EnableVisualStyles(); // FIXME: maybe windows should start minimzed normally. ContentRendered += (s, e) => this.Topmost = false; Initialized += (s, e) => this.Topmost = true; OnZoomChanged += () => this.Invoke(() => SetHTMLFont()); PreviewMouseDown += (ss, ee) => { this.Try(() => ClearNotify()); }; Loaded += (_, __) => { // 5/5/12: Open links in default browser ((SHDocVw.DWebBrowserEvents2_Event)web.ActiveXInstance).NewWindow3 += web_NewWindow3; }; }
private void processRecord(MemoryStream record) { var wav = SoundTools.ConvertSamplesToWavFileFormat(record, sampleRate); var flac = new MemoryStream(); SoundTools.Wav2Flac(wav, flac); try { var result = GoogleVoice.GoogleSpeechRequest(flac, sampleRate, Language, MaxResults); if (result.Length > 0) { if (OnSpeechRecognized != null) { OnSpeechRecognized(result); } } else if (OnSpeechRecognizeFailed != null) { OnSpeechRecognizeFailed(); } } catch (Exception ex) { if (OnGoogleError != null) { OnGoogleError(ex); } } }
public MainForm() { InitializeComponent(); _gv = new GoogleVoice(); // Create resource object containing SipekSdk and other Sipek related data _resources = new SipekResources(this); _sipekMutex = new Mutex(false); }
private void EmptyRequest() { try { GoogleVoice.GoogleSpeechRequest(new MemoryStream(), sampleRate); } catch { } }
public IEnumerable <string> Handle(string input, Match match, IListener listener) { var gv = GoogleVoice.Inbox(); foreach (var phoneCall in gv.Conversations_response.Conversation.SelectMany(conversation => conversation.Phone_call).Where(o => new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds((long)o.Start_time) > DateTime.Now.Subtract(1.Hours()))) { yield return(phoneCall.Contact.Name + ": " + phoneCall.Message_text); } yield return(""); }
private void SendFile(String filePath) { try { ReportOnProgress(10, "İstek başladı!"); string responseFromServer = GoogleVoice.GoogleSpeechRequest(filePath, "tmp.flac"); responseFromServer = responseFromServer .Replace("{\"result\":[]}\n{\"result\":[", "") .Replace("],\"result_index\":0}", ""); var table = JsonConvert.DeserializeObject <Results>(responseFromServer).Alternatives; txtLog.Clear(); //AddLog(table.Rows[0].ItemArray[0].ToString()); for (int i = 0; i < table.Rows.Count; i++) { var item = table.Rows[i]; if (item.ItemArray.Count() > 1) { if (item.ItemArray[1].ToString() != "") { AddLog(item.ItemArray[0].ToString()); //AddLog(item.ItemArray[0].ToString() + "--" + item.ItemArray[1].ToString() + System.Environment.NewLine); return; } } else { AddLog(item.ItemArray[0].ToString() + System.Environment.NewLine); } } ReportOnProgress(100, "Sorgu başarıyla tamamlandı"); } catch (Exception e) { ReportOnProgress(100, "İstek başarısız! Hata Sebebi : " + e.Message); AddLog(e.ToString()); } }
void model_OnMessage(GoogleVoice.Message msg, GoogleVoice.Contact contact) { bool did_add = false; GoogleVoice.SMS sms = msg as GoogleVoice.SMS; if (sms != null) { if (!sms.Self) { did_add = true; } } if (!did_add) return; this.Invoke(() => { var mw = WindowForContact(contact); this.Try( () => mw.ShowActivated = false); // crashes on xp?? TODO FIXME: what? if (!mw.Ready) mw.Show(); mw.AddMessage(msg); }); }
public MessageWindow WindowForContact(GoogleVoice.Contact contact) { try { var win = Windows.FirstOrDefault(c => c.Contact == contact); if (win != null) return win; win = Windows.FirstOrDefault(c => c.Contact.HasNumber(contact.Phones[0].Number)); if (win != null) return win; win = new MessageWindow(contact); Windows.Add(win); return win; } catch (Exception ex) { Debug.WriteLine("Main/WindowForContact *** " + ex); return null; } }
public void AddMessage(GoogleVoice.Message msg) { this.Invoke(() => { foreach (var item in cboNumbers.Items) { GoogleVoice.Phone ph = item as GoogleVoice.Phone; if (ph != null) { if (ph.Number == msg.Number) { cboNumbers.SelectedItem = item; lblNumber.Content = cboNumbers.Text; return; } } } }); bool did_add = false; GoogleVoice.SMS sms = msg as GoogleVoice.SMS; if (sms != null) { if (!sms.Self) { AddMessage(Contact.Name, sms.Text); did_add = true; } } else { switch (msg.Class) { case GoogleVoice.Message.MessageType.Missed: if (Settings.Get("ShowMissedCall", false)) { AddMessage(Contact.Name, "<strong>Missed Call</strong>"); did_add = true; } break; case GoogleVoice.Message.MessageType.Placed: if (Settings.Get("ShowPlacedCall", false)) { AddMessage(Contact.Name, "<strong>Placed Call</strong>"); did_add = true; } break; case GoogleVoice.Message.MessageType.Received: if (Settings.Get("ShowAcceptedCall", false)) { AddMessage(Contact.Name, "<strong>Received Call</strong>"); did_add = true; } break; default: AddMessage(Contact.Name, "<strong>" + msg.Class + "</strong>: " + msg.MessageText); did_add = true; break; } } if (did_add) { if (WindowState != System.Windows.WindowState.Minimized) Show(); } }