public void UpdateEvent(GoogleVoiceEventArgs ev) { int i = 0; bool found = false; foreach (GoogleVoiceEventArgs e in Items) { if (e.ID == ev.ID) { found = true; break; } i++; } if (found) { Items[i] = ev; } else { Items.Add(ev); } Settings.Default.GoogleVoiceEvents = Serialize(); Settings.Default.Save(); }
public static GoogleVoiceEventArgs Wake(string serializationString) { GoogleVoiceEventArgs e = new GoogleVoiceEventArgs(); string[] values = serializationString.Split('|'); e.id = values[0]; e.contactName = values[1]; e.contactPhoneNumber = values[2]; e.outgoingPhoneNumber = values[3]; try { e.time = DateTime.FromBinary(Convert.ToInt64(values[4])); } catch { e.time = DateTime.Parse("1/1/1970"); } e.textMessage = values[5]; try { e.type = (VoiceEventType)Enum.Parse(typeof(VoiceEventType), values[6]); } catch { e.type = VoiceEventType.Call; } return(e); }
public GoogleVoiceEvents(StringCollection s) { foreach (string e in s) { Items.Add(GoogleVoiceEventArgs.Wake(e)); } }
public static string Sleep(GoogleVoiceEventArgs e) { string s = e.id + "|" + e.contactName + "|" + e.contactPhoneNumber + "|" + e.outgoingPhoneNumber; s += "|" + e.time.ToBinary().ToString() + "|" + e.textMessage + "|" + e.type.ToString(); return(s); }