Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="port"></param>
        /// <param name="strType">DataSourceType enum + custom online maps</param>
        /// <param name="dataSorucePath"></param>
        /// <param name="disableClientCache"></param>
        /// <param name="displayNoDataTile"></param>
        /// <param name="style"></param>
        /// <param name="tilingSchemePath">Set this parameter only when type is ArcGISDynamicMapService and do not use Google Maps's tiling scheme</param>
        /// <returns>errors or warnings. string.empty if nothing wrong.</returns>
        public static string CreateService(string name, int port, string strType, string dataSorucePath, bool allowMemoryCache, bool disableClientCache, bool displayNoDataTile, VisualStyle style, string tilingSchemePath = null)
        {
            PBSServiceProvider serviceProvider = null;
            string             str;

            if (!PortEntities.ContainsKey(port))
            {
                str = StartServiceHost(port);
                if (str != string.Empty)
                {
                    return(str);
                }
            }
            serviceProvider = PortEntities[port].ServiceProvider;

            if (serviceProvider.Services.ContainsKey(name))
            {
                return("Servicename already exists!");
            }

            PBSService service;

            try
            {
                service = new PBSService(name, dataSorucePath, port, strType, allowMemoryCache, disableClientCache, displayNoDataTile, style, tilingSchemePath);
            }
            catch (Exception e)//in case of reading conf.xml or conf.cdi file error|| reading a sqlite db error
            {
                Utility.Log(LogLevel.Error, null, "Creating New Service(" + name + ") Error!\r\nData Source: " + dataSorucePath + "\r\n\r\n" + e.Message);
                return("Creating New Service(" + name + ") Error!\r\nData Source: " + dataSorucePath + "\r\n\r\n" + e.Message);
            }
            serviceProvider.Services.Add(name, service); //for process http request
            Services.Add(service);                       //for ui binding
            return(string.Empty);
        }
        public ArcGISDynamicMapServiceParams(PBS.Service.PBSService service)
        {
            InitializeComponent();
            if (!(service.DataSource is DataSourceArcGISDynamicMapService))
            {
                System.Windows.MessageBox.Show(FindResource("msgDatasourceTypeError").ToString());
                this.Close();
            }
            _arcgisDynamicMapService = service.DataSource as DataSourceArcGISDynamicMapService;

            txtbox_layers.Text           = _arcgisDynamicMapService.exportParam_layers;
            txtbox_layerDefs.Text        = _arcgisDynamicMapService.exportParam_layerDefs;
            txtbox_time.Text             = _arcgisDynamicMapService.exportParam_time;
            txtbox_layerTimeOptions.Text = _arcgisDynamicMapService.exportParam_layerTimeOptions;

            if (double.Parse(_arcgisDynamicMapService.AGSVersion) >= 10)
            {
                sp100.Visibility = Visibility.Visible;
            }
            else
            {
                sp100.Visibility = Visibility.Collapsed;
            }
        }