当前位置: 首页>>代码示例>>C#>>正文


C# Form1.startSurvey方法代码示例

本文整理汇总了C#中System.Form1.startSurvey方法的典型用法代码示例。如果您正苦于以下问题:C# Form1.startSurvey方法的具体用法?C# Form1.startSurvey怎么用?C# Form1.startSurvey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Form1的用法示例。


在下文中一共展示了Form1.startSurvey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: button2_Click


//.........这里部分代码省略.........

            }

            //check that the xml file exists
            if (!File.Exists(xmlFilePath))
            {

                errorBox.setLabel("Error: Cannot find expected configuration file:" + xmlFilePath);
                errorBox.ShowDialog();
                return;

            }

            //participantID
            string partID = selectedPart.getID();

            //has the user set the GPS baud rate, port and the main data dir ?

            portNum = (string)comboBox1.SelectedItem;
            baudRate = (string)comboBox2.SelectedItem;
            gpsCountry = (string)comboBox3.SelectedItem;

            if (portNum == null && Utils.GPSenabled)
            {

                errorBox.setLabel("Error: Please set the GPS port Number (settings)");
                errorBox.ShowDialog();
                return;

            }

            if (baudRate == null && Utils.GPSenabled)
            {

                errorBox.setLabel("Error: Please set the GPS baudrate (settings)");
                errorBox.ShowDialog();
                return;

            }

            if (gpsCountry == null && Utils.GPSenabled)
            {
                errorBox.setLabel("Error: Please set the GPS country (settings)");
                errorBox.ShowDialog();
                return;

            }

            //check that this participant does not already exist, i.e. that the new datadir does not exist

            string partDataDir = selectedPart.getPath();

            //turn off the GPS logger if on
            /*
            if (loggerStatus == "on")
            {

                //turn off until user exits the Q window
                //disable the timer
                timer1.Enabled = false;

                //close the serial port
                if (serialPort1.IsOpen)
                {
                    serialPort1.Close();

                }

                label11.Text = "suspended while Questionnaire is open";
                label12.Text = "suspended while Questionnaire is open";

                loggerStatus = "suspended";

            }
             * */

            //open the form
            currentSurvey = new Form1();

            try
            {

                //start the survey
                currentSurvey.startSurvey(xmlFilePath, partDataDir, partID, false, portNum, baudRate, this, gpsCountry);

                currentSurvey.Show();

                qFormIsOpen = true;

                openParticipantID = partID;

            }
            catch(ObjectDisposedException e2){

                //something went wrong with startup, e.g. XML parsing exception

                qFormIsOpen = false;

            }
        }
开发者ID:BioinformaticsArchive,项目名称:questionnaire,代码行数:101,代码来源:BaseForm.cs

示例2: button1_Click


//.........这里部分代码省略.........
                return;

            }

            if (baudRate == null && Utils.GPSenabled)
            {

                errorBox.setLabel("Error: Please set the GPS baudrate (settings)");
                errorBox.ShowDialog();
                return;

            }

            if (gpsCountry == null && Utils.GPSenabled)
            {
                errorBox.setLabel("Error: Please set the GPS country (settings)");
                errorBox.ShowDialog();
                return;

            }

            //check that this participant does not already exist, i.e. that the new datadir does not exist

            string partDataDir = dataDir + "\\participant_data_" + language + "_" + partID;

            if (Directory.Exists(partDataDir))
            {
                //user already exists
                errorBox.setLabel("Error: This Participant already exists.");
                errorBox.ShowDialog();
                return;

            }

            //create the new dir.
            try
            {

                Directory.CreateDirectory(partDataDir);

            }
            catch
            {

                errorBox.setLabel("Error: Could not create directory for this participant. You may not have permission to write to this location");
                errorBox.ShowDialog();
                return;

            }

            //if the logger is running: suspend it
            //i.e. disconnect from the serial port
            /*
            if (loggerStatus == "on")
            {

                //turn off until user exits the Q window
                //disable the timer
                timer1.Enabled = false;

                //close the serial port
                if (serialPort1.IsOpen)
                {
                    serialPort1.Close();

                }

                label11.Text = "suspended while Questionnaire is open";
                label12.Text = "suspended while Questionnaire is open";

                loggerStatus = "suspended";

            }
             * */

            //open the form
            currentSurvey = new Form1();

            try
            {

                //start the survey
                currentSurvey.startSurvey(xmlFilePath, partDataDir, partID, true, portNum, baudRate, this, gpsCountry);

                currentSurvey.Show();

                qFormIsOpen = true;

                openParticipantID = partID;

            }
            catch (ObjectDisposedException e2)
            {

                //something went wrong with startup, e.g. XML parsing exception

                qFormIsOpen = false;

            }
        }
开发者ID:BioinformaticsArchive,项目名称:questionnaire,代码行数:101,代码来源:BaseForm.cs


注:本文中的System.Form1.startSurvey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。