Exemple #1
0
        /* Callback as worker progresses */
        private void gsProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            /* Callback with progress */
            gsParamState_t Value = new gsParamState_t();
            gsEventArgs    info  = new gsEventArgs(false, e.ProgressPercentage, Value);

            gsUpdateMain(info);
        }
Exemple #2
0
        /* Callback upon worker all done */
        private void gsCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            gsParamState_t Value;
            gsEventArgs    info;
            gsParamState_t Params;

            try
            {
                Params = (gsParamState_t)e.Result;
            }
            catch (System.Reflection.TargetInvocationException)
            {
                /* Something went VERY wrong with GS */
                /* Following is to help debug these issues */

                /* var inner = ee.InnerException;
                 * var message = ee.Message;
                 * var inner_message = inner.Message;
                 * String bound = "\n************\n";
                 * gsIOUpdateMain(this, bound, bound.Length);
                 * gsIOUpdateMain(this, message, message.Length);
                 * gsIOUpdateMain(this, bound, bound.Length);
                 * gsIOUpdateMain(this, inner_message, inner_message.Length);
                 * gsIOUpdateMain(this, bound, bound.Length);
                 * var temp = inner.Source;
                 * gsIOUpdateMain(this, bound, bound.Length);
                 * gsIOUpdateMain(this, temp, temp.Length);
                 * var method = inner.TargetSite;
                 * gsIOUpdateMain(this, bound, bound.Length);
                 * var method_name = method.Name;
                 * gsIOUpdateMain(this, method_name, method_name.Length);
                 * var stack = inner.StackTrace;
                 * gsIOUpdateMain(this, bound, bound.Length);
                 * gsIOUpdateMain(this, stack, stack.Length); */
                String output = "Ghostscript DLL Invalid Access.";
                gsDLLProblemMain(output);
                return;
            }
            switch (Params.task)
            {
            case GS_Task_t.PS_DISTILL:
                m_worker.DoWork -= new DoWorkEventHandler(gsBytesAsync);
                break;

            case GS_Task_t.DISPLAY_DEV_NON_PDF:
            case GS_Task_t.DISPLAY_DEV_PDF:
            case GS_Task_t.DISPLAY_DEV_THUMBS_NON_PDF:
            case GS_Task_t.DISPLAY_DEV_THUMBS_PDF:
                m_worker.DoWork -= new DoWorkEventHandler(DisplayDeviceAsync);
                break;

            default:
                m_worker.DoWork -= new DoWorkEventHandler(gsFileAsync);
                break;
            }

            if (e.Cancelled)
            {
                Value        = new gsParamState_t();
                Value.result = GS_Result_t.gsCANCELLED;
                info         = new gsEventArgs(true, 100, Value);
            }
            else
            {
                Value = (gsParamState_t)e.Result;
                info  = new gsEventArgs(true, 100, Value);
            }
            gsUpdateMain(info);
        }