Esempio n. 1
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // create a new window instance based on the screen size
            //Window = new UIWindow(UIScreen.MainScreen.Bounds);

            // If you have defined a root view controller, set it here:
            // Window.RootViewController = myViewController;

            Forms.Init();

            SfListViewRenderer.Init();
            new SfBusyIndicatorRenderer();
            SfScheduleRenderer.Init();
            Xamarin.FormsMaps.Init();
            ImageCircleRenderer.Init();

            BootstrapperService.Initialize(new IociOSModule()).GetAwaiter();

            LoadApplication(new App());

            // make the window visible
            //Window.MakeKeyAndVisible();

            return(base.FinishedLaunching(application, launchOptions));
        }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            BootstrapperService         bootstrapper = new BootstrapperService();
            Dictionary <string, string> settings     = bootstrapper.GetSettingsDictionary();
            var serviceProvider = bootstrapper.ServiceProvider;

            Log.Information(string.Format(LogMessages.ConsumerStartedMessage, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
            try
            {
                IMessageConsumer consumer = (IMessageConsumer)serviceProvider.GetService(typeof(IMessageConsumer));
                consumer.ConsumeMessage(settings);
            }
            catch (Exception e)
            {
                Log.Fatal(e.Message);
                Environment.Exit(-1);
            }
            finally
            {
                Log.Information(string.Format(LogMessages.ConsumerEndedMessage, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                Log.CloseAndFlush();
                bootstrapper.DisposeServices();
                Environment.Exit(0);
            }
        }
Esempio n. 3
0
        // Simulates background work that happens behind the splash screen
        private async void SimulateStartup()
        {
            Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
            await BootstrapperService.Initialize(new IocAndroidModule());

            Log.Debug(TAG, "Startup work is finished - starting MainActivity.");
            StartActivity(new Intent(Application.Context, typeof(MainActivity)));
        }
Esempio n. 4
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                Log.DebugFormat("Processing request for [{0}]", context.Request.Url);

                var cpa = (IContainerProviderAccessor)HttpContext.Current.ApplicationInstance;
                var cp  = cpa.ContainerProvider;
                BootstrapperService _service = cp.RequestLifetime.Resolve <BootstrapperService>();

                var action = context.Request["action"];

                Log.DebugFormat("Processing action [{0}]", action);
                switch (action)
                {
                case "GetFileInfos":
                    var fileInfoArray = new FileInfoArray()
                    {
                        Files = _service.GetFileInfos()
                    };
                    context.Response.StatusCode  = 200;
                    context.Response.ContentType = "text/xml";
                    Log.DebugFormat("Sending [{0}] file infos", fileInfoArray.Files.Length);
                    fileInfoArray.ToXmlStream(context.Response.OutputStream);
                    break;

                case "GetFile":
                    var probe = _service.GetFilePath(context.Request["path"]);
                    if (File.Exists(probe))
                    {
                        Log.DebugFormat("Sending file [{0}]", probe);
                        context.Response.TransmitFile(probe);
                    }
                    else
                    {
                        Log.DebugFormat("file [{0}] not found", probe);
                        context.Response.StatusCode = 404;
                    }
                    break;

                default:
                    Log.DebugFormat("Unknown action [{0}]", action);
                    context.Response.StatusCode = 400;
                    break;
                }
            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error while processing request for [{0}]", context.Request.Url), ex);
                throw;
            }
        }
Esempio n. 5
0
        private async Task InitializeAsync()
        {
            await BootstrapperService.Initialize(new IocWindowsModule());

            GeolocationAccessStatus accessStatus = await Geolocator.RequestAccessAsync();

            //TODO: should store in settings
            var locationService = CC.IoC.Resolve <ILocationService>();

            locationService.HasGpsPermissions = accessStatus == GeolocationAccessStatus.Allowed;

            DismissExtendedSplash();
        }
        private static void Main(string[] args)
        {
            BootstrapperService bootstrapper = new BootstrapperService();
            var serviceProvider = bootstrapper.ServiceProvider;
            Dictionary <string, string> settings = bootstrapper.GetSettingsDictionary();

            Log.Information(string.Format(LogMessages.ProducerStartedMessage, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));

            string input;

            try
            {
                do
                {
                    Console.Write("Enter your name: ");
                    input = Console.ReadLine();
                    if (!input.Equals("exit", StringComparison.OrdinalIgnoreCase))
                    {
                        var producer = (IMessageProducer)serviceProvider.GetService(typeof(IMessageProducer));
                        producer.SendMessage(input, settings);
                    }
                } while (!input.Equals("exit", StringComparison.OrdinalIgnoreCase));
            }
            catch (Exception e)
            {
                Log.Fatal(e.Message);
                Environment.Exit(-1);
            }
            finally
            {
                Log.Information(string.Format(LogMessages.ProducerEndedMessage, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                Log.CloseAndFlush();
                bootstrapper.DisposeServices();
                Environment.Exit(0);
            }
        }
 private void InitializeContainer()
 {
     BootstrapperService.RegisterServices(_container);
     _container.Register <UserService>();
 }