static BugTracer() { int count = Enum.GetNames(typeof(BugId)).Length; bugTracers = new BugTracer[count]; for (int i = 0; i < count; i++) { bugTracers[i] = new BugTracer(); } }
private void SendInstantMessageBinding_Executed(object sender, ExecutedRoutedEventArgs e) { BugTracer.Get(BugId.N01).BeginTrace(@"SendInstantMessageBinding_Executed"); ISession session = StartConversation(SessionType.ImSession, false); this.chatWindow.Activate(); this.chatWindow.SelectTabItem(session); e.Handled = true; }
private ISession StartConversation(SessionType sessionType, bool enableVideo) { BugTracer.Get(BugId.N01).Trace(string.Format(@"StartConversation: {0}, {1}", sessionType, enableVideo)); IPresentity presentity = this.ContactsWindow.GetSelectedContact(); BugTracer.Get(BugId.N01).Trace(string.Format(@"StartConversation: {0}", presentity.Uri)); ISession session = this.Endpoint.FindSession(sessionType, presentity.Uri); BugTracer.Get(BugId.N01).Trace(string.Format(@"StartConversation: session {0}found", (session == null) ? "not " : "")); if (session != null) { if (enableVideo) { (session as IAvSession).EnableVideo(); } this.Endpoint.RestoreSession(session); } else { session = this.Endpoint.CreateSession(sessionType); if (enableVideo) { (session as IAvSession).EnableVideo(); } BugTracer.Get(BugId.N01).EndTrace(@"StartConversation -- endtrace"); session.AddPartipant(presentity.Uri); } return(session); }
private string CreateCrashReport(Exception ex) { string report = ""; try { report += AssemblyInfo.AssemblyProduct + " " + AssemblyInfo.AssemblyVersion + "\r\n"; report += System.Environment.OSVersion.ToString() + "\r\n"; report += ".NET Framework " + System.Environment.Version.ToString() + "\r\n"; if (ex != null) { report += "Exception\r\n"; report += "Message: " + ex.Message + "\r\n"; report += "TargetSite: " + ex.TargetSite + "\r\n"; report += "Source: " + ex.Source + "\r\n"; report += "StackTrace: \r\n" + ex.StackTrace + "\r\n"; report += "\r\nToString: \r\n" + ex.ToString() + "\r\n"; } else { report += "No Exception\r\n"; report += "StackTrace: \r\n"; StackTrace stackTrace = new StackTrace(true); for (int i = 0; i < stackTrace.FrameCount; i++) { StackFrame stackFrame = stackTrace.GetFrame(i); report += stackFrame.GetMethod() + "\r\n"; } } report += "\r\nEnvironment.StackTrace: \r\n" + System.Environment.StackTrace + "\r\n"; report += "\r\nApplication Settings: \r\n"; try { if (Messenger.Properties.Settings.Default.PropertyValues.Count > 0) { foreach (System.Configuration.SettingsPropertyValue setting in Messenger.Properties.Settings.Default.PropertyValues) { if (setting.Name != @"Password") { report += setting.Name + ": " + setting.PropertyValue.ToString() + "\r\n"; } } } else { report += "Settings not loaded yet\r\n"; } } catch { report += "Failed to report settings\r\n"; } try { report += "\r\nBug traces: \r\n"; report += BugTracer.GetTraces() + "\r\n"; } catch { report += "Bug traces failed\r\n"; } report += "\r\n-- end of report --\r\n"; } catch { } return(report); }