Esempio n. 1
0
        private void ExportBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!RequiredFieldsAvailable())
            {
                logService.WriteToLogLevel("Cannot export to QuestionPro. One or more required fields empty. ", LogLevelEnum.Info);
                return;
            }

            /*
             * string htmlfilename = "qpupload.html";
             * string tempfullpathfilename = System.IO.Path.Combine(BSkyAppData.RoamingUserBSkyTempPath, htmlfilename);
             *
             * ow.DumpAllAnalyisOuput(tempfullpathfilename, C1.WPF.FlexGrid.FileFormat.Html, false);
             *
             * string htmltext = File.ReadAllText(tempfullpathfilename, System.Text.Encoding.UTF8);
             */

            string htmltext = ow.DumpAllAnalyisOuput_QPro();

            PutRequestAsync(htmltext); //this statement does not block the main thread but runs separately
                                       //we can use 'await' in the above statement to make sure PUT finishes
                                       //and then the control comes back and then we do not need Thread.Sleep().

            Thread.Sleep(3000);        //wait 3 seconds. No actual need. Just to be safe.
                                       //Not sure what happens if user is trying to upload a HUGE output and if control comes back user
                                       //just after 3 sec, user may try to do something that modifies the output window,
                                       //which is probably in a process of PUT uploading due to HUGE output.
                                       //for HUGE output uploading, we must use 'await' in PutRequestAsync and
                                       //then no need to Thread.Sleep(), this will block user interaction with UI
                                       //making sure that user do not do anything to generate more output.

            this.Close();
        }