コード例 #1
0
ファイル: FrmTaskWizard.cs プロジェクト: hy1314200/HyDM
        /// <summary>
        /// ����Task���󣬽��д���
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void wizardControl_FinishClick(object sender, CancelEventArgs e)
        {
            this.m_Task = GenerateTask();
            IDataImport dataImporter = null;
            switch (this.m_DataType)
            {
                case enumDataType.FileGDB:
                    dataImporter = new FileGDBDataImport();
                    break;

                case enumDataType.PGDB:
                    dataImporter = new MDBDataImport();
                    break;

                case enumDataType.SHP:
                    dataImporter = new SHPDataImport();
                    break;

                case enumDataType.VCT:
                    VCTDataImport vctDataImport=new VCTDataImport();
                   // vctDataImport.ConvertStepping += new VCTConvertStepHandler(vctDataImport_ConvertStepping);
                    dataImporter = vctDataImport;
                    break;
            }
            this.m_Task.DataImporter = dataImporter;
            this.m_Task.Messager = MessageHandler;
            //#if !DEBUG

            this.Hide();
            //#endif

            #region ��̨�̵߳��뷽ʽ

            //Hy.Common.UI.frmProgress frmProgress = new Hy.Common.UI.frmProgress();
            //dataImporter.ImportingObjectChanged += new ImportingObjectChangedHandler(frmProgress.ShowDoing);
            //System.Threading.Thread newThread = new System.Threading.Thread(new System.Threading.ThreadStart(RunTaskCreate));
            //newThread.Start();

            //frmProgress.ShowGifProgress();
            //frmProgress.ShowDialog();

            #endregion

            // �߳���ʾ���ȷ�ʽ

            dataImporter.ImportingObjectChanged += new ImportingObjectChangedHandler(dataImporter_ImportingObjectChanged);

            try
            {
                bool isSucceed = m_Task.Create();

                isSucceed = isSucceed && m_Task.CreateMXD();

                if (isSucceed)
                {
                    //MessageBoxApi.ShowFinishedMessageBox("���񴴽��ɹ�!");
                    BolFinished = true;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBoxApi.ShowFinishedMessageBox("���񴴽�ʧ��!");
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            catch (Exception exp)
            {
                MessageHandler(enumMessageType.Exception, exp.ToString());
            }
            finally
            {
                m_GifProgress.Hide();
                //m_Progress.Hide();
            }
        }
コード例 #2
0
ファイル: FrmBatchTasksWizard.cs プロジェクト: hy1314200/HyDM
        private ExtendTask GetTaskFromDataRow(DataRow rowTask)
        {
            if (rowTask == null)
                return null;

            // Task本身
            ExtendTask task = new ExtendTask();
            task.DatasourceType = (enumDataType)rowTask["DataType"];
            task.MapScale = (int)rowTask["MapScale"];
            task.Name = rowTask["TaskName"] as string;
            task.Path = rowTask["TaskPath"] as string;
            task.SourcePath = rowTask["Datasource"] as string;
            task.StandardName = cmbStandard.SelectedItem as string;
            task.SchemaID = ((KeyValuePair<string, string>)cmbSchema.SelectedItem).Key;
            task.TopoTolerance = Convert.ToDouble( rowTask["TopoTolerance"]);
            task.UseSourceDirectly = (bool)rowTask["UseSourceDirectly"];
            task.Messager = this.MessageHandler;

            // DataImport
            IDataImport dataImporter = null;
            if (task.DatasourceType == enumDataType.VCT)
            {
                dataImporter = new VCTDataImport();
            }
            else
            {
                NoReferenceDataImport noRefDataImport = new NoReferenceDataImport();
                noRefDataImport.ReferenceLayer = ((KeyValuePair<string, string>)cmbSpatialRefLayer.SelectedItem).Key;
                dataImporter = noRefDataImport;
            }
            dataImporter.ImportingObjectChanged+=new ImportingObjectChangedHandler(dataImporter_ImportingObjectChanged);
            task.DataImporter = dataImporter;

            string strCheckMode = rowTask["CheckMode"] as string;
            enumCheckMode checkMode = enumCheckMode.CreateOnly;

            if (strCheckMode == Text_CheckMode_CheckPartly)
            {
                checkMode = enumCheckMode.CheckPartly;
            }
            if (strCheckMode == Text_CheckMode_CheckAll)
            {
                checkMode = enumCheckMode.CheckAll;
                task.ReadyForCheck(true);
            }
            task.CheckMode = checkMode;
            task.RuleInfos = rowTask["Hy.Check.Rules"] as List<SchemaRuleEx>;

            return task;
        }