Exemple #1
0
        private void SettingForm_Load(object sender, EventArgs e)
        {
            try
            {
                filePath             = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                accessIni            = new AccessIni();
                localIP              = accessIni.ReadIni("Settings", "LocalIP", "", filePath);
                ManagementServerIP   = accessIni.ReadIni("Settings", "服务管理器IP", "", filePath);
                ManagementServerPort = int.Parse(accessIni.ReadIni("Settings", "服务管理器端口号", "0", filePath));
                OMServerIP           = accessIni.ReadIni("Settings", "采集服务IP", "", filePath);
                OMServerPort         = int.Parse(accessIni.ReadIni("Settings", "采集服务端口号", "0", filePath));
                LogServerIP          = accessIni.ReadIni("Settings", "日志服务IP", "", filePath);
                LogServerPort        = int.Parse(accessIni.ReadIni("Settings", "日志服务端口号", "0", filePath));

                textBoxX_LocalIP.Text              = localIP;
                textBoxX_ManagementServerIP.Text   = ManagementServerIP;
                textBoxX_ManagementServerPort.Text = ManagementServerPort.ToString();
                textBoxX_OMServerIP.Text           = OMServerIP;
                textBoxX_OMServerPort.Text         = OMServerPort.ToString();
                textBoxX_LogServerIP.Text          = LogServerIP;
                textBoxX_LogServerPort.Text        = LogServerPort.ToString();
                ;
            }
            catch
            {
            }
        }
Exemple #2
0
 private void LoadConfiguration()
 {
     try
     {
         string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
         if (!File.Exists(filePath))
         {
             //File.Create(filePath);
             using (StreamWriter sw = new StreamWriter(filePath))
             {
                 sw.WriteLine("[Settings]");
                 sw.WriteLine("LocalIP=");
                 sw.WriteLine("服务管理器IP=");
                 sw.WriteLine("服务管理器端口号=");
                 sw.WriteLine("采集服务IP=");
                 sw.WriteLine("采集服务端口号=");
                 sw.WriteLine("日志服务IP=");
                 sw.WriteLine("日志服务端口号=");
                 sw.WriteLine("PStationLevel=");
                 sw.WriteLine("StationLevel=");
                 sw.WriteLine("MapSkipLevel=");
             }
         }
         AccessIni accessIni = new AccessIni();
         localIP         = accessIni.ReadIni("Settings", "LocalIP", "", filePath);
         serverManagerIP = accessIni.ReadIni("Settings", "服务管理器IP", "", filePath);
         int.TryParse(accessIni.ReadIni("Settings", "服务管理器端口号", "0", filePath), out serverManagerPort);
         OMServerIP = accessIni.ReadIni("Settings", "采集服务IP", "", filePath);
         int.TryParse(accessIni.ReadIni("Settings", "采集服务端口号", "0", filePath), out OMServerPort);
         logServerIP = accessIni.ReadIni("Settings", "日志服务IP", "", filePath);
         int.TryParse(accessIni.ReadIni("Settings", "日志服务端口号", "0", filePath), out logServerPort);
         if (!ValidData(localIP, serverManagerIP, serverManagerPort.ToString(), OMServerIP, OMServerPort.ToString(), logServerIP, logServerPort.ToString()))
         {
             MessageBox.Show("运维管理尚未正确配置数据,请前往“设置”菜单进行设置!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     try
     {
         string    filePath  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
         AccessIni accessIni = new AccessIni();
         localIP         = accessIni.ReadIni("Settings", "LocalIP", "", filePath);
         serverManagerIP = accessIni.ReadIni("Settings", "服务管理器IP", "", filePath);
         int.TryParse(accessIni.ReadIni("Settings", "服务管理器端口号", "0", filePath), out serverManagerPort);
         OMServerIP = accessIni.ReadIni("Settings", "采集服务IP", "", filePath);
         int.TryParse(accessIni.ReadIni("Settings", "采集服务端口号", "0", filePath), out OMServerPort);
         logServerIP = accessIni.ReadIni("Settings", "日志服务IP", "", filePath);
         int.TryParse(accessIni.ReadIni("Settings", "日志服务端口号", "0", filePath), out logServerPort);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #3
0
        private void MapForm_Load(object sender, EventArgs e)
        {
            expandablePanel_DeviceStatusException.Expanded = false;
            expandablePanel_Tool.Expanded = false;
            expandablePanel_Tool.Width = 100;
            comboBoxEx_Map.SelectedIndex = 0;

            AccessIni accessIni = new AccessIni();
            string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
            int.TryParse(accessIni.ReadIni("Settings", "PStationLevel", "11", filePath), out PStationLevel);
            int.TryParse(accessIni.ReadIni("Settings", "StationLevel", "13", filePath), out StationLevel);
            int.TryParse(accessIni.ReadIni("Settings", "MapSkipLevel", "15", filePath), out MapSkipLevel);
            try
            {
                System.Net.IPHostEntry IPHostEntry = System.Net.Dns.GetHostEntry("ditu.google.cn");
                labelX_MapStatus.Text = "在线模式";
            }
            catch
            {
                mapControl.Manager.Mode = AccessMode.CacheOnly;
                labelX_MapStatus.Text = "离线模式";
            }
            mapControl.CacheLocation = Environment.CurrentDirectory + "\\GMapCache\\"; //缓存位置
            mapControl.MapProvider = GMapProviders.GoogleChinaMap; //google china 地图
            mapControl.MinZoom = 2;  //最小比例
            mapControl.MaxZoom = 24; //最大比例
            mapControl.Zoom = 11;     //当前比例
            mapControl.ShowCenter = false; //不显示中心十字点
            mapControl.DragButton = System.Windows.Forms.MouseButtons.Left; //左键拖拽地图
            mapControl.Position = new PointLatLng(30.6599, 104.0657); //地图中心位置:成都

            mapControl.Overlays.Add(baseOverlay);
            mapControl.Overlays.Add(markerOverlay);
            mapControl.Overlays.Add(polylineOverlay);
            mapControl.Overlays.Add(polyline_Temporarily);

            mapControl.MouseMove += new MouseEventHandler(mapControl_OnMouseMove);
            mapControl.MouseClick += new MouseEventHandler(mapControl_MouseClick);
            mapControl.MouseDoubleClick += new MouseEventHandler(mapControl_MouseDoubleClick);

            mapControl.OnMarkerEnter += new MarkerEnter(mapControl_OnMarkerEnter);
            mapControl.OnMarkerLeave += new MarkerLeave(mapControl_OnMarkerLeave);
            mapControl.OnMarkerClick += new MarkerClick(mapControl_OnMarkerClick);
            mapControl.OnRouteEnter += new RouteEnter(mapControl_OnRouteEnter);
            mapControl.OnRouteLeave += new RouteLeave(mapControl_OnRouteLeave);
            mapControl.OnRouteClick += new RouteClick(mapControl_OnRouteClick);
        }