private void m_button_start_Click(object sender, System.EventArgs e) { if (!System.IO.Directory.Exists(this.m_textbox_to.Text)) { this.ErrorMessage("Path does not exist {0}.", this.m_textbox_to.Text); return; } if (!System.IO.Directory.Exists(this.m_textbox_from.Text)) { this.ErrorMessage("Path does not exist {0}.", this.m_textbox_to.Text); return; } int painter_hwnd = XaraAutomation.XaraApp.FindXaraAppHWND(); if (painter_hwnd == 0) { this.ErrorMessage("cannot find the window with title \"{0}\". Start Xara X1 then try again.", XaraAutomation.WindowTextEnum.XaraXWindowText); return; } this.m_SavePreferences(); this.m_StartWork(); System.Threading.Thread.Sleep(1000); // QUESTION: Why is this needed? XaraAutomation.ConversionOptions co = new XaraAutomation.ConversionOptions( XaraAutomation.FormatsEnum.TIFFormat); XaraAutomation.Delegates.LogCallback callback = new XaraAutomation.Delegates.LogCallback(m_ConverterCallback); XaraAutomation.Delegates.JobCallback job_callback = new XaraAutomation.Delegates.JobCallback(this.m_ConverterJobCallback); painter_hwnd = XaraAutomation.XaraApp.FindXaraAppHWND(); WindowsAutomation.UI.Window_ShowMaximized(painter_hwnd); XaraAutomation.XaraApp painterapp = new XaraAutomation.XaraApp(callback); painterapp.Activate(); painterapp.VerifyNoDialogs(); rc = new XaraAutomation.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(); }
private void m_button_start_Click(object sender, System.EventArgs e) { if ( !System.IO.Directory.Exists( this.m_textbox_to.Text ) ) { this.ErrorMessage( "Path does not exist {0}.", this.m_textbox_to.Text ); return; } if ( !System.IO.Directory.Exists( this.m_textbox_from.Text ) ) { this.ErrorMessage("Path does not exist {0}.", this.m_textbox_to.Text); return; } int painter_hwnd = XaraAutomation.XaraApp.FindXaraAppHWND(); if ( painter_hwnd==0 ) { this.ErrorMessage( "cannot find the window with title \"{0}\". Start Xara X1 then try again.", XaraAutomation.WindowTextEnum.XaraXWindowText); return; } this.m_SavePreferences(); this.m_StartWork(); System.Threading.Thread.Sleep(1000); // QUESTION: Why is this needed? XaraAutomation.ConversionOptions co = new XaraAutomation.ConversionOptions( XaraAutomation.FormatsEnum.TIFFormat ); XaraAutomation.Delegates.LogCallback callback = new XaraAutomation.Delegates.LogCallback( m_ConverterCallback); XaraAutomation.Delegates.JobCallback job_callback = new XaraAutomation.Delegates.JobCallback( this.m_ConverterJobCallback ); painter_hwnd = XaraAutomation.XaraApp.FindXaraAppHWND(); WindowsAutomation.UI.Window_ShowMaximized( painter_hwnd ); XaraAutomation.XaraApp painterapp = new XaraAutomation.XaraApp( callback ); painterapp.Activate(); painterapp.VerifyNoDialogs(); rc = new XaraAutomation.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(); }