public static async Task Initialize(Assembly assembly)
        {
            try
            {
                var rootFolder = FileSystem.Current.LocalStorage;

                var writer = new ResourceWriter(assembly);

                if (await rootFolder.CheckExistsAsync("Images/remove.png") == ExistenceCheckResult.NotFound)
                {
                    await writer.WriteFile("Images/team-a.png", rootFolder.Path);

                    await writer.WriteFile("Images/team-b.png", rootFolder.Path);

                    await writer.WriteFile("Images/remove.png", rootFolder.Path);

                    await writer.WriteFile("Images/logo.png", rootFolder.Path);

                    await writer.WriteFolder("Images", rootFolder.Path);
                }
            } catch (Exception ex)
            {
                Debug.WriteLine(ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Call this method to initialize the app on first run
        /// </summary>
        /// <param name="webView"></param>
        /// <returns></returns>
        public static async Task Init(IHybridWebView webView)
        {
            // Initialize static content (styles, images, scripts, database files, etc.) here
            if (await FileSystem.Current.GetFileFromPathAsync(PortablePath.Combine(webView.BasePath, "style.css")) == null)
            {
                var writer = new ResourceWriter(typeof(Startup).GetTypeInfo().Assembly);
                await writer.WriteFile("Content/style.css", webView.BasePath);
            }

            // Initialize all controllers and register them with the RouteHandler
            var controller = new Controller1(webView);

            RouteHandler.RegisterController("Controller1", controller);
        }