private void button1_Click(object sender, EventArgs e) { if (this.comboBoxCity.SelectedItem == null) { MessageBox.Show("城市不能为空!"); return; } if (this.comboBox1.SelectedItem == null) { MessageBox.Show("导出类型不能为空!"); return; } if (string.IsNullOrEmpty(this.textBox1.Text)) { MessageBox.Show("图纸不能为空!"); return; } this.DialogResult = DialogResult.OK; openFile = this.textBox1.Text; derivedType = GetChooseType(); openCity = contentList.result[comboBoxCity.SelectedIndex].oid; this.Close(); }
public MainForm(string cityName, DerivedTypeEnum derivedType) { //设置窗体的双缓冲 this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); InitializeComponent(); //利用反射设置DataGridView的双缓冲 Type dgvType = this.dataGridView1.GetType(); PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); pi.SetValue(this.dataGridView1, true, null); crtType = derivedType; InitPage(); //Thread thread = new Thread(InitData); //thread.Name = "子线程"; //thread.Start(); InitData(); //this.lb_City.Text = cityName; RegulatoryPost.FenTuZe.UIMethod.SetFormRoundRectRgn(this, 5); //设置圆角 model.projectId = cityName; //Point pt = new Point(this.data.AutoScrollPosition.X, // this.data.AutoScrollPosition.Y); //this.userControl11.Minimum = 0; //this.userControl11.Maximum = this.data.DisplayRectangle.Height; //this.userControl11.LargeChange = userControl11.Maximum / // userControl11.Height + this.data.Height; //this.userControl11.SmallChange = 15; //this.userControl11.Value = Math.Abs(this.data.AutoScrollPosition.Y); }
//public void customScrollbar1_Scroll(object sender, EventArgs e) //{ // data.AutoScrollPosition = new Point(0, // userControl11.Value); // userControl11.Invalidate(); // Application.DoEvents(); //} public MainForm(string cityName, DerivedTypeEnum derivedType, bool auTo) { crtType = derivedType; InitializeComponent(); InitPage(); AutoInitData(); //this.lb_City.Text = cityName; //this.Close(); }
internal void AutoOpenPointPlanFile(string file, string cityName, DerivedTypeEnum derivedType, List <string> failedFiles) { Document acDoc = Application.DocumentManager.Open(file, false); Database acCurDb = acDoc.Database; Editor ed = acDoc.Editor; DocumentLock docLock = acDoc.LockDocument(); try { ModelBase mb = new ModelBase(); //if (derivedType is DerivedTypeEnum.PointsPlan) //{ // mb = new PointsPlanModel(); //} //if (derivedType is DerivedTypeEnum.UnitPlan) //{ // mb = new UnitPlanModel(); //} //if (derivedType is DerivedTypeEnum.None) //{ // mb = new ModelBase(); //} // 判断是否读取布局空间(papermodel) MainForm.isOnlyModel = mb.IsOnlyModel; //MainForm.isOnlyModel = false; mb.DocName = Path.GetFileNameWithoutExtension(file); mb.projectId = cityName; // 获取图例 ModelBaseMethod <ModelBase> mbm = new ModelBaseMethod <ModelBase>(); mbm.GetAllLengedGemo(mb); mbm.GetExportLayers(mb); //// 获取特殊图层 //LayerSpecialCommand<ModelBase> layerSpecial = new LayerSpecialCommand<ModelBase>(); //layerSpecial.AddSpecialLayerModel(mb); //mb.LayerList = new List<string>{"道路中线"}; if (mb.LayerList != null) { foreach (string layer in mb.LayerList) { ModelBaseMethod <ModelBase> modelMe = new ModelBaseMethod <ModelBase>(); LayerModel lyModel = modelMe.GetAllLayerGemo(mb, layer); if (mb.allLines == null) { mb.allLines = new List <LayerModel>(); } mb.allLines.Add(lyModel); } //if (derivedType is DerivedTypeEnum.PointsPlan) //{ // PostModel.AutoPostModelBase(mb as ModelBase, failedFiles); //} //if (derivedType is DerivedTypeEnum.UnitPlan) //{ // PostModel.AutoPostModelBase(mb as ModelBase, failedFiles); //} //if (derivedType is DerivedTypeEnum.None) //{ // PostModel.AutoPostModelBase(mb as ModelBase, failedFiles); //} PostModel.AutoPostModelBase(mb as ModelBase, failedFiles); } docLock.Dispose(); acCurDb.Dispose(); acDoc.CloseAndDiscard(); acDoc.Dispose(); GC.Collect(); System.Windows.Forms.Application.DoEvents(); } catch (Exception e) { //string logFileName = @"C: \Users\Public\Documents\" + DateTime.Now.ToString("yyyy-MM-dd") + ".log"; //using (TextWriter logFile = TextWriter.Synchronized(File.AppendText(logFileName))) //{ // logFile.WriteLine(DateTime.Now); // logFile.WriteLine(e.Message); // logFile.WriteLine("\r\n"); // logFile.Flush(); // logFile.Close(); //} System.Windows.Forms.MessageBox.Show(e.Message); docLock.Dispose(); GC.Collect(); } // 发送类型 // 发送图层数据 }
private DerivedTypeEnum GetChooseType() { DerivedTypeEnum crtType = DerivedTypeEnum.None; //switch (comboBox1.SelectedIndex) //{ // case 0: // crtType = DerivedTypeEnum.UnitPlan; // break; // case 1: // crtType = DerivedTypeEnum.PointsPlan; // break; // case 2: // crtType = DerivedTypeEnum.Power10Kv; // break; // case 3: // crtType = DerivedTypeEnum.WaterSupply; // break; // case 4: // crtType = DerivedTypeEnum.HeatSupply; // break; // case 5: // crtType = DerivedTypeEnum.FuelGas; // break; // case 6: // crtType = DerivedTypeEnum.Communication; // break; // case 7: // crtType = DerivedTypeEnum.BuildingIntegrated; // break; // case 8: // crtType = DerivedTypeEnum.TheRoadSection; // break; // case 9: // crtType = DerivedTypeEnum.PipeLine; // break; // case 10: // crtType = DerivedTypeEnum.Sewage; // break; // case 11: // crtType = DerivedTypeEnum.FiveLine; // break; // case 12: // crtType = DerivedTypeEnum.LimitFactor; // break; // case 13: // crtType = DerivedTypeEnum.RainWater; // break; // case 14: // crtType = DerivedTypeEnum.ReuseWater; // break; // case 15: // crtType = DerivedTypeEnum.Road; // break; // case 16: // crtType = DerivedTypeEnum.CenterCityUseLandPlan; // break; // case 17: // crtType = DerivedTypeEnum.UseLandNumber; // break; // case 18: // crtType = DerivedTypeEnum.CenterCityLifeUseLandPlan; // break; // case 19: // crtType = DerivedTypeEnum.RoadSituation; // break; // case 20: // crtType = DerivedTypeEnum.FacilityControl; // break; // case 21: // crtType = DerivedTypeEnum.FiveLineControl; // break; // case 22: // crtType = DerivedTypeEnum.None; // break; //} return(crtType); }