ScreenToGif.Windows.Recorder.Discard C# (CSharp) Method

Discard() private method

private Discard ( ) : void
return void
        private void Discard()
        {
            try
            {
                #region Remove all the files

                foreach (var frame in ListFrames)
                {
                    try
                    {
                        File.Delete(frame.ImageLocation);
                    }
                    catch (Exception)
                    { }
                }

                try
                {
                    Directory.Delete(_pathTemp, true);
                }
                catch (Exception ex)
                {
                    LogWriter.Log(ex, "Delete Temp Path");
                }

                #endregion

                ListFrames.Clear();
            }
            catch (IOException io)
            {
                LogWriter.Log(io, "Error while trying to Discard the Recording");
            }
            catch (Exception ex)
            {
                Dispatcher.Invoke(() => Dialog.Ok("Discard Error", "Error while trying to discard the recording", ex.Message));
                LogWriter.Log(ex, "Error while trying to Discard the Recording");
            }
        }