Пример #1
0
        private void gsProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            /* Callback with progress */
            gsParams_t  Value = new gsParams_t();
            gsEventArgs info  = new gsEventArgs(false, e.ProgressPercentage, Value);

            gsUpdateMain(this, info);
        }
Пример #2
0
        /* Callback */
        private void gsCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            gsParams_t  Value;
            gsEventArgs info;
            gsParams_t  Params;

            try
            {
                Params = (gsParams_t)e.Result;
            }
            catch (System.Reflection.TargetInvocationException ee)
            {
                /* 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(this, output);
                return;
            }

            if (Params.task == GS_Task_t.PS_DISTILL)
            {
                m_worker.DoWork -= new DoWorkEventHandler(gsWork2);
            }
            else
            {
                m_worker.DoWork -= new DoWorkEventHandler(gsWork1);
            }

            if (e.Cancelled)
            {
                Value        = new gsParams_t();
                Value.result = GS_Result_t.gsCANCELLED;
                info         = new gsEventArgs(true, 100, Value);
            }
            else
            {
                Value = (gsParams_t)e.Result;
                info  = new gsEventArgs(true, 100, Value);
            }
            gsUpdateMain(this, info);
        }
Пример #3
0
 private void gsProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     /* Callback with progress */
     gsParams_t Value = new gsParams_t();
     gsEventArgs info = new gsEventArgs(false, e.ProgressPercentage, Value);
     gsUpdateMain(this, info);
 }
Пример #4
0
		private void gsProgress(object gsObject, gsEventArgs asyncInformation)
		{
			if (asyncInformation.Completed)
			{
				xaml_DistillProgress.Value = 100;
				xaml_DistillGrid.Visibility = System.Windows.Visibility.Collapsed;
				if (asyncInformation.Params.result == GS_Result_t.gsFAILED)
				{
					switch (asyncInformation.Params.task)
					{
						case GS_Task_t.CREATE_XPS:
							ShowMessage(NotifyType_t.MESS_STATUS, "Ghostscript failed to create XPS");
							break;

						case GS_Task_t.PS_DISTILL:
							ShowMessage(NotifyType_t.MESS_STATUS, "Ghostscript failed to distill PS");
							break;

						case GS_Task_t.SAVE_RESULT:
							ShowMessage(NotifyType_t.MESS_STATUS, "Ghostscript failed to convert document");
							break;
					}
					return;
				}
				GSResult(asyncInformation.Params);
			}
			else
			{
				this.xaml_DistillProgress.Value = asyncInformation.Progress;
			}
		}
Пример #5
0
        /* Callback */
        private void gsCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            gsParams_t Value;
            gsEventArgs info;
            gsParams_t Params;

            try
            {
                Params = (gsParams_t)e.Result;
            }
            catch(System.Reflection.TargetInvocationException ee)
            {
                /* 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(this, output);
                return;
            }

            if (Params.task == GS_Task_t.PS_DISTILL)
                m_worker.DoWork -= new DoWorkEventHandler(gsWork2);
            else
                m_worker.DoWork -= new DoWorkEventHandler(gsWork1);

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