public void SaveCallHistory(CallHistory callHistory, string username) { try { FileStream fs = new FileStream("CallHistory-" + username + ".xml", FileMode.Create); this.serializer.Serialize(fs, callHistory); } catch (Exception) { } }
public CallHistory LoadCallHistory(string username) { CallHistory tmpCallHistory = new CallHistory(); try { FileStream fs = new FileStream("CallHistory-" + username + ".xml", FileMode.OpenOrCreate); tmpCallHistory = (CallHistory)this.serializer.Deserialize(fs); fs.Close(); } catch (Exception) { } return(tmpCallHistory); }
public CallHistory LoadCallHistory(string username) { CallHistory tmpCallHistory = new CallHistory(); try { FileStream fs = new FileStream(Path.Combine(mPath, "CallHistory-" + username + ".xml"), FileMode.OpenOrCreate); tmpCallHistory = (CallHistory)this.serializer.Deserialize(fs); fs.Close(); } catch (Exception ex) { Console.WriteLine("LoadCallHistory : " + ex.Message); } return(tmpCallHistory); }
public void SaveCallHistory(CallHistory callHistory, string username) { try { if (callHistory.CallRecords.Length > maxsize) { Array.Reverse(callHistory.CallRecords); Array.Resize(ref callHistory.CallRecords, maxsize); Array.Reverse(callHistory.CallRecords); } FileStream fs = new FileStream(Path.Combine(mPath, "CallHistory-" + username + ".xml"), FileMode.Create); this.serializer.Serialize(fs, callHistory); } catch (Exception ex) { Console.WriteLine("LoadCallHistory : " + ex.Message); } }
public CallHistory LoadCallHistory(string username) { CallHistory tmpCallHistory = new CallHistory(); try { FileStream fs = new FileStream(Path.Combine(mPath, "CallHistory-" + username + ".xml"), FileMode.OpenOrCreate); tmpCallHistory = (CallHistory)this.serializer.Deserialize(fs); fs.Close(); } catch (Exception ex) { Console.WriteLine("LoadCallHistory : " + ex.Message); } return tmpCallHistory; }
private void ClientForm_FormClosing(object sender, FormClosingEventArgs e) { try { if (e.CloseReason == CloseReason.UserClosing) { if (DialogResult.Yes != MessageBox.Show( Properties.Localization.txtInfoApplicationClosingDesc, Properties.Localization.txtInfoApplicationClosing, MessageBoxButtons.YesNo, MessageBoxIcon.Question) ) { e.Cancel = true; return; } } this.mFormIsClosing = true; this.WindowState = FormWindowState.Minimized; if (xmppControl.Connected) xmppControl.Disconnect(); mySIPPhone.ShutdownEngine(); UnregisterHotKey(this.Handle, this.GetType().GetHashCode()); CallHistory tmpCallHistory = new CallHistory(mUserAccount.Username); tmpCallHistory.CallRecords = myCallHistoryRecords.ToArray(); myCallHistorySerializer.SaveCallHistory(tmpCallHistory, mUserAccount.Username); myStorage.Close(); if (myVideoPlugin != null) myVideoPlugin.Dispose(); } catch (Exception ex) { #if (TRACE) Console.WriteLine("AmiteloForm_FormClosing : " + ex.Message); #endif } }
private void ClientForm_FormClosing(object sender, FormClosingEventArgs e) { try { this.FormIsClosing = true; UnregisterHotKey(this.Handle, this.GetType().GetHashCode()); CallHistory tmpCallHistory = new CallHistory(myUserAccount.Username); tmpCallHistory.CallRecords = myCallHistoryRecords.ToArray(); myCallHistorySerializer.SaveCallHistory(tmpCallHistory, myUserAccount.Username); mySIPPhone.ShutdownEngine(); myVideoPlugin.UnInitialize(); Thread.Sleep(10000); } catch (Exception ex) { Console.WriteLine("Closing Form Exception : " + ex.Message); throw; } }
public CallHistory LoadCallHistory(string username) { CallHistory tmpCallHistory = new CallHistory(); try { FileStream fs = new FileStream("CallHistory-" + username + ".xml", FileMode.OpenOrCreate); tmpCallHistory = (CallHistory)this.serializer.Deserialize(fs); fs.Close(); } catch (Exception) { } return tmpCallHistory; }