Exemple #1
0
        protected override void DefWndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case WM_COPYDATA:
            {
                COPYDATASTRUCT mystr  = new COPYDATASTRUCT();
                Type           mytype = mystr.GetType();
                mystr = (COPYDATASTRUCT)m.GetLParam(mytype);
                TransferTask currentTask = transferTaskListControl1.GetTaskByID(new Guid(mystr.lpData.Substring(0, mystr.cbData)));
                if (currentTask != null)
                {
                    transferTaskListControl1.CompleteTask(currentTask);

                    //写入元数据
                    TemplateMetaData metaData;
                    MetaDts.TryGetValue(currentTask.ID, out metaData);

                    if (currentTask.Type == TaskType.Upload)
                    {
                        switch (metaData.MetaDataType)
                        {
                        case EnumMetaDataType.Raster:
                        {
                            Demo.Entities.RasterLayer rstLyr = metaData.LayerData as Demo.Entities.RasterLayer;
                            rstLyr.LAYERSIZE = (long)currentTask.Size;
                            if (Demo.Entities.RasterLayer.ImportRasterIndex(rstLyr) == 1)
                            {
                                //MessageBox.Show("元数据保存成功!");
                            }
                            else
                            {
                                MessageBox.Show("元数据保存失败!");
                            }
                            break;
                        }

                        case EnumMetaDataType.Features:
                        {
                            VectorLayer vecLyr = metaData.LayerData as VectorLayer;
                            vecLyr.LAYERSIZE = (long)currentTask.Size;
                            if (VectorLayer.ImportVectorIndex(vecLyr) == 1)
                            {
                                //MessageBox.Show("元数据保存成功!");
                            }
                            else
                            {
                                MessageBox.Show("元数据保存失败!");
                            }
                            break;
                        }

                        case EnumMetaDataType.Files:
                        {
                            FileLayer fileLyr = metaData.LayerData as FileLayer;
                            fileLyr.LAYERSIZE = (long)currentTask.Size;
                            if (FileLayer.ImportFileIndex(fileLyr) == 1)
                            {
                                //MessageBox.Show("元数据保存成功!");
                            }
                            else
                            {
                                MessageBox.Show("元数据保存失败!");
                            }
                            break;
                        }
                        }
                    }
                    else
                    {
                    }
                }
                break;
            }

            default:
                base.DefWndProc(ref m);
                break;
            }
        }