Exemplo n.º 1
0
        public ShowcaseView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
        {
            // Get the attributes for the ShowcaseView
            var styled = context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.ShowcaseView, Resource.Attribute.showcaseViewStyle, Resource.Style.ShowcaseView);

            mBackgroundColor = styled.GetColor(Resource.Styleable.ShowcaseView_sv_backgroundColor, Color.Argb(128, 80, 80, 80));
            var showcaseColor = styled.GetColor(Resource.Styleable.ShowcaseView_sv_showcaseColor, Color.ParseColor("#33B5E5"));

            int titleTextAppearance  = styled.GetResourceId(Resource.Styleable.ShowcaseView_sv_titleTextAppearance, Resource.Style.TextAppearance_ShowcaseView_Title);
            int detailTextAppearance = styled.GetResourceId(Resource.Styleable.ShowcaseView_sv_detailTextAppearance, Resource.Style.TextAppearance_ShowcaseView_Detail);

            buttonText = styled.GetString(Resource.Styleable.ShowcaseView_sv_buttonText);
            styled.Recycle();

            metricScale = Context.Resources.DisplayMetrics.Density;
            mEndButton  = (Button)LayoutInflater.From(context).Inflate(Resource.Layout.showcase_button, null);

            mShowcaseDrawer = new ClingDrawer(Resources, showcaseColor);

            // TODO: This isn't ideal, ClingDrawer and Calculator interfaces should be separate
            mTextDrawer = new TextDrawer(metricScale, mShowcaseDrawer);
            mTextDrawer.SetTitleStyling(context, titleTextAppearance);
            mTextDrawer.SetDetailStyling(context, detailTextAppearance);

            var options = new ConfigOptions();

            options.ShowcaseId = Id;

            ConfigurationOptions = options;

            Init();
        }
Exemplo n.º 2
0
        public static void Register()
        {
            ConfigOptions options = new ConfigOptions
            {
                PushAuthorization        = AuthorizationLevel.Application,
                DiagnosticsAuthorization = AuthorizationLevel.Anonymous,
            };

            options.LoginProviders.Remove(typeof(AzureActiveDirectoryLoginProvider));
            options.LoginProviders.Add(typeof(AzureActiveDirectoryExtendedLoginProvider));

            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // Now add any missing connection strings and app settings from the environment.
            // Any envrionment variables found with names that match existing connection
            // string and app setting names will be used to replace the value.
            // This allows the Web.config (which typically would contain secrets) to be
            // checked in, but requires people running the tests to config their environment.
            IServiceSettingsProvider  settingsProvider = config.DependencyResolver.GetServiceSettingsProvider();
            ServiceSettingsDictionary settings         = settingsProvider.GetServiceSettings();
            IDictionary environmentVariables           = Environment.GetEnvironmentVariables();

            foreach (var conKey in settings.Connections.Keys.ToArray())
            {
                var envKey = environmentVariables.Keys.OfType <string>().FirstOrDefault(p => p == conKey);
                if (!string.IsNullOrEmpty(envKey))
                {
                    settings.Connections[conKey].ConnectionString = (string)environmentVariables[envKey];
                }
            }

            foreach (var setKey in settings.Keys.ToArray())
            {
                var envKey = environmentVariables.Keys.OfType <string>().FirstOrDefault(p => p == setKey);
                if (!string.IsNullOrEmpty(envKey))
                {
                    settings[setKey] = (string)environmentVariables[envKey];
                }
            }

            // Emulate the auth behavior of the server: default is application unless explicitly set.
            config.Properties["MS_IsHosted"] = true;

            config.Formatters.JsonFormatter.SerializerSettings.DateFormatHandling = DateFormatHandling.IsoDateFormat;

            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <IntIdRoundTripTableItem, IntIdRoundTripTableItemDto>()
                .ForMember(dto => dto.Id, map => map.MapFrom(db => MySqlFuncs.LTRIM(MySqlFuncs.StringConvert(db.Id))));
                cfg.CreateMap <IntIdRoundTripTableItemDto, IntIdRoundTripTableItem>()
                .ForMember(db => db.Id, map => map.MapFrom(dto => MySqlFuncs.LongParse(dto.Id)));

                cfg.CreateMap <IntIdMovie, IntIdMovieDto>()
                .ForMember(dto => dto.Id, map => map.MapFrom(db => MySqlFuncs.LTRIM(MySqlFuncs.StringConvert(db.Id))));
                cfg.CreateMap <IntIdMovieDto, IntIdMovie>()
                .ForMember(db => db.Id, map => map.MapFrom(dto => MySqlFuncs.LongParse(dto.Id)));
            });

            Database.SetInitializer(new DbInitializer());
        }
Exemplo n.º 3
0
        static PushNotificationsService()
        {
            var options = new ConfigOptions();
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            Services = new ApiServices(config);
        }
Exemplo n.º 4
0
 internal ImmutableConfig(
     ImmutableArray <IColumnProvider> uniqueColumnProviders,
     ImmutableHashSet <ILogger> uniqueLoggers,
     ImmutableHashSet <HardwareCounter> uniqueHardwareCounters,
     ImmutableHashSet <IDiagnoser> uniqueDiagnosers,
     ImmutableArray <IExporter> uniqueExporters,
     ImmutableHashSet <IAnalyser> uniqueAnalyzers,
     ImmutableHashSet <IValidator> uniqueValidators,
     ImmutableHashSet <IFilter> uniqueFilters,
     ImmutableHashSet <BenchmarkLogicalGroupRule> uniqueRules,
     ImmutableHashSet <Job> uniqueRunnableJobs,
     ConfigUnionRule unionRule,
     string artifactsPath,
     CultureInfo cultureInfo,
     IOrderer orderer,
     SummaryStyle summaryStyle,
     ConfigOptions options)
 {
     columnProviders  = uniqueColumnProviders;
     loggers          = uniqueLoggers;
     hardwareCounters = uniqueHardwareCounters;
     diagnosers       = uniqueDiagnosers;
     exporters        = uniqueExporters;
     analysers        = uniqueAnalyzers;
     validators       = uniqueValidators;
     filters          = uniqueFilters;
     rules            = uniqueRules;
     jobs             = uniqueRunnableJobs;
     UnionRule        = unionRule;
     ArtifactsPath    = artifactsPath;
     CultureInfo      = cultureInfo;
     Orderer          = orderer;
     SummaryStyle     = summaryStyle;
     Options          = options;
 }
        private ConfigOptions Merge(ConfigOptions current, ConfigOptions newer)
        {
            var client = newer.Client == default(int) ? current.Client : newer.Client;
            var url    = newer.Url == default(string) ? current.Url : newer.Url;

            return(new ConfigOptions(client, url));
        }
Exemplo n.º 6
0
        public string CreateConfig(string configName, string inisPath, ConfigOptions configOptions)
        {
            var configPath = $"{configsDir}\\{configName}";

            Directory.CreateDirectory(configPath);

            CreateUiFile(configPath, inisPath, configOptions);

            if (configOptions.Flags.HasFlag(ConfigFlags.CopyVmSettings))
            {
                fileHelpers.CopyWithoutException($"{inisPath}\\{ConfiguratorConstants.VmFileName}", $"{configPath}\\{ConfiguratorConstants.VmFileName}");
            }
            if (configOptions.Flags.HasFlag(ConfigFlags.CopyGsdxSettings))
            {
                fileHelpers.CopyWithoutException($"{inisPath}\\{ConfiguratorConstants.GsdxFileName}", $"{configPath}\\{ConfiguratorConstants.GsdxFileName}");
            }
            if (configOptions.Flags.HasFlag(ConfigFlags.CopySpu2xSettings))
            {
                fileHelpers.CopyWithoutException($"{inisPath}\\{ConfiguratorConstants.Spu2xFileName}", $"{configPath}\\{ConfiguratorConstants.Spu2xFileName}");
            }
            if (configOptions.Flags.HasFlag(ConfigFlags.CopyLilyPadSettings))
            {
                fileHelpers.CopyWithoutException($"{inisPath}\\{ConfiguratorConstants.LilyPadFileName}", $"{configPath}\\{ConfiguratorConstants.LilyPadFileName}");
            }

            SetVmSettings(configPath, configOptions);

            appSettings.UpdateConfigs();
            return(configPath);
        }
Exemplo n.º 7
0
 public void DoSetup()
 {
     DefaultFromDocs.RegisterAll(); // needs to be called here because we can't be sure whether preload has been called before or not
     UnityFromDocs.RegisterAll();
     defaults = Config.DefaultOptions;
     Config.DefaultOptions = ConfigOptions.AllowMissingExtraFields;
 }
Exemplo n.º 8
0
        public void Connect_With_Serval_Arg_Test2()
        {
            List <string> list     = new List <string>();
            int           conn_num = 100;

            Sequoiadb [] dbs = new Sequoiadb[100];
            int          i   = 0;

            list.Add("192.168.20.35:12340");
            list.Add("192.168.20.165:11810");
            list.Add("192.168.20.35:12340");
            list.Add("192.168.20.42:50000");
            list.Add("192.168.20.42:11810");

            ConfigOptions options = new ConfigOptions();

            options.MaxAutoConnectRetryTime = 0;
            options.ConnectTimeout          = 100;
            // connect
            for (i = 0; i < conn_num; i++)
            {
                dbs[i] = new Sequoiadb(list);
                dbs[i].Connect("", "", options);
            }
            for (i = 0; i < conn_num; i++)
            {
                dbs[i].Disconnect();
            }
        }
Exemplo n.º 9
0
            public void Update()
            {
                if (DateTime.Now > m_next_check_time)
                {
                    m_next_check_time = DateTime.Now + m_interval;

                    m_file.Refresh();
                    if (m_file.Exists &&
                        (m_last_file_write_time == null || m_file.LastWriteTime > m_last_file_write_time.Value))
                    {
                        try
                        {
                            string        text    = File.ReadAllText(m_file.FullName);
                            ConfigOptions options = JsonConvert.DeserializeObject <ConfigOptions>(text);
                            if (options != null)
                            {
                                LogManager.Options = options;
                            }
                        }
                        catch (Exception ex)
                        {
                            EventLog el = new ApplicationEventLog();
                            el.LogError("Error: disabling logging\n\n" + ex.Message);
                            lock (LogManager.c_lock)
                                LogManager.LogFile = null;
                        }

                        m_last_file_write_time = m_file.LastWriteTime;
                    }
                }
            }
Exemplo n.º 10
0
        public InMemoryStorageConnection(ConfigOptions capOptions)
        {
            _capOptions = capOptions;

            PublishedMessages = new List <PublishedMessage>();
            ReceivedMessages  = new List <ReceivedMessage>();
        }
Exemplo n.º 11
0
        public void Initialize()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            //config.Formatters.Clear();
            //config.Formatters.Add(new JsonMediaTypeFormatter());

            //Read more about it
            // http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization#handling_circular_object_references
            // to prevent cycle references
            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling      = Newtonsoft.Json.ReferenceLoopHandling.Serialize;
            config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;

            // this is the default and by default is used Json.net
            config.Formatters.JsonFormatter.UseDataContractJsonSerializer = false;

            AutoMapperConfig();

            var migrator = new DbMigrator(new Configuration());

            migrator.Update();
        }
Exemplo n.º 12
0
        public override void TestInitialize()
        {
            base.TestInitialize();

            ConfigOptions = new ConfigOptions()
            {
                FetchConfig = TypeCollectionTester.GetDefaultFetchConfig(),
                QueryParams = new NameValueCollection()
            };

            WorkspaceBuilder.DefaultProject
            .AddFakeMvc();

            // Test class to use as return/param
            AddClass("TestClass")
            .AddScriptObjectAttribute()
            .AddProperty("DontCare", "int")
            .Commit();

            // Test generic class to use as return/param
            AddClass("TestGenericClass")
            .AddScriptObjectAttribute()
            .AddGenericParameter("T")
            .AddProperty("GenericProp", "T")
            .Commit();

            ControllerBuilder = AddClass(ControllerFullName)
                                .WithControllerBaseClass()

                                // Fake Json method
                                .AddMethod("Json", MvcConstants.JsonResult_AspNetCore)
                                .AddParameter("data", "object")
                                .AddLineOfCode("return null;", 0)
                                .Commit();
        }
Exemplo n.º 13
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            options.LoginProviders.Add(typeof(helpsLoginProvider));

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            // Set default and null value handling to "Include" for Json Serializer
            config.Formatters.JsonFormatter.SerializerSettings.DefaultValueHandling = Newtonsoft.Json.DefaultValueHandling.Include;
            config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling    = Newtonsoft.Json.NullValueHandling.Include;
            config.SetIsHosted(true);

            ExceptionlessClient.Default.RegisterWebApi(config);

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            Database.SetInitializer(new helpsInitializer());
            var migrator = new DbMigrator(new Configuration());
            //migrator.Update();
        }
Exemplo n.º 14
0
        public void ConnectWithSSLTest()
        {
            ConfigOptions   cfgOpt = null;
            CollectionSpace cs2    = null;
            DBCollection    coll2  = null;
            Sequoiadb       sdb2   = new Sequoiadb(config.conf.Coord.Address);

            System.Console.WriteLine(config.conf.Coord.Address.ToString());

            // set connect using ssl
            cfgOpt        = new ConfigOptions();
            cfgOpt.UseSSL = true;

            // connect to database
            sdb2.Connect("", "", cfgOpt);
            if (true == sdb2.IsCollectionSpaceExist("testSSL"))
            {
                cs2 = sdb2.GetCollecitonSpace("testSSL");
            }
            else
            {
                cs2 = sdb2.CreateCollectionSpace("testSSL");
            }
            if (true == cs2.IsCollectionExist("testSSL"))
            {
                coll2 = cs2.GetCollection("testSSL");
            }
            else
            {
                coll2 = cs2.CreateCollection("testSSL");
            }

            sdb2.DropCollectionSpace("testSSL");
        }
Exemplo n.º 15
0
        /// <summary>
        /// Uploads the configuration from the file.
        /// </summary>
        public void UploadConfig(string srcFileName, ConfigOptions configOptions)
        {
            if (string.IsNullOrEmpty(srcFileName))
            {
                throw new ArgumentException("srcFileName must not be empty.", "destFileName");
            }
            if (configOptions == null)
            {
                throw new ArgumentNullException("configOptions");
            }

            RestoreConnection();

            if (IsLocal)
            {
                // copy the configuration locally
                if (!client.UnpackConfig(sessionID, srcFileName, configOptions))
                {
                    throw new ScadaException(Localization.UseRussian
                        ? "Не удалось распаковать архив конфигурации."
                        : "Unable to unpack the configuration archive.");
                }
            }
            else
            {
                // transfer the configuration over the network
                using (FileStream outStream =
                           new FileStream(srcFileName, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                    client.UploadConfig(configOptions, sessionID, outStream);
                }
            }

            RegisterActivity();
        }
Exemplo n.º 16
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <TodoItem, TodoItemDTO>()
                .ForMember(todoItemDTO => todoItemDTO.Items,
                           map => map.MapFrom(todoItem => todoItem.Items));
                cfg.CreateMap <TodoItemDTO, TodoItem>()
                .ForMember(todoItem => todoItem.Items,
                           map => map.MapFrom(todoItemDTO => todoItemDTO.Items));

                cfg.CreateMap <Item, ItemDTO>();
                cfg.CreateMap <ItemDTO, Item>();
            });


            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            Database.SetInitializer(new ServiceDBInitializer());
        }
        public EngineManager(Preprocessor preprocessor, ConfigOptions configOptions)
        {
            _configOptions = configOptions;
            Engine         = new Engine();
            Configurator   = new Configurator(Engine, preprocessor);

            // Set no cache if requested
            if (_configOptions.NoCache)
            {
                Engine.Settings[Keys.UseCache] = false;
            }

            // Set folders
            Engine.FileSystem.RootPath = _configOptions.RootPath;
            if (_configOptions.InputPaths?.Count > 0)
            {
                // Clear existing default paths if new ones are set
                // and reverse the inputs so the last one is first to match the semantics of multiple occurrence single options
                Engine.FileSystem.InputPaths.Clear();
                Engine.FileSystem.InputPaths.AddRange(_configOptions.InputPaths.Reverse());
            }
            if (_configOptions.OutputPath != null)
            {
                Engine.FileSystem.OutputPath = _configOptions.OutputPath;
            }
            if (_configOptions.NoClean)
            {
                Engine.Settings[Keys.CleanOutputPath] = false;
            }
            if (_configOptions.Settings != null)
            {
                foreach (KeyValuePair <string, object> item in _configOptions.Settings)
                {
                    Engine.Settings.Add(item);
                }
            }

            // Set NuGet settings
            Configurator.PackageInstaller.UpdatePackages          = _configOptions.UpdatePackages;
            Configurator.PackageInstaller.UseLocalPackagesFolder  = _configOptions.UseLocalPackages;
            Configurator.PackageInstaller.UseGlobalPackageSources = _configOptions.UseGlobalSources;
            Configurator.PackageInstaller.IgnoreDefaultSources    = _configOptions.IgnoreDefaultSources;
            if (_configOptions.PackagesPath != null)
            {
                Configurator.PackageInstaller.PackagesPath = _configOptions.PackagesPath;
            }

            // Metadata
            Configurator.Settings = configOptions.Settings;

            // Script output
            Configurator.OutputScript = _configOptions.OutputScript;

            // Config caching options
            Configurator.NoOutputConfigAssembly = _configOptions.NoOutputConfigAssembly;
            Configurator.IgnoreConfigHash       = _configOptions.IgnoreConfigHash;

            // Application input
            Engine.ApplicationInput = _configOptions.Stdin;
        }
Exemplo n.º 18
0
        static ConfigOptions ParseParameters(string[] args)
        {
            // TODO -- Prevent multiple action commands.
            ConfigOptions config  = new ConfigOptions();
            OptionSet     options = new OptionSet();

            options.Add("?|h|help", value => { PrintUsage(); });
            options.Add("a|add", value => { config.action = PasswordAction.Add; });
            options.Add("d|delete", value => { config.action = PasswordAction.Delete; });
            options.Add("e|export", value => { config.action = PasswordAction.Export; });
            options.Add("f|file=", value => { config.passwordFile = value; });
            options.Add("i|import=", value => { config.action = PasswordAction.Import; config.url = value; });
            options.Add("s|set=", value => { config.action = PasswordAction.Update; config.password = value; });
            options.Add("u|username=", value => { config.userName = value; });

            List <string> nakedParameters = options.Parse(args);

            if (nakedParameters.Count == 1)
            {
                config.url = nakedParameters[0];
            }
            else if (nakedParameters.Count > 1)
            {
                PrintUsage();
            }

            return(config);
        }
        public List <ExtractionResult> ProcessFile(FileInfo fileInfo, ConfigOptions options)
        {
            var ocrResult = _ocrProvider.DoOcr(fileInfo.FullName);
            var extractor = new Extractor(options, ocrResult.Regions.First(), ocrResult.Info);

            return(extractor.GetValues().ToList());
        }
        public void AddLocalStack_Should_Configure_ConfigOptions_By_Session_Section()
        {
            const string localStackHost = "myhost";
            const bool   useSsl         = true;
            const bool   useLegacyPorts = true;
            const int    edgePort       = 1245;

            var configurationValue = new Dictionary <string, string>
            {
                { "LocalStack:Config:LocalStackHost", localStackHost },
                { "LocalStack:Config:UseSsl", useSsl.ToString() },
                { "LocalStack:Config:UseLegacyPorts", useLegacyPorts.ToString() },
                { "LocalStack:Config:EdgePort", edgePort.ToString() }
            };

            IConfiguration configuration     = new ConfigurationBuilder().AddInMemoryCollection(configurationValue).Build();
            var            serviceCollection = new ServiceCollection();

            serviceCollection.AddLocalStack(configuration);

            ServiceProvider provider = serviceCollection.BuildServiceProvider();

            ConfigOptions configOptions = provider.GetRequiredService <IOptions <ConfigOptions> >()?.Value;

            Assert.NotNull(configOptions);
            Assert.Equal(localStackHost, configOptions.LocalStackHost);
            Assert.Equal(useSsl, configOptions.UseSsl);
            Assert.Equal(useLegacyPorts, configOptions.UseLegacyPorts);
            Assert.Equal(edgePort, configOptions.EdgePort);
        }
Exemplo n.º 21
0
        public void Connect_With_Serval_Arg_Test()
        {
            List <string> list = new List <string>();

            list.Add("192.168.20.35:12340");
            list.Add("192.168.20.36:12340");
            list.Add("123:123");
            list.Add("");
            list.Add("192.168.20.40");
            list.Add("192.168.30.161:11810");
            list.Add("localhost:50000");
            list.Add("192.168.20.42:50000");
            list.Add("192.168.20.42:11810");
            list.Add("192.168.20.165:11810");
            list.Add("localhost:12340");
            list.Add("192.168.20.40:12340");

            ConfigOptions options = new ConfigOptions();

            options.MaxAutoConnectRetryTime = 0;
            options.ConnectTimeout          = 100;
            // connect
            Sequoiadb sdb1 = new Sequoiadb(list);

            sdb1.Connect("", "", options);
            // set option and change the connect
            options.ConnectTimeout = 2000;
            sdb1.ChangeConnectionOptions(options);
            // check
            DBCursor cursor = sdb1.GetList(4, null, null, null);

            Assert.IsTrue(cursor != null);
            sdb1.Disconnect();
        }
Exemplo n.º 22
0
        public ConsulDiscovery(ConfigOptions configOptions, ILogger logger)
        {
            _config = new Config(configOptions);
            _logger = logger;

            (_startRetryDelay, _maxRetryDelay) = Common.GetRetryDelays(_config);

            //getting source address
            string sourceAddress = _config.Get <string>("kumuluzee.discovery.consul.hosts");

            if (string.IsNullOrWhiteSpace(sourceAddress))
            {
                sourceAddress = ADDRESS;
            }

            //creating consul client
            try
            {
                _client = new ConsulClient(c =>
                {
                    c.Address = new Uri(sourceAddress);
                });
            }
            catch
            {
                _client = null;
            }

            if (_client == null)
            {
                _logger.LogError("Thare was problem creating consul client.");
            }
        }
Exemplo n.º 23
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            var options = new ConfigOptions();

            options.LoginProviders.Remove(typeof(AzureActiveDirectoryLoginProvider));
            options.LoginProviders.Add(typeof(AzureActiveDirectoryExtendedLoginProvider));
            options.LoginProviders.Add(typeof(FBLoginProvider));
            options.LoginProviders.Add(typeof(VKLoginProvider));
            // Use this class to set WebAPI configuration options
            var config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            config.Formatters.JsonFormatter.SerializerSettings.DefaultValueHandling       = DefaultValueHandling.Include;
            config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling          = NullValueHandling.Include;
            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling      = ReferenceLoopHandling.Serialize;
            config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling =
                PreserveReferencesHandling.Objects;
            config.MessageHandlers.Add(new ThrottlingHandler
            {
                Policy = new ThrottlePolicy(5)
                {
                    IpThrottling = true
                },
                Repository = new CacheRepository()
            });
            Mapper.Initialize(cfg => { DTOMapper.CreateMapping(cfg); });

            //var migrator = new DbMigrator(new Configuration());
            // migrator.Update();
            //  Database.SetInitializer(new appartmenthostInitializer());
        }
Exemplo n.º 24
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            options.LoginProviders.Remove(typeof(AzureActiveDirectoryLoginProvider));
            options.LoginProviders.Add(typeof(CustomLoginProvider));
            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            config.SetIsHosted(true);

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            //
            Database.SetInitializer(new dhcchardwareInitializer());

            //Lets never touch this again..
            //AutoMapper.Mapper.Initialize(cfg =>
            //{
            //    cfg.CreateMap<LoanItem, LoanItemDTO>()
            //        .ForMember(loanItemDTO => loanItemDTO.Item, map => map.MapFrom(loanItem => loanItem.Item));
            //    cfg.CreateMap<LoanItemDTO, LoanItem>()
            //        .ForMember(loanItem => loanItem.Item, map => map.MapFrom(loanItemDTO => loanItemDTO.Item));

            //    cfg.CreateMap<HardwareItem, HardwareItemDTO>();
            //    cfg.CreateMap<HardwareItemDTO, HardwareItem>();
            //});
        }
Exemplo n.º 25
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();
            //options.LoginProviders.Remove(typeof(GoogleLoginAuthenticationProvider));
            //options.LoginProviders.Add(typeof(GoogleLoginAuthenticationProvider));

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            bool isDemoMode;
            var  boolString = System.Configuration.ConfigurationManager.AppSettings["IsDemoMode"];

            if (bool.TryParse(boolString, out isDemoMode))
            {
                IsDemoMode = isDemoMode;
            }

            int maxCount;
            var intString = System.Configuration.ConfigurationManager.AppSettings["MaxLeagueMembershipCount"];

            if (int.TryParse(intString, out maxCount))
            {
                MaxLeagueMembershipCount = maxCount;
            }

            //config.SetIsHosted(true);
            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            //var migrator = new DbMigrator(new Configuration());
            //migrator.Update();
        }
Exemplo n.º 26
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            //Database.SetInitializer(new MobileServiceInitializer());

            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap<MobileCalibrationRecord, CalibrationRecord>();
                cfg.CreateMap<MobileFlowswitch, Flowswitch>();
                cfg.CreateMap<CalibrationRecord, MobileCalibrationRecord>()
                    .ForMember(dst => dst.MobileFlowswitchId, map => map.MapFrom(x => x.Flowswitch.ID))
                    .ForMember(dst => dst.MobileFlowswitchName, map => map.MapFrom(x => x.Flowswitch.Name));
                cfg.CreateMap<Flowswitch, MobileFlowswitch>();

            });
        }
Exemplo n.º 27
0
        public static ArrayCreationTypeStyle GetArrayCreationTypeStyle(this SyntaxNodeAnalysisContext context)
        {
            AnalyzerConfigOptions configOptions = context.GetConfigOptions();

            if (ConfigOptions.TryGetValue(configOptions, ConfigOptions.ArrayCreationTypeStyle, out string rawValue))
            {
                if (string.Equals(rawValue, ConfigOptionValues.ArrayCreationTypeStyle_Implicit, StringComparison.OrdinalIgnoreCase))
                {
                    return(ArrayCreationTypeStyle.Implicit);
                }
                else if (string.Equals(rawValue, ConfigOptionValues.ArrayCreationTypeStyle_Explicit, StringComparison.OrdinalIgnoreCase))
                {
                    return(ArrayCreationTypeStyle.Explicit);
                }
                else if (string.Equals(rawValue, ConfigOptionValues.ArrayCreationTypeStyle_ImplicitWhenTypeIsObvious, StringComparison.OrdinalIgnoreCase))
                {
                    return(ArrayCreationTypeStyle.ImplicitWhenTypeIsObvious);
                }
            }

            if (context.IsEnabled(LegacyConfigOptions.UseImplicitlyTypedArrayWhenTypeIsObvious))
            {
                return(ArrayCreationTypeStyle.ImplicitWhenTypeIsObvious);
            }

            if (context.IsEnabled(LegacyConfigOptions.UseImplicitlyTypedArray))
            {
                return(ArrayCreationTypeStyle.Implicit);
            }

            return(ArrayCreationTypeStyle.None);
        }
Exemplo n.º 28
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options, (configuration, builder) =>
            {
                jiujitsutoolbox_apiContext context = new jiujitsutoolbox_apiContext();
                builder.RegisterInstance(context).As <jiujitsutoolbox_apiContext>().SingleInstance();
            }));

            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

            var matches = config.Formatters
                          .Where(f => f.SupportedMediaTypes
                                 .Where(m => m.MediaType.ToString() == "application/xml" || m.MediaType.ToString() == "text/xml").Count() > 0)
                          .ToList();

            foreach (var match in matches)
            {
                config.Formatters.Remove(match);
            }

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            var migrator = new DbMigrator(new Configuration());

            migrator.Update();
        }
Exemplo n.º 29
0
 public ChannelConfig(uint clockRate, byte latencyTimer, ConfigOptions options, UInt32 pins)
 {
     this.ClockRate    = clockRate;
     this.LatencyTimer = latencyTimer;
     this.Options      = options;
     this.Pins         = pins;
 }
Exemplo n.º 30
0
        public static ConditionalExpressionParenthesesStyle GetConditionalExpressionParenthesesStyle(this SyntaxNodeAnalysisContext context)
        {
            AnalyzerConfigOptions configOptions = context.GetConfigOptions();

            if (ConfigOptions.TryGetValue(configOptions, ConfigOptions.ConditionalOperatorConditionParenthesesStyle, out string rawValue))
            {
                if (string.Equals(rawValue, ConfigOptionValues.ConditionalOperatorConditionParenthesesStyle_Include, StringComparison.OrdinalIgnoreCase))
                {
                    return(ConditionalExpressionParenthesesStyle.Include);
                }
                else if (string.Equals(rawValue, ConfigOptionValues.ConditionalOperatorConditionParenthesesStyle_Omit, StringComparison.OrdinalIgnoreCase))
                {
                    return(ConditionalExpressionParenthesesStyle.Omit);
                }
                else if (string.Equals(rawValue, ConfigOptionValues.ConditionalOperatorConditionParenthesesStyle_OmitWhenConditionIsSingleToken, StringComparison.OrdinalIgnoreCase))
                {
                    return(ConditionalExpressionParenthesesStyle.OmitWhenConditionIsSingleToken);
                }
            }

            if (configOptions.IsEnabled(LegacyConfigOptions.RemoveParenthesesFromConditionOfConditionalExpressionWhenExpressionIsSingleToken))
            {
                return(ConditionalExpressionParenthesesStyle.OmitWhenConditionIsSingleToken);
            }

            return(ConditionalExpressionParenthesesStyle.None);
        }
Exemplo n.º 31
0
        /// <summary>
        /// Упаковать конфигурацию в архив
        /// </summary>
        public bool PackConfig(string destFileName, ConfigOptions configOptions)
        {
            try
            {
                List <RelPath> configPaths     = GetConfigPaths(configOptions.ConfigParts);
                PathDict       ignoredPathDict = PrepareIgnoredPaths(configOptions.IgnoredPaths);

                using (FileStream fileStream =
                           new FileStream(destFileName, FileMode.Create, FileAccess.Write, FileShare.Read))
                {
                    using (ZipArchive zipArchive = new ZipArchive(fileStream, ZipArchiveMode.Create))
                    {
                        foreach (RelPath relPath in configPaths)
                        {
                            PackDir(zipArchive, relPath, ignoredPathDict);
                        }

                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                log.WriteException(ex, Localization.UseRussian ?
                                   "Ошибка при упаковке конфигурации в архив" :
                                   "Error packing configuration into archive");
                return(false);
            }
        }
Exemplo n.º 32
0
        public static void ListIt(Vtero vtero, ConfigOptions co)
        {
            var Version = vtero.Version;

            Mem.InitMem(co.FileName, vtero.MRD);


        }
Exemplo n.º 33
0
		/// <summary>
		/// Generates the specified options.
		/// </summary>
		/// <param name="configOptions">The options.</param>
		/// <param name="types">The types.</param>
		public virtual void Generate(ConfigOptions configOptions, IEnumerable<Type> types)
		{
			Options = configOptions;

			_filename = (ProjectName + ".h").ToLower();
			_defineFilename = _filename.Replace('.', '_').ToUpper();

			using (_writer = new SourceWriter(Path.Combine(Path.GetFullPath(Options.CppOutputDir), _filename))) {
				IEnumerable<Type> functionTypes = types.Where(t => t.HasAttribute<CppFunctionAttribute>());

				IEnumerable<Type> wrapperTypes = types.Where(t => t.HasAttribute<CppClassAttribute>(true));

				IEnumerable<Type> enumerations = types.Where(t => t.IsEnum);

				IEnumerable<Type> valueObjects =
					types.Where(t => t.HasAttribute<CppValueObjectAttribute>() && t.IsValueType && !t.IsEnum);

				IEnumerable<Type> functionProviders =
					types.Where(
						t =>
						t.HasAttribute<CppTypeAttribute>() && !t.HasAttribute<CppClassAttribute>(true) &&
						t.IsInterface);

				IEnumerable<Type> converters = types.Where(t => t.HasAttribute<HandleConverterAttribute>());

				WriteHeader();

				_writer.WriteLine("extern \"C\"");
				_writer.WriteLine("{");
				_writer.Indent();

				WriteEnumerations(enumerations);

				WritePrototypes(valueObjects);
				//WriteWrapperDescriptorPrototypes(wrapperTypes);
				WriteFunctionHandlers(functionTypes);

				WriteTypeDefinitions(valueObjects);
				//WriteWrapperDescriptorDefinitions(wrapperTypes);

				_writer.WriteLine();

				WriteFunctionProviders(functionProviders);
				WriteWrappersMethods(wrapperTypes.OrderBy(x => x.Name));

				_writer.Deindent();
				_writer.WriteLine("}");
				_writer.WriteLine();

				WriteInlineConvertersAndConverters(converters.Union(wrapperTypes).Distinct(), wrapperTypes);
				WriteFooter();

				_writer.Close();
			}
		}
Exemplo n.º 34
0
        public static void Register()
        {

            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));
            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize;
            config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
        }
Exemplo n.º 35
0
		public static void Register()
		{
			// Use this class to set configuration options for your mobile service
			ConfigOptions options = new ConfigOptions();

			// Use this class to set WebAPI configuration options
			HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

			// To display errors in the browser during development, uncomment the following
			// line. Comment it out again when you deploy your service for production use.
			// config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
		}
Exemplo n.º 36
0
		public static void Register()
		{
			ConfigOptions options = new ConfigOptions();
			HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

			// To display errors in the browser during development, uncomment the following
			// line. Comment it out again when you deploy your service for production use.
			//config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

			// ***
			// *** Add SignalR
			// ***
			SignalRExtensionConfig.Initialize();
		}
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            var constring = ConfigurationManager.AppSettings["AzureTable"];

            new ApiServices(config).Settings.Connections.Add("AzureTable", new ConnectionSettings("AzureTable", constring));
        }
Exemplo n.º 38
0
        public static void Register()
        {
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; // TODO: remove this for prod

            // this sets up configuration of your database, including your namespace and automatic migration settings
            DbMigrator migrator = new DbMigrator(new Configuration());
            migrator.Update();
        }
Exemplo n.º 39
0
        public static void Register()
        {
            AppServiceExtensionConfig.Initialize();

            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // always send JSON values, even if they have the default value for that type
            config.Formatters.JsonFormatter.SerializerSettings.DefaultValueHandling = Newtonsoft.Json.DefaultValueHandling.Include;

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
        }
Exemplo n.º 40
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            var options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            //Database.SetInitializer(new DataInitializer());
            var configuration = new Configuration();
            var migrator = new DbMigrator(configuration);
            migrator.Update();
        }
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // Insert the ResourcesController route at the top to avoid conflicting with predefined routes.
            var resourcesRoute = config.Routes.CreateRoute(
                routeTemplate: "api/resources/{type}",
                defaults: new { controller = "resources" },
                constraints: null);

            config.Routes.Insert(0, "Resources", resourcesRoute);

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
        }
Exemplo n.º 42
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Enable server side login flow for AAD
            options.LoginProviders.Remove(typeof(AzureActiveDirectoryLoginProvider));
            options.LoginProviders.Add(typeof(AzureActiveDirectoryExtendedLoginProvider));

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            Mapper.Initialize(cfg =>
            {
                AutomapperConfiguration.CreateMapping(cfg);
            });
        }
Exemplo n.º 43
0
 public static void Register()
 {
     var options = new ConfigOptions();
     var configBuilder = new ConfigBuilder(options,
         (configuration, builder) =>
         {
             builder.RegisterType<DebugLogger>().As<ILogger>();
             builder.RegisterType<Mapper>().As<IMapper>();
             builder.RegisterType<BankContext>().As<IContext>();
             builder.RegisterType<EntityStubFactory>().As<IEntityStubFactory>();
             builder.RegisterType<RepositoryFactory>().As<IRepositoryFactory>();
             builder.RegisterType<UnitOfWork>().As<IUnitOfWork>();
             builder.RegisterType<ExpressionBuilder>().As<IExpressionBuilder>();
             builder.RegisterType<CurrencyService>().As<ICurrencyService>();
             builder.RegisterType<CurrencyRateFactory>().As<ICurrencyRateFactory>();
             builder.RegisterType<CurrencyRateService>().As<ICurrencyRateService>();
             builder.RegisterType<ExchangeService>().As<IExchangeService>();
         });
     HttpConfiguration config = ServiceConfig.Initialize(configBuilder);
     AutoMapper.Mapper.Initialize(InitializeConfiguration);
 }
Exemplo n.º 44
0
		/// <summary>
		/// Generates the specified options.
		/// </summary>
		/// <param name="configOptions">The options.</param>
		/// <param name="types">The types.</param>
		public override void Generate(ConfigOptions configOptions, IEnumerable<Type> types)
		{
			Options = configOptions;

			var headerFilename = (ProjectName + ".h").ToLower();
			var filename = (ProjectName + ".cpp").ToLower();
			var wrapperTypes = types.Where(t => t.HasAttribute<CppClassAttribute>(true));

			using (Writer = new SourceWriter(Path.Combine(Path.GetFullPath(Options.CppOutputDir), filename))) {
				var definitions =
					(from type in types
					 let attribute = type.GetAttribute<CppTypeAttribute>(true)
					 where attribute != null
					 select new {
						 attribute.DefinitionFile,
						 attribute.LocalDefinition
					 }).Distinct();

				Writer.WriteLine("#include \"{0}\"", headerFilename);

				foreach (var definition in definitions) {
					if (string.IsNullOrEmpty(definition.DefinitionFile))
						continue;

					if (definition.LocalDefinition)
						Writer.WriteLine("#include \"{0}\"", definition.DefinitionFile);
					else
						Writer.WriteLine("#include <{0}>", definition.DefinitionFile);
				}

				Writer.WriteLine();
				Writer.WriteLine("using namespace invision;");
				Writer.WriteLine();

				WriteImplementations(wrapperTypes);

				Writer.WriteLine();
				Writer.Close();
			}
		}
Exemplo n.º 45
0
        public static void Register()
        {
            var options = new ConfigOptions();
            var configBuilder = new ConfigBuilder(options,
                (configuration, builder) =>
                {
                    // todo: initialize container here
                    builder.RegisterInstance(new AuthOwinAppBuilder(configuration)).As<IOwinAppBuilder>();
                    builder.RegisterType<ClientIdentityStore>().As<IClientIdentityStore>();
                    builder.RegisterType<ClientIdentityManager>();
                    builder.RegisterType<BankContext>().As<IContext>();
                    builder.RegisterType<EntityStubFactory>().As<IEntityStubFactory>();
                    builder.RegisterType<RepositoryFactory>().As<IRepositoryFactory>();
                    builder.RegisterType<UnitOfWork>().As<IUnitOfWork>();
                    builder.RegisterType<MobileServiceLogger>().As<ILogger>();
                    builder.RegisterType<Mapper>().As<IMapper>();
                    builder.RegisterType<ExpressionBuilder>().As<IExpressionBuilder>();
                    builder.RegisterType<TransactionService>().As<ITransactionService>();
                    builder.RegisterType<AccountService>().As<IAccountService>();
                    builder.RegisterType<CurrencyService>().As<ICurrencyService>();
                    builder.RegisterType<AccountTypeService>().As<IAccountTypeService>();
                    builder.RegisterType<ClientService>().As<IClientService>();
                    builder.RegisterType<CurrencyRateFactory>().As<ICurrencyRateFactory>();
                    builder.RegisterType<CurrencyRateService>().As<ICurrencyRateService>();
                    builder.RegisterType<ExchangeService>().As<IExchangeService>();
                    builder.RegisterType<ClientAuthorizationService>().As<IClientAuthorizationService>();
                    builder.RegisterType<AuthorizationAttemptService>().As<IAuthorizationAttemptService>();
                    builder.RegisterType<AuthorizationCardService>().As<IAuthorizationCardService>();
                    builder.RegisterType<ClientAuthenticationCodeValidator>().As<IClientAuthenticationCodeValidator>();
                    builder.RegisterType<ClientCreditCardService>().As<IClientCreditCardService>();
                });

            HttpConfiguration config = ServiceConfig.Initialize(configBuilder);
            config.EnableCors();
            AutoMapper.Mapper.Initialize(InitializeConfiguration);
        }
Exemplo n.º 46
0
 public static ShowcaseView InsertShowcaseView(ITarget target, Activity activity, String title, String detail, ConfigOptions options)
 {
     return InsertShowcaseViewInternal(target, activity, title, detail, options);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CppValueObjectGenerator"/> class.
 /// </summary>
 /// <param name="configOptions">The options.</param>
 /// <param name="type">The type.</param>
 protected CppValueObjectGeneratorBase(ConfigOptions configOptions, Type type)
 {
     _configOptions = configOptions;
     _type = type;
 }
Exemplo n.º 48
0
 public static ShowcaseView InsertShowcaseViewWithType(int type, int itemId, Activity activity, int title, int detailText, ConfigOptions options)
 {
     ShowcaseView sv = new ShowcaseView(activity);
     if (options != null)
     {
         sv.ConfigurationOptions = options;
     }
     if (sv.ConfigurationOptions.Insert == INSERTTODECOR)
     {
         ((ViewGroup)activity.Window.DecorView).AddView(sv);
     }
     else
     {
         ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(sv);
     }
     sv.SetShowcaseItem(type, itemId, activity);
     sv.SetText(title, detailText);
     return sv;
 }
Exemplo n.º 49
0
 public static ShowcaseView InsertShowcaseView(ITarget target, Activity activity, int title, int detail, ConfigOptions options)
 {
     return InsertShowcaseViewInternal(target, activity, activity.GetString(title), activity.GetString(detail), options);
 }
Exemplo n.º 50
0
        public ShowcaseView(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            // Get the attributes for the ShowcaseView
            var styled = context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.ShowcaseView, Resource.Attribute.showcaseViewStyle, Resource.Style.ShowcaseView);
            mBackgroundColor = styled.GetColor(Resource.Styleable.ShowcaseView_sv_backgroundColor, Color.Argb(128, 80, 80, 80));
            var showcaseColor = styled.GetColor(Resource.Styleable.ShowcaseView_sv_showcaseColor, Color.ParseColor("#33B5E5"));

            int titleTextAppearance = styled.GetResourceId(Resource.Styleable.ShowcaseView_sv_titleTextAppearance, Resource.Style.TextAppearance_ShowcaseView_Title);
            int detailTextAppearance = styled.GetResourceId(Resource.Styleable.ShowcaseView_sv_detailTextAppearance, Resource.Style.TextAppearance_ShowcaseView_Detail);

            buttonText = styled.GetString(Resource.Styleable.ShowcaseView_sv_buttonText);
            styled.Recycle();

            metricScale = Context.Resources.DisplayMetrics.Density;
            mEndButton = (Button)LayoutInflater.From(context).Inflate(Resource.Layout.showcase_button, null);

            mShowcaseDrawer = new ClingDrawer(Resources, showcaseColor);

            // TODO: This isn't ideal, ClingDrawer and Calculator interfaces should be separate
            mTextDrawer = new TextDrawer(metricScale, mShowcaseDrawer);
            mTextDrawer.SetTitleStyling(context, titleTextAppearance);
            mTextDrawer.SetDetailStyling(context, detailTextAppearance);

            var options = new ConfigOptions();
            options.ShowcaseId = Id;

            ConfigurationOptions = options;

            Init();
        }
        public static void Register()
        {
            AppServiceExtensionConfig.Initialize();

            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // enforce user authentication even when debugging locally
            config.SetIsHosted(true);

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            config.Formatters.JsonFormatter.SerializerSettings.DefaultValueHandling = Newtonsoft.Json.DefaultValueHandling.Include;
            config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Include;

            AutoMapperEntityMapper.InitializeDynamicsCrmCommonMaps();

            Mapper.CreateMap<Contact, ContactDto>()
                .ReverseMap();

            Mapper.CreateMap<Incident, IncidentDto>()
                .ForMember(a => a.Complete, opt => opt.MapFrom(t => (t.StatusCode.Value == 1)) )
                .ForMember(a => a.Text, opt => opt.MapFrom(t => t.Title))
                .ReverseMap()
                .ForMember(t => t.ActivitiesComplete, opt => opt.MapFrom(a => a.Complete))
                .ForMember(t => t.Title, opt => opt.MapFrom(a => a.Text));

            Mapper.CreateMap<Task, ActivityDto>()
                .ForMember(a => a.Details, opt => opt.MapFrom(t => t.Description))
                .ForMember(a => a.ActivityTypeCode, opt => opt.MapFrom(t => t.ActivityTypeCode))
                .ReverseMap()
                .ForMember(t => t.Description, opt => opt.MapFrom(a => a.Details))
                .ForMember(t => t.ActivityTypeCode, opt => opt.MapFrom(a => a.ActivityTypeCode))
                .AfterMap((a, t) =>
                {
                    if(t.RegardingObjectId != null)
                    {
                        t.RegardingObjectId.LogicalName = Contact.EntityLogicalName;
                    }
                });

            Mapper.CreateMap<PhoneCall, ActivityDto>()
                .ForMember(a => a.Details, opt => opt.MapFrom(p => p.Description))
                .ForMember(a => a.ActivityTypeCode, opt => opt.MapFrom(p => p.ActivityTypeCode))
                .ReverseMap()
                .ForMember(p => p.Description, opt => opt.MapFrom(a => a.Details))
                .ForMember(p => p.ActivityTypeCode, opt => opt.MapFrom(a => a.ActivityTypeCode))
                .AfterMap((a, p) =>
                {
                    if (p.RegardingObjectId != null)
                    {
                        p.RegardingObjectId.LogicalName = Contact.EntityLogicalName;
                    }
                });

            Mapper.CreateMap<Appointment, ActivityDto>()
                .ForMember(a => a.Details, opt => opt.MapFrom(ap => ap.Description))
                .ForMember(a => a.ActivityTypeCode, opt => opt.MapFrom(ap => ap.ActivityTypeCode))
                .ReverseMap()
                .ForMember(ap => ap.Description, opt => opt.MapFrom(a => a.Details))
                .ForMember(ap => ap.ActivityTypeCode, opt => opt.MapFrom(a => a.ActivityTypeCode))
                .AfterMap((a, ap) =>
                {
                    if (ap.RegardingObjectId != null)
                    {
                        ap.RegardingObjectId.LogicalName = Contact.EntityLogicalName;
                    }
                });
        }
Exemplo n.º 52
0
        public void Connect_With_Serval_Arg_Test()
        {
		    List<string> list = new List<string>();
            
            list.Add("192.168.20.35:12340");
            list.Add("192.168.20.36:12340");
            list.Add("123:123");
            list.Add("");
            list.Add("192.168.20.40");
            list.Add("192.168.30.161:11810");
            list.Add("localhost:50000");
            list.Add("192.168.20.42:11810");
            list.Add("192.168.20.165:11810");
            list.Add("localhost:12340");
            list.Add("192.168.20.40:12340");

	        ConfigOptions options = new ConfigOptions();
	        options.MaxAutoConnectRetryTime = 0;
	        options.ConnectTimeout = 100;
	        // connect
	        Sequoiadb sdb1 = new Sequoiadb(list);
            sdb1.Connect("", "", options);
	        // set option and change the connect
	        options.ConnectTimeout = 2000;
	        sdb1.ChangeConnectionOptions(options);
	        // check
	        DBCursor cursor = sdb1.GetList(4, null, null, null);
	        Assert.IsTrue(cursor != null);
	        sdb1.Disconnect();
        }
Exemplo n.º 53
0
        // Internal insert method so all inserts are routed through one method
        static ShowcaseView InsertShowcaseViewInternal(ITarget target, Activity activity, String title, String detail, ConfigOptions options)
        {
            var sv = new ShowcaseView(activity);
            sv.ConfigurationOptions = options;

            if (sv.ConfigurationOptions.Insert == INSERTTODECOR)
            {
                ((ViewGroup)activity.Window.DecorView).AddView(sv);
            }
            else
            {
                ((ViewGroup)activity.FindViewById(Android.Resource.Id.Content)).AddView(sv);
            }

            sv.SetShowcase(target);
            sv.SetText(title, detail);

            return sv;
        }
Exemplo n.º 54
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();
            options.LoginProviders.Add(typeof(LinkedInLoginProvider));

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));
            //config.SetIsHosted(true);

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            //config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            //config.Properties["MS_IsHosted"] = true;

            //Database.SetInitializer<MobileServiceContext>(new MobileServiceInitializer());

            //Deployment
            Database.SetInitializer<MobileServiceContext>(null);

            //var migrator = new DbMigrator(new Configuration());
            //migrator.Update();
        }
Exemplo n.º 55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CppValueObjectGenerator"/> class.
 /// </summary>
 /// <param name="configOptions">The options.</param>
 /// <param name="type">The type.</param>
 public CppValueObjectGenerator(ConfigOptions configOptions, Type type)
     : base(configOptions, type)
 {
 }
Exemplo n.º 56
0
		/// <summary>
		/// Initializes a new instance of the <see cref="CSharpBindingGenerator"/> class.
		/// </summary>
		/// <param name="configOptions">The config options.</param>
		public CSharpBindingGenerator(ConfigOptions configOptions)
			: base(configOptions)
		{
		}
Exemplo n.º 57
0
 public static void Register()
 {
     ConfigOptions options = new ConfigOptions();
     HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CppWraperDescriptorGenerator"/> class.
 /// </summary>
 /// <param name="configOptions">The options.</param>
 /// <param name="type">The type.</param>
 public CppWraperDescriptorGenerator(ConfigOptions configOptions, Type type)
     : base(configOptions, type)
 {
 }
        public static void Register()
        {
            ConfigOptions options = new ConfigOptions
            {
                PushAuthorization = AuthorizationLevel.Application,
                DiagnosticsAuthorization = AuthorizationLevel.Anonymous,
            };

            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // Now add any missing connection strings and app settings from the environment.
            // Any envrionment variables found with names that match existing connection
            // string and app setting names will be used to replace the value.
            // This allows the Web.config (which typically would contain secrets) to be
            // checked in, but requires people running the tests to config their environment.
            IServiceSettingsProvider settingsProvider = config.DependencyResolver.GetServiceSettingsProvider();
            ServiceSettingsDictionary settings = settingsProvider.GetServiceSettings();
            IDictionary environmentVariables = Environment.GetEnvironmentVariables();
            foreach (var conKey in settings.Connections.Keys.ToArray())
            {
                var envKey = environmentVariables.Keys.OfType<string>().FirstOrDefault(p => p == conKey);
                if (!string.IsNullOrEmpty(envKey))
                {
                    settings.Connections[conKey].ConnectionString = (string)environmentVariables[envKey];
                }
            }

            foreach (var setKey in settings.Keys.ToArray())
            {
                var envKey = environmentVariables.Keys.OfType<string>().FirstOrDefault(p => p == setKey);
                if (!string.IsNullOrEmpty(envKey))
                {
                    settings[setKey] = (string)environmentVariables[envKey];
                }
            }

            // Emulate the auth behavior of the server: default is application unless explicitly set.
            config.Properties["MS_IsHosted"] = true;

            config.Formatters.JsonFormatter.SerializerSettings.DateFormatHandling = DateFormatHandling.IsoDateFormat;

            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap<RoundTripTableItem, RoundTripTableItemFakeStringId>()
                    // While we would like to use ResolveUsing here, for ComplexType1 and 2, 
                    // we cannot because it is incompatable with LINQ queries, which is the
                    // whole point of doing this mapping. Instead use AfterMap below.
                    .ForMember(dst => dst.ComplexType1, map => map.Ignore())
                    .ForMember(dst => dst.ComplexType2, map => map.Ignore())
                    .ForMember(dst => dst.IntId, map => map.MapFrom(src => src.RoundTripTableItemId))
                    .ForMember(dst => dst.Id, map => map.MapFrom(src => SqlFuncs.StringConvert(src.RoundTripTableItemId).Trim()))
                    .AfterMap((src, dst) =>
                    {
                        dst.ComplexType1 = src.ComplexType1Serialized == null ? null : JsonConvert.DeserializeObject<ComplexType[]>(src.ComplexType1Serialized);
                        dst.ComplexType2 = src.ComplexType2Serialized == null ? null : JsonConvert.DeserializeObject<ComplexType2>(src.ComplexType2Serialized);
                    });
                cfg.CreateMap<RoundTripTableItemFakeStringId, RoundTripTableItem>()
                    .ForMember(dst => dst.ComplexType1Serialized, map => map.ResolveUsing(src => (src.ComplexType1 == null ? null : JsonConvert.SerializeObject(src.ComplexType1))))
                    .ForMember(dst => dst.ComplexType2Serialized, map => map.ResolveUsing(src => (src.ComplexType2 == null ? null : JsonConvert.SerializeObject(src.ComplexType2))))
                    .ForMember(dst => dst.RoundTripTableItemId, map => map.MapFrom(src => src.Id));


                cfg.CreateMap<StringIdRoundTripTableItemForDB, StringIdRoundTripTableItem>()
                    .ForMember(dst => dst.Complex, map => map.Ignore())
                    .ForMember(dst => dst.ComplexType, map => map.Ignore())
                    .AfterMap((src, dst) =>
                    {
                        dst.Complex = src.ComplexSerialized == null ? null : JsonConvert.DeserializeObject<string[]>(src.ComplexSerialized);
                        dst.ComplexType = src.ComplexTypeSerialized == null ? null : JsonConvert.DeserializeObject<string[]>(src.ComplexTypeSerialized);
                    });
                cfg.CreateMap<StringIdRoundTripTableItem, StringIdRoundTripTableItemForDB>()
                    .ForMember(dst => dst.ComplexSerialized, map => map.ResolveUsing(src => (src.Complex == null ? null : JsonConvert.SerializeObject(src.Complex))))
                    .ForMember(dst => dst.ComplexTypeSerialized, map => map.ResolveUsing(src => (src.ComplexType == null ? null : JsonConvert.SerializeObject(src.ComplexType))));

                cfg.CreateMap<W8JSRoundTripTableItemForDB, W8JSRoundTripTableItem>()
                    .ForMember(dst => dst.ComplexType, map => map.Ignore())
                    .ForMember(dst => dst.Id, map => map.MapFrom(src => src.W8JSRoundTripTableItemForDBId))
                    .AfterMap((src, dst) =>
                    {
                        dst.ComplexType = src.ComplexTypeSerialized == null ? null : JsonConvert.DeserializeObject<string[]>(src.ComplexTypeSerialized);
                    });
                cfg.CreateMap<W8JSRoundTripTableItem, W8JSRoundTripTableItemForDB>()
                    .ForMember(dst => dst.ComplexTypeSerialized, map => map.ResolveUsing(src => (src.ComplexType == null ? null : JsonConvert.SerializeObject(src.ComplexType))))
                    .ForMember(dst => dst.W8JSRoundTripTableItemForDBId, map => map.MapFrom(src => src.Id));
            });

            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<SDKClientTestContext>());
        }
        public static void Register()
        {
            AppServiceExtensionConfig.Initialize();

            // Use this class to set configuration options for your mobile service
            ConfigOptions options = new ConfigOptions();

            // Use this class to set WebAPI configuration options
            HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // enforce user authentication even when debugging locally
            config.SetIsHosted(true);
            ServiceAuthenticationFilter authFilter = null;
            AuthorizeLevelAttribute authzAttr = null;
            foreach (FilterInfo filter in config.Filters)
            {
                if (filter.Instance is ServiceAuthenticationFilter)
                {
                    authFilter = (ServiceAuthenticationFilter)filter.Instance;
                }
                if (filter.Instance is AuthorizeLevelAttribute)
                {
                    authzAttr = (AuthorizeLevelAttribute)filter.Instance;
                }
            }
            if (authFilter != null)
            {
                config.Filters.Remove(authFilter);
                config.Filters.Remove(authzAttr);
            }

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            AutoMapperEntityMapper.InitializeDynamicsCrmCommonMaps();

            Mapper.CreateMap<Contact, ContactDto>()
                .ReverseMap();

            Mapper.CreateMap<Incident, IncidentDto>()
                .ForMember(a => a.Complete, opt => opt.MapFrom(t => (t.StateCode.Value == 1)) )
                .ForMember(a => a.Text, opt => opt.MapFrom(t => t.Title))
                .ReverseMap()
                .ForMember(t => t.StateCode, opt => opt.MapFrom(a => new OptionSetValue(a.Complete ? 1:0)))                
                .ForMember(t => t.Title, opt => opt.MapFrom(a => a.Text))
                .AfterMap((a, t) =>
                {
                    if (a.Complete == true)
                    {
                        t.StateCode = new OptionSetValue(1);
                        t.StatusCode = new OptionSetValue(5);
                    }
                    else
                    {
                        t.StateCode = new OptionSetValue(0);
                        t.StatusCode = new OptionSetValue(1);
                    }
                });

            Mapper.CreateMap<Task, ActivityDto>()
                .ForMember(a => a.Details, opt => opt.MapFrom(t => t.Description))
                .ReverseMap()
                .ForMember(t => t.Description, opt => opt.MapFrom(a => a.Details))
                .AfterMap((a, t) =>
                {
                    if (t.RegardingObjectId != null)
                    {
                        t.RegardingObjectId.LogicalName = Contact.EntityLogicalName;
                    }
                });

            Mapper.CreateMap<PhoneCall, ActivityDto>()
                .ForMember(a => a.Details, opt => opt.MapFrom(p => p.Description))
                .ReverseMap()
                .ForMember(p => p.Description, opt => opt.MapFrom(a => a.Details))
                .AfterMap((a, p) =>
                {
                    if (p.RegardingObjectId != null)
                    {
                        p.RegardingObjectId.LogicalName = Contact.EntityLogicalName;
                    }
                });

            Mapper.CreateMap<Appointment, ActivityDto>()
                .ForMember(a => a.Details, opt => opt.MapFrom(ap => ap.Description))
                .ReverseMap()
                .ForMember(ap => ap.Description, opt => opt.MapFrom(a => a.Details))
                .AfterMap((a, ap) =>
                {
                    if (ap.RegardingObjectId != null)
                    {
                        ap.RegardingObjectId.LogicalName = Contact.EntityLogicalName;
                    }
                });
        }