Example #1
0
    public ExporterForm(PluginSettingsForm.PluginSettingsValues settings)
    {
        InitializeComponent();

        Components = new List <ComponentOccurrence>();

        oldConsole = Console.Out;

        newConsole = new TextboxWriter(logText);
        Console.SetOut(newConsole);

        label1.Text       = "";
        labelOverall.Text = "";

        buttonSaveLog.Enabled = false;
        buttonSaveLog.Visible = false;

        ExporterSettings = settings;

        FormClosed += delegate(object sender, FormClosedEventArgs e)
        {
            Console.SetOut(oldConsole);
            if (exporterProgressThread != null && exporterProgressThread.IsAlive)
            {
                exporterProgressThread.Abort();
            }
            if (exporterThread != null && exporterThread.IsAlive)
            {
                exporterThread.Abort();
            }
            Cleanup();
        };

        buttonStart.Click += delegate(object sender, EventArgs e)
        {
            if (!finished)
            {
                StartExporter();

                buttonStart.Enabled = false;
            }
            else
            {
                Close();
            }
        };

        System.Windows.Forms.Application.Idle += delegate(object sender, EventArgs e)
        {
            newConsole.printQueue();
        };

        Instance = this;
    }
    public ExporterForm(ExporterSettingsForm.ExporterSettingsValues settings)
    {
        InitializeComponent();

        Components = new List<ComponentOccurrence>();

        oldConsole = Console.Out;

        newConsole = new TextboxWriter(logText);
        Console.SetOut(newConsole);

        logText.ForeColor = System.Drawing.Color.FromArgb((int)SynthesisGUI.ExporterSettings.generalTextColor);
        logText.BackColor = System.Drawing.Color.FromArgb((int)SynthesisGUI.ExporterSettings.generalBackgroundColor);

        label1.Text = "";
        labelOverall.Text = "";

        buttonSaveLog.Enabled = false;
        buttonSaveLog.Visible = false;

        ExporterSettings = settings;

        FormClosed += delegate(object sender, FormClosedEventArgs e)
        {
            Console.SetOut(oldConsole);
            if (exporterProgressThread != null && exporterProgressThread.IsAlive) exporterProgressThread.Abort();
            if (exporterThread != null && exporterThread.IsAlive) exporterThread.Abort();
            Cleanup();
        };

        buttonStart.Click += delegate(object sender, EventArgs e)
        {
            if (!finished)
            {
                StartExporter();

                buttonStart.Enabled = false;
            }
            else Close();
        };

        System.Windows.Forms.Application.Idle += delegate(object sender, EventArgs e)
        {
            newConsole.printQueue();
        };

        Instance = this;
    }