private void btnInnerException_Click(object sender, EventArgs e) { var errorViewer = new ExceptionViewer(_exception.InnerException); errorViewer.ShowDialog(); errorViewer.Dispose(); GC.Collect(1); }
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var ex = (Exception)e.ExceptionObject; LogWriter.Log(ex, "Unhandled Exception"); var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); Environment.Exit(2); }
private void AddPictures(string fileName) { try { Cursor = Cursors.WaitCursor; if (_listFramesEdit.Any()) { ResetUndoProp(); } Size imageSize = _listFramesEdit.Count == 0 ? new Size(0, 0) : _listFramesEdit[0].From().Size; // Insert the frame(s) and set the last delay used. List<Bitmap> bitmapsList = ImageUtil.GetBitmapsFromFile(fileName, _listFramesEdit.Count, imageSize); bitmapsList.Reverse(); int frame = 0; foreach (Bitmap item in bitmapsList) { string endName = String.Format("{0}{1}I{2}.bmp", _pathTemp, frame, DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss")); item.Save(endName, ImageFormat.Bmp); _listFramesEdit.Insert(trackBar.Value, endName); _listDelayEdit.Insert(trackBar.Value, _delay); //TODO: Get the delay. frame++; } tvFrames.Add(bitmapsList.Count); bitmapsList.Clear(); bitmapsList = null; GC.Collect(); } catch (Exception ex) { LogWriter.Log(ex, "Error importing image"); var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); } finally { // Update the content for user trackBar.Maximum = _listFramesEdit.Count - 1; pictureBitmap.Image = _listFramesEdit[trackBar.Value].From(); this.Text = Resources.Title_EditorFrame + trackBar.Value + " - " + (_listFramesEdit.Count - 1); this.Cursor = Cursors.Default; DelayUpdate(); } }
static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { LogWriter.Log(e.Exception, "Thread Exception"); var errorViewer = new ExceptionViewer(e.Exception); errorViewer.ShowDialog(); Environment.Exit(1); }
/// <summary> /// Stops the recording or stops the pre-start timer. /// </summary> private void Stop() { try { _frameCount = 0; //put this in other location timerCapture.Stop(); timerCaptureFull.Stop(); timerCapWithCursor.Stop(); timerCapWithCursorFull.Stop(); if (_stage != Stage.Stopped && _stage != Stage.PreStarting && _listFrames.Any()) //if not already stoped or pre starting, stops { #region To Stop and Save try { _actHook.Stop(); //Stops the hook. } catch (Exception ex) { } _stopDel = StopAsync; _stopDel.BeginInvoke(CallBackStop, null); this.Cursor = Cursors.AppStarting; panelBottom.Enabled = false; #endregion } else if ((_stage == Stage.PreStarting || _stage == Stage.Snapping) && !_listFrames.Any()) // if Pre-Starting or in Snapmode and no frames, stops. { #region To Stop timerPreStart.Stop(); _stage = Stage.Stopped; //Enables the controls that are disabled while recording; numMaxFps.Enabled = true; btnRecordPause.Enabled = true; tbHeight.Enabled = true; tbWidth.Enabled = true; //this.FormBorderStyle = FormBorderStyle.Sizable; this.MaximizeBox = true; this.MinimizeBox = true; this.TopMost = true; btnRecordPause.Text = Resources.btnRecordPause_Record; btnRecordPause.Image = Resources.Record; btnRecordPause.ImageAlign = ContentAlignment.MiddleLeft; this.Text = Resources.TitleStoped; AutoFitButtons(); try { //Re-starts the keyboard hook. _actHook.OnMouseActivity += null; _actHook.Start(true, true); } catch (Exception) { } #endregion } } catch (NullReferenceException nll) { var errorViewer = new ExceptionViewer(nll); errorViewer.ShowDialog(); LogWriter.Log(nll, "NullPointer in the Stop function"); } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Error in the Stop function"); } }