Exemplo n.º 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;
    }
Exemplo n.º 2
0
        /// <summary>
        /// Do background work. Creates a build context and executes the build tasks.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A DoWorkEventArgs object.</param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            using (var textWriter = new TextboxWriter(this.textBox1))
            {
                var feedback = new BuildFeedbackBase(textWriter);

                var result = this.Context.Build(this.BuildTasks, feedback);

                e.Result = new WorkResult()
                {
                    Result   = result,
                    Messages = feedback.Messages
                };
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Do background work. Creates a build context and executes the build tasks.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A DoWorkEventArgs object.</param>
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            using (var textWriter = new TextboxWriter(this.textBox1))
            {
                var feedback = new BuildFeedbackBase(textWriter);

                var result = this.Context.Build(this.BuildTasks, feedback);

                e.Result = new WorkResult()
                {
                    Result = result,
                    Messages = feedback.Messages
                };
            }
        }
Exemplo n.º 4
0
    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;
    }