public void LogError(Exception ex) { StreamWriter sw = new StreamWriter("capture-error-" + DateTime.Now.ToString("yyyyMMdd_hhmm") + ".txt"); sw.WriteLine(ex.ToString()); sw.Close(); MessagePopup mp = new MessagePopup(); mp.Setup("Webcam Capture", "Uhmmm.... we had a software crash. Please inform the developer. You can retry the capture if you want. Really. It's fine, go ahead.", true); mp.SetSize(); mp.ShowDialog(); Close(); }
private void cbDelete_MouseDown(object sender, MouseButtonEventArgs e) { if (projectAreas.Count > 0) { MessagePopup mp = new MessagePopup(); mp.Setup("Delete Project", "Please delete all areas first. Only empty projects can be deleted from the system.", false); mp.SetSize(); mp.ShowDialog(); } else { MessagePopup mp = new MessagePopup(); mp.Setup("Delete Project", "Are you sure you want to delete the Project?", true); mp.SetSize(); if (mp.ShowDialog() == true) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; // We copy the diagnostics ProjectHelper.DeleteProject(ControlCenter.Instance.segR, ControlCenter.Instance.cProjectAreaId); Mouse.OverrideCursor = null; mp = new MessagePopup(); mp.Setup("Project Management", "The Project was deleted", false); mp.SetSize(); mp.ShowDialog(); ControlCenter.Instance.SelectProjectList(); } } }
private void cbPrint_MouseDown(object sender, MouseButtonEventArgs e) { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "area_report_" + ControlCenter.Instance.cProjectArea.Name; // Default file name dlg.DefaultExt = ".pdf"; // Default file extension dlg.Filter = "PDF File (.pdf)|*.pdf"; // Filter files by extension // Show save file dialog box Nullable<bool> result = dlg.ShowDialog(); // Process save file dialog box results if (result == true) { // Save document string filename = dlg.FileName; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; SEGPrinter.PrintArea(ControlCenter.Instance.segR, ControlCenter.Instance.cProjectAreaId, ControlCenter.Instance.cProjectId, filename); Mouse.OverrideCursor = null; MessagePopup mp = new MessagePopup(); mp.Setup("Asset", "The area report was generated successfully", false); mp.SetSize(); mp.ShowDialog(); } }
private void cbCopyDiag_MouseDown(object sender, MouseButtonEventArgs e) { var s = new SelectAreaPopup(); s.Setup(); s.SetSize(); if (s.ShowDialog() == true) { if (ControlCenter.Instance.cCopyToAreaId == ControlCenter.Instance.cProjectAreaId) { MessagePopup mp = new MessagePopup(); mp.Setup("Area Diagnostics", "The source and destination areas cannot be the same", false); mp.SetSize(); mp.ShowDialog(); } else { MessagePopup mp = new MessagePopup(); mp.Setup("Copy Diagnostics", "Are you sure you want to overwrite the diagnostics in the destination Area?", true); mp.SetSize(); if (mp.ShowDialog() == true) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; // We copy the diagnostics ProjectHelper.CopyDiagnosticsToArea(ControlCenter.Instance.segR, ControlCenter.Instance.cProjectAreaId, ControlCenter.Instance.cCopyToAreaId); Mouse.OverrideCursor = null; mp = new MessagePopup(); mp.Setup("Area Diagnostics", "The diagnostics were copied to the destination Area", false); mp.SetSize(); mp.ShowDialog(); } } } }
private void cbDelete_MouseDown(object sender, MouseButtonEventArgs e) { if (imgHolderSel != null && ControlCenter.Instance.cAsset.ImageId!=imgHolderSel.i.Id) { MessagePopup mp = new MessagePopup(); mp.Setup("Diagnostics Image", "Are you sure you want to delete the selected Image?", true); mp.SetSize(); if(mp.ShowDialog()==true) { // First, obtain the ID Guid id = imgHolderSel.i.Id; DiagnosticsHelper.DeleteDiagnosticsImage(ControlCenter.Instance.segR, dm.Id, id); // If the asset is affected, do so Update(this.Width); } } }