示例#1
0
        private void m_button_start_Click(object sender, System.EventArgs e)
        {
            if (!System.IO.Directory.Exists(this.m_textbox_to.Text))
            {
                System.Windows.Forms.MessageBox.Show(string.Format("Path does not exist {0}.", this.m_textbox_to.Text));
                return;
            }

            if (!System.IO.Directory.Exists(this.m_textbox_from.Text))
            {
                System.Windows.Forms.MessageBox.Show(string.Format("Path does not exist {0}.", this.m_textbox_from.Text));
                return;
            }

            int painter_hwnd = PainterAutomation.PainterApp.FindPainter8Window();

            if (painter_hwnd == 0)
            {
                System.Windows.Forms.MessageBox.Show("RIFConverter cannot find the painter 8 window. Start Painter 8 then try again.");
                return;
            }

            this.m_SavePreferences();
            this.m_StartWork();
            System.Threading.Thread.Sleep(1000);             // QUESTION: Why is this needed?

            bool   save_alpha;
            string cs = "rgb";

            if (this.m_OutputFormat == PainterAutomation.FormatsEnum.PSDFormat)
            {
                save_alpha = true;
            }
            else
            {
                save_alpha = false;
            }

            PainterAutomation.ConversionOptions co = new PainterAutomation.ConversionOptions(
                this.m_OutputFormat,
                save_alpha,
                cs);

            PainterAutomation.Delegates.LogCallback callback     = new PainterAutomation.Delegates.LogCallback(m_ConverterCallback);
            PainterAutomation.Delegates.JobCallback job_callback = new PainterAutomation.Delegates.JobCallback(this.m_ConverterJobCallback);

            painter_hwnd = PainterAutomation.PainterApp.FindPainter8Window();
            WindowsAutomation.UI.Window_ShowMaximized(painter_hwnd);
            PainterAutomation.PainterApp painterapp = new PainterAutomation.PainterApp(callback);
            painterapp.Activate();
            painterapp.VerifyNoDialogs();

            rc = new PainterAutomation.ConverterEngine(painterapp);
            rc.OnLogMessage      += callback;
            rc.OnJobStatusChange += job_callback;
            rc.PrepareJobs(this.m_textbox_from.Text, this.m_textbox_to.Text, co);
            this.m_total_jobs = rc.Jobs.Length;
            this.LogFromThread("Starting");
            this.m_StartWorkerThread();
        }
示例#2
0
		private void m_button_start_Click(object sender, System.EventArgs e)
		{

			if ( !System.IO.Directory.Exists( this.m_textbox_to.Text ) )
			{
				System.Windows.Forms.MessageBox.Show( string.Format( "Path does not exist {0}.", this.m_textbox_to.Text  ));
				return;
			}

			if ( !System.IO.Directory.Exists( this.m_textbox_from.Text ) )
			{
				System.Windows.Forms.MessageBox.Show( string.Format( "Path does not exist {0}.", this.m_textbox_from.Text ) );
				return;
			}

			int painter_hwnd = PainterAutomation.PainterApp.FindPainter8Window();	

			if ( painter_hwnd==0 )
			{
				System.Windows.Forms.MessageBox.Show( "RIFConverter cannot find the painter 8 window. Start Painter 8 then try again.");
				return;
			}

			this.m_SavePreferences();
			this.m_StartWork();
			System.Threading.Thread.Sleep(1000); // QUESTION: Why is this needed?

			bool save_alpha;
			string cs = "rgb";
			if ( this.m_OutputFormat == PainterAutomation.FormatsEnum.PSDFormat )
			{
				save_alpha = true;
			}
			else
			{
				save_alpha = false;
			}
					
			PainterAutomation.ConversionOptions co = new PainterAutomation.ConversionOptions( 
				this.m_OutputFormat , 
				save_alpha, 
				cs );

			PainterAutomation.Delegates.LogCallback callback = new PainterAutomation.Delegates.LogCallback( m_ConverterCallback);
			PainterAutomation.Delegates.JobCallback job_callback = new PainterAutomation.Delegates.JobCallback( this.m_ConverterJobCallback );
				
			painter_hwnd = PainterAutomation.PainterApp.FindPainter8Window();	
			WindowsAutomation.UI.Window_ShowMaximized( painter_hwnd );
			PainterAutomation.PainterApp painterapp  = new PainterAutomation.PainterApp( callback );
			painterapp.Activate();
			painterapp.VerifyNoDialogs();

			rc = new PainterAutomation.ConverterEngine( painterapp );
			rc.OnLogMessage += callback;
			rc.OnJobStatusChange += job_callback;
			rc.PrepareJobs(this.m_textbox_from.Text , this.m_textbox_to.Text , co);
			this.m_total_jobs=rc.Jobs.Length;
			this.LogFromThread( "Starting" );
			this.m_StartWorkerThread();
				

		}