CSL.ErrorWindow.IssueGeneralWarning C# (CSharp) Method

IssueGeneralWarning() public method

public IssueGeneralWarning ( string message, string submessage, string file ) : void
message string
submessage string
file string
return void
        public void IssueGeneralWarning(string message, string submessage, string file)
        {
            InstructionalLabel.Text = message;
            ErrorLabel.Text = submessage;
            DiscardButton.Visible = false;
            if (file != null)
            {
                FilePathRichTextBox.Text = file;
            }
            this.Text = "[CSL] -- Warning";
            this.Activate();
            this.ShowDialog();
        }

Usage Example

Example #1
0
        //To be called only from DoWork
        public List<FileInfo> UnzipFiles(string[] zipFiles)
        {
            List<FileInfo> items = new List<FileInfo>();
            List<FileInfo> fileinfos = new List<FileInfo>();
            foreach (string zipfile in zipFiles)
            {
                try
                {
                    fileinfos.Add(new FileInfo(zipfile));
                }
                catch (Exception e)
                {
                    LogError(e.Message + "\n" + e.StackTrace);
                }
            }

            FastZip fz = new FastZip();
            ErrorWindow ew = new ErrorWindow();

            string[] files = null;
            string filename;
            DirectoryInfo destination;
            int total = zipFiles.Length;
            double progress = 0;
            double count = 0;
            foreach (FileInfo zipfile in fileinfos)
            {
                filename = zipfile.Name;
                filename = filename.Replace(zipfile.Extension, "");
                string dest = SettingsHandler.GetTorrentSaveFolder() + @"\[CSL]--Temp\" + filename + @"\";
                destination = new DirectoryInfo(dest);
                if (!destination.Exists)
                {
                    try
                    {
                        destination.Create();
                    }
                    catch (Exception e)
                    {
                        LogError(e.Message + "\n" + e.StackTrace);
                    }
                }

                try
                {
                    fz.ExtractZip(zipfile.FullName, destination.FullName, ".torrent");
                }
                catch (Exception) { ew.IssueGeneralWarning("No action necessary", "Warning: Could not unzip " + filename, zipfile.Name); }

                try
                {
                    files = Directory.GetFiles(destination.FullName,
                        "*.torrent", SearchOption.AllDirectories);
                }
                catch (DirectoryNotFoundException) { ew.IssueGeneralWarning("No action necessary", "Warning: " + filename + "was empty", zipfile.Name); }

                finally
                {
                    foreach (string file in files)
                    {
                        try
                        {
                            items.Add(new FileInfo(file));
                        }
                        catch (Exception e)
                        {
                            LogError(e.Message + "\n" + e.StackTrace);
                        }
                    }
                }

                try
                {
                    zipfile.MoveTo(SettingsHandler.GetTorrentSaveFolder() + @"\[CSL] -- Processed Zips\" + zipfile.Name);
                }
                catch { }
                progress = (++count / total) * 100;

                if (progress <= 100 && progress >= 0)
                    ReportProgress((int)progress);
            }

            return items;
        }
All Usage Examples Of CSL.ErrorWindow::IssueGeneralWarning