private void InnerButton_Click(object sender, RoutedEventArgs e) { var errorViewer = new ExceptionViewer(_exception.InnerException); errorViewer.ShowDialog(); GC.Collect(1); }
private void Stop_Executed(object sender, ExecutedRoutedEventArgs e) { try { _frameCount = 0; _timer.Stop(); if (Stage != Stage.Stopped && Stage != Stage.PreStarting && ListFrames.Any()) { #region If not Already Stoped nor Pre Starting and FrameCount > 0, Stops ExitArg = ExitAction.Recorded; DialogResult = false; #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !ListFrames.Any()) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; RefreshButton.IsEnabled = true; VideoDevicesComboBox.IsEnabled = true; Topmost = true; Title = "Screen To Gif"; #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"); } }
private void LanguagePanel_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!IsLoaded) { return; } try { LocalizationHelper.SelectCulture(Settings.Default.Language); } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Error while trying to set the language."); } }
private void DonateOtherButton_Click(object sender, RoutedEventArgs e) { try { var label = CurrencyComboBox.SelectedValue as Label; var currency = label.Content.ToString().Substring(0, 3); Process.Start( $"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JCY2BGLULSWVJ&lc=US&item_name=ScreenToGif&item_number=screentogif¤cy_code={currency}&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"); } catch (Exception ex) { LogWriter.Log(ex, "Error • Openning the Donation website"); var exception = new ExceptionViewer(ex); exception.ShowDialog(); } }
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var exception = e.ExceptionObject as Exception; if (exception == null) return; LogWriter.Log(exception, "Current Domain Unhandled Exception - Unknow"); var errorViewer = new ExceptionViewer(exception); errorViewer.ShowDialog(); }
private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { LogWriter.Log(e.Exception, "On Dispacher Unhandled Exception - Unknow"); var errorViewer = new ExceptionViewer(e.Exception); errorViewer.ShowDialog(); e.Handled = true; }
/// <summary> /// Stops the recording or the Pre-Start countdown. /// </summary> private void Stop() { try { _capture.Stop(); FrameRate.Stop(); FrameCount = 0; if (Stage != Stage.Stopped && Stage != Stage.PreStarting && ListFrames.Any()) { #region Stop ExitArg = ExitAction.Recorded; DialogResult = false; #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !ListFrames.Any()) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; HeightTextBox.IsEnabled = true; WidthTextBox.IsEnabled = true; IsRecording(false); Topmost = true; Title = "Screen To Gif"; AutoFitButtons(); #endregion } } catch (NullReferenceException nll) { var errorViewer = new ExceptionViewer(nll); errorViewer.ShowDialog(); LogWriter.Log(nll, "NullPointer on the Stop function"); } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Error on the Stop function"); } }
/// <summary> /// Stops the recording or the Pre-Start countdown. /// </summary> private void Stop() { try { _frameCount = 0; _capture.Stop(); if (Stage != Stage.Stopped && Stage != Stage.PreStarting && ListFrames.Any()) { #region Stop ExitArg = ExitAction.Recorded; DialogResult = false; #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !ListFrames.Any()) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; HeightTextBox.IsEnabled = true; WidthTextBox.IsEnabled = true; IsRecording(false); Topmost = true; RecordPauseButton.Text = Properties.Resources.btnRecordPause_Record; RecordPauseButton.Content = (Canvas)FindResource("RecordDark"); RecordPauseButton.HorizontalContentAlignment = HorizontalAlignment.Left; Title = Properties.Resources.TitleStoped; AutoFitButtons(); #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"); } }
private void Application_Startup(object sender, StartupEventArgs e) { #region Unhandled Exceptions AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; #endregion #region Arguments try { if (e.Args.Length > 0) { //TODO: Watch for Args... } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Arguments"); } #endregion #region Language try { if (!Settings.Default.Language.Equals("auto")) { Thread.CurrentThread.CurrentCulture = new CultureInfo(Settings.Default.Language); Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.Language); } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Language Settings Exception"); } #endregion try { #region Startup if (Settings.Default.StartUp == 0) { var startup = new Startup(); Current.MainWindow = startup; startup.ShowDialog(); } else if (Settings.Default.StartUp == 3) { var edit = new Editor(); Current.MainWindow = edit; edit.ShowDialog(); } else { var editor = new Editor(); List<FrameInfo> frames = null; ExitAction exitArg = ExitAction.Exit; bool? result = null; #region Recorder or Webcam if (Settings.Default.StartUp == 1) { var rec = new Recorder(true); result = rec.ShowDialog(); exitArg = rec.ExitArg; frames = rec.ListFrames; } else if (Settings.Default.StartUp == 2) { var web = new Windows.Webcam(); result = web.ShowDialog(); exitArg = web.ExitArg; frames = web.ListFrames; } #endregion if (result.HasValue && result.Value) { #region If Close Environment.Exit(0); #endregion } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (exitArg == ExitAction.Recorded) { editor.ListFrames = frames; Current.MainWindow = editor; editor.ShowDialog(); } #endregion } } #endregion } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Root"); } }
private void Delete_Executed(object sender, ExecutedRoutedEventArgs e) { Pause(); try { #region Validation if (ListFrames.Count == FrameListView.SelectedItems.Count) { if (Dialog.Ask(FindResource("Editor.Remove.Title").ToString(), FindResource("Editor.Remove.Instruction").ToString(), FindResource("Editor.Remove.Message").ToString(), Dialog.Icons.Question)) { DiscardProject_Executed(null, null); } return; } #endregion ActionStack.Did(ListFrames); var selected = FrameListView.SelectedItems.OfType<FrameListBoxItem>().ToList(); var selectedOrdered = selected.OrderByDescending(x => x.FrameNumber).ToList(); var list = selectedOrdered.Select(item => ListFrames[item.FrameNumber]).ToList(); FrameListView.SelectedItem = null; list.ForEach(x => File.Delete(x.ImageLocation)); selectedOrdered.ForEach(x => ListFrames.RemoveAt(x.FrameNumber)); selectedOrdered.ForEach(x => FrameListView.Items.Remove(x)); AdjustFrameNumbers(selectedOrdered.Last().FrameNumber); SelectNear(selectedOrdered.Last().FrameNumber); } catch (Exception ex) { LogWriter.Log(ex, "Error While Trying to Delete Frames"); var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); } }
private void Delete_Executed(object sender, ExecutedRoutedEventArgs e) { Pause(); try { #region Validation if (ListFrames.Count == FrameListView.SelectedItems.Count) { if (Dialog.Ask("Remove All", "Do you want to remove all frames?", "You are trying to remove all frames. \n\rYou can't undo this operation.", Dialog.Icons.Question)) { DiscardProject_Executed(null, null); } return; } #endregion ActionStack.Did(ListFrames); var selected = FrameListView.SelectedItems.OfType<FrameListBoxItem>().ToList(); var list = selected.Select(item => ListFrames[item.FrameNumber]).ToList(); FrameListView.SelectedItem = null; list.ForEach(x => File.Delete(x.ImageLocation)); selected.OrderByDescending(x => x.FrameNumber).ToList().ForEach(x => ListFrames.RemoveAt(x.FrameNumber)); selected.OrderByDescending(x => x.FrameNumber).ToList().ForEach(x => FrameListView.Items.Remove(x)); AdjustFrameNumbers(selected[0].FrameNumber); SelectNear(selected[0].FrameNumber); } catch (Exception ex) { LogWriter.Log(ex, "Error While Trying to Delete Frames"); var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); } }
private void LanguagePanel_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!IsLoaded) return; RestartButton.Visibility = !Settings.Default.Language.Equals(_initialLanguage) ? Visibility.Visible : Visibility.Collapsed; if (Settings.Default.Language.Equals("auto")) { //TODO: Get the real system's language and return; return; } try { Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.Language); } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Error while trying to set the language."); } }
private void DonateButton_Click(object sender, RoutedEventArgs e) { try { Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JCY2BGLULSWVJ&lc=US&item_name=ScreenToGif&item_number=screentogif¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"); } catch (Exception ex) { LogWriter.Log(ex, "Error • Openning the Donation website"); var exception = new ExceptionViewer(ex); exception.ShowDialog(); } }
private void Application_Startup(object sender, StartupEventArgs e) { #region Unhandled Exceptions AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; #endregion #region Arguments try { if (e.Args.Length > 0) { //TODO: Watch for Args... } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Arguments"); } #endregion #region Upgrade Application Settings //See http://stackoverflow.com/questions/534261/how-do-you-keep-user-config-settings-across-different-assembly-versions-in-net if (Settings.Default.UpgradeRequired) { Settings.Default.Upgrade(); Settings.Default.UpgradeRequired = false; Settings.Default.Save(); } #endregion #region Language try { if (!Settings.Default.Language.Equals("auto")) { Thread.CurrentThread.CurrentCulture = new CultureInfo(Settings.Default.Language); Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.Language); } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Language Settings Exception"); } #endregion try { #region Startup if (Settings.Default.StartUp == 0) { var startup = new Startup(); Current.MainWindow = startup; startup.ShowDialog(); } else if (Settings.Default.StartUp == 4) { var edit = new Editor(); Current.MainWindow = edit; edit.ShowDialog(); } else { var editor = new Editor(); List<FrameInfo> frames = null; ExitAction exitArg = ExitAction.Exit; bool? result = null; #region Recorder or Webcam if (Settings.Default.StartUp == 1) { var rec = new Recorder(true); result = rec.ShowDialog(); exitArg = rec.ExitArg; frames = rec.ListFrames; } else if (Settings.Default.StartUp == 2) { var web = new Windows.Webcam(); result = web.ShowDialog(); exitArg = web.ExitArg; frames = web.ListFrames; } else if (Settings.Default.StartUp == 3) { var board = new Board(); result = board.ShowDialog(); exitArg = board.ExitArg; frames = board.ListFrames; } #endregion if (result.HasValue && result.Value) { #region If Close Environment.Exit(0); #endregion } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (exitArg == ExitAction.Recorded) { editor.ListFrames = frames; Current.MainWindow = editor; editor.ShowDialog(); } #endregion } } #endregion } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Root"); } }
private void Stop_Executed(object sender, ExecutedRoutedEventArgs e) { try { _frameCount = 0; _timer.Stop(); if (Stage != Stage.Stopped && Stage != Stage.PreStarting && ListFrames.Any()) { #region If not Already Stoped nor Pre Starting and FrameCount > 0, Stops ExitArg = ExitAction.Recorded; DialogResult = false; #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !ListFrames.Any()) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; RefreshButton.IsEnabled = true; VideoDevicesComboBox.IsEnabled = true; Topmost = true; RecordPauseButton.Text = Properties.Resources.btnRecordPause_Record; RecordPauseButton.Content = (Canvas)FindResource("Vector.Record.Dark"); Title = Properties.Resources.TitleStoped; #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"); } }
private void LanguagePanel_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!IsLoaded) return; try { LocalizationHelper.SelectCulture(Settings.Default.Language); } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Error while trying to set the language."); } }