예제 #1
0
        public void addNewUrl(string url)
        {
            ApiGatewayUrl apiUrl = new ApiGatewayUrl();

            apiUrl = apiUrl.CheckUrl(url);
            urlrepository.Add(apiUrl);
        }
예제 #2
0
        public ApiGatewayUrl CheckURL(string url)
        {
            var Url = new ApiGatewayUrl();

            Url.CheckUrl(url);
            urls.Add(Url);
            UrlRepository.addNewUrl(url);

            var config = ConfigurationManager.OpenMappedMachineConfiguration(new ConfigurationFileMap(@"..\..\..\ServiceConfiguration.config"));

            ConfigSection = config.GetSection("serviceSection") as ServiceSection;

            ConfigSection.Add(new Service
            {
                ServiceType = "ApiGateWay",
                ServiceName = url,
                Metric      = "url",
                Value       = Url.Code.Description
            });
            config.Save(ConfigurationSaveMode.Modified);
            return(Url);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            UrlList.Visibility = Visibility.Visible;
            var url = new ApiGatewayUrl();

            url.CheckUrl(UrlTxt.Text);
            UrlVM.UrlRepository.addNewUrl(UrlTxt.Text);
            UrlVM.urls.Add(url);

            var config = ConfigurationManager.OpenMappedMachineConfiguration(new ConfigurationFileMap(@"..\..\ServiceConfiguration.config"));

            ConfigSection = config.GetSection("serviceSection") as ServiceSection;

            ConfigSection.Add(new Service
            {
                ServiceType = "ApiGateWay",
                ServiceName = url.Url,
                Metric      = "url",
                Value       = url.Code.Description
            });
            config.Save(ConfigurationSaveMode.Modified);
            UrlList.Items.Refresh();
        }