Exemplo n.º 1
0
        public async void Handle_StartOver(object sender, EventArgs e)
        {
            var cont = await DisplayAlert("Delete Current Application?", "A new application will be blank and you will have to enter all your information again.", "Start Over", "Cancel");

            if (!cont)
            {
                return;
            }

            var newHif = HIF.CreateNew();

            hif.Delete();
            hif            = newHif;
            BindingContext = newHif;
        }
        public App()
        {
            InitializeComponent();

            MobileCenter.Start($"android={Constants.MobileCenterAndroid};" +
                               $"uwp={Constants.MobileCenterUWP};" +
                               $"ios={Constants.MobileCenteriOS}",
                               typeof(Analytics), typeof(Crashes));

            if (UseMockDataStore)
            {
                DependencyService.Register <MockDataStore>();
            }
            else
            {
                DependencyService.Register <HIFCloudDataStore>();
            }

            //
            // Load Application
            //
            var lastPath = Settings.LastApplicationPath;
            var hif      = HIF.CreateNew();

            if (!string.IsNullOrEmpty(lastPath))
            {
                var path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), lastPath);
                Console.WriteLine("TRY READ " + path);
                if (System.IO.File.Exists(path))
                {
                    hif = HIF.ReadFile(path);
                }
            }

            MainPage = new NavigationPage(new HomePage(hif));
        }