RTFNote rtf = new RTFNote(); // The enhanced note window /** Starting Process **/ /**********************/ /// The application starts by asking for tester and charter information. Only then the session starts // Default constructor, everything is empty/default values public SMWidget() { MessageBoxResult result = System.Windows.MessageBox.Show("Do you want to login to Flickr?", "Flickr Login", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { m_flickr.Login(); m_flickrLoggedIn = true; } else { m_flickrLoggedIn = false; } Logger.record("[SMWidget]: App constructor. Initializing.", "SMWidget", "info"); InitializeComponent(); rtf.InitializeComponent(); rtf.sm = this; NoteContent.Focus(); parseCLI(); handleCLI(); Logger.record("[SMWidget]: App constructor initialized and CLI executed.", "SMWidget", "info"); }
// Adding attached screenshot have dedicated functions that deal with the visual // clues as well private void AddScreenshot2Note(Bitmap bitmap) { Logger.record("[AddScreenshot2Note]: Saving screen to file", "SMWidget", "info"); bool exDrRetry = false; // Name the screenshot, save to disk screenshotName = currentScreenshot++.ToString() + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "_" + FlickrAddon.hashcode + ".jpg"; // HASCODE ADDED!!!___<-----######### do { exDrRetry = false; try { string strReportFileName = currentSession.GetCurrentSessionFile(); Graphics graphicImage = Graphics.FromImage(bitmap); graphicImage.SmoothingMode = SmoothingMode.AntiAlias; StringFormat format = new System.Drawing.StringFormat(StringFormatFlags.DirectionRightToLeft); graphicImage.DrawString(strReportFileName, new Font("Arial", 14, System.Drawing.FontStyle.Bold), System.Drawing.Brushes.Red, new System.Drawing.Point(50, 50)); bitmap.Save(currentSession.workingDir + screenshotName, ImageFormat.Jpeg); AutoSaveScrenshot(screenshotName); string strFileTag = "#Session File: " + strReportFileName; string URL = ""; if (ToggleUpload2) { if (m_flickrLoggedIn) { URL = m_flickr.GetUrl(m_flickr.Upload(screenshotName, "", "", currentSession.GetTags() + strFileTag)); currentSession.UpdateNotes("WebUrl: ", URL); FlickrInlogg.Text = "Account: " + m_flickr.GetCurrentUser(); //currentSession.noteTypes[ReporterNoteName] } else { m_flickr.Login(); FlickrInlogg.Text = "Account: " + m_flickr.GetCurrentUser(); URL = m_flickr.GetUrl(m_flickr.Upload(screenshotName, "", "", currentSession.GetTags() + strFileTag)); currentSession.UpdateNotes("WebUrl: ", URL); m_flickrLoggedIn = true; } } } catch (Exception ex) { Logger.record("[AddScreenshot2Note]: EXCEPTION reached - Session Note file could not be saved (" + screenshotName + ")", "SMWidget", "error"); exDrRetry = Logger.FileErrorMessage(ex, "SaveToSessionNotes", screenshotName); } } while (exDrRetry); // Put a visual effect to remember the tester there's an image on the attachment barrel BevelBitmapEffect effect = new BevelBitmapEffect(); effect.BevelWidth = 2; effect.EdgeProfile = EdgeProfile.BulgedUp; ScreenShot.BitmapEffect = effect; }