Beispiel #1
0
 private void Update_Poly_ToDB(object sender, RoutedEventArgs e)
 {
     try
     {
         for (int i = 0; i < polygonAreaList.Count; i++)
         {
             if (i >= list_poly.Count)
             {
                 continue;
             }
             YimaWF.data.ForbiddenZone fz = new YimaWF.data.ForbiddenZone();
             TextBox tb10 = FindName(PolygonDataGrid, 0, i, "id") as TextBox;
             TextBox tb11 = FindName(PolygonDataGrid, 1, i, "name") as TextBox;
             TextBox tb12 = FindName(PolygonDataGrid, 2, i, "level") as TextBox;
             TextBox tb13 = FindName(PolygonDataGrid, 3, i, "note") as TextBox;
             fz.ID = Convert.ToInt32(tb10.Text);
             if (fz.ID < 200 || fz.ID > 255)
             {
                 continue;
             }
             fz.Name       = tb11.Text;
             fz.AlarmLevel = Convert.ToInt32(tb12.Text);
             fz.Remark     = tb13.Text;
             fz.PointList  = list_poly[i].PointList;
             (new dataAnadll.PolygonAreaManager()).UpdatePolygonArea(fz, GetgeoFactor());
         }
         Update_PolyAndPipe_FromDB();
     }
     catch (Exception ee)
     {
     }
 }
Beispiel #2
0
        private void Delete_Click(object sender, RoutedEventArgs e)//行删除
        {
            try
            {
                Button b     = sender as Button;
                int    index = int.Parse(b.Tag.ToString());
                App    app   = (App)App.Current;

                if (!polygonBtn.IsEnabled)
                {
                    //MainWindow.data.removePolygonAeraByName(MainWindow.mycon, polygonAreaList[index].Name);//数据库删除多边形
                    YimaWF.data.ForbiddenZone fz = new YimaWF.data.ForbiddenZone();
                    fz.ID = Convert.ToInt32(polygonAreaList[index].ID);
                    (new dataAnadll.PolygonAreaManager()).DeletePolygonArea(fz);
                    int num = (int)double.Parse(polygonAreaList[index].ID) - 210;
                    MonitoringX.deleteForbiddenZone(polygonAreaList[index].Name, num);//显控同步+海图删除
                    polygonAreaList[index].ID          = null;
                    polygonAreaList[index].Name        = null;
                    polygonAreaList[index].Level       = null;
                    polygonAreaList[index].Description = null;
                    polygonAreaList[index].ReadOnly    = true;
                    polyID[index] = 0;
                }
                else
                {
                    //MainWindow.data.removeProtectAeraByName(MainWindow.mycon, pipelineAreaList[index].Name);//数据库删除管道
                    YimaWF.data.Pipeline pl = new YimaWF.data.Pipeline();
                    pl.ID = Convert.ToInt32(pipelineAreaList[index].ID);
                    (new dataAnadll.PipeLineProtectAreaManager()).DeletePipeLineProtectArea(pl);
                    int num = (int)double.Parse(pipelineAreaList[index].ID) - 220;
                    MonitoringX.deletePipeline(pipelineAreaList[index].Name, num);//显控同步+海图删除
                    pipelineAreaList[index].ID          = null;
                    pipelineAreaList[index].Name        = null;
                    pipelineAreaList[index].Width       = null;
                    pipelineAreaList[index].Level       = null;
                    pipelineAreaList[index].Description = null;
                    pipelineAreaList[index].ReadOnly    = true;
                    pipeID[index] = 0;
                }
                Update_PolyAndPipe_FromDB();

                if (!polygonBtn.IsEnabled)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        ToggleButton tb = FindName("tb" + i.ToString()) as ToggleButton;
                        Button       bt = FindName("b" + i.ToString()) as Button;
                        if (String.IsNullOrWhiteSpace(polygonAreaList[i].ID))
                        {
                            tb.IsChecked = false;
                            tb.IsEnabled = false;
                            bt.IsEnabled = false;
                        }
                        else
                        {
                            tb.IsChecked = false;
                            tb.IsEnabled = true;
                            bt.IsEnabled = true;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < 5; i++)
                    {
                        ToggleButton tb = FindName("tb" + i.ToString()) as ToggleButton;
                        Button       bt = FindName("b" + i.ToString()) as Button;
                        if (String.IsNullOrWhiteSpace(pipelineAreaList[i].ID))
                        {
                            tb.IsChecked = false;
                            tb.IsEnabled = false;
                            bt.IsEnabled = false;
                        }
                        else
                        {
                            tb.IsChecked = false;
                            tb.IsEnabled = true;
                            bt.IsEnabled = true;
                        }
                    }
                }
            }
            catch (Exception ee)
            {
            }
        }