Example #1
0
        private void StartTutorial()
        {
            TutorialPage tutPage = new TutorialPage();

            tutPage.Complete += new EventHandler((o, e) =>
            {
                FirstTimeSetup fts   = new FirstTimeSetup();
                fts.OnSetupComplete += new EventHandler((o2, e2) =>
                {
                    //setup is complete, save that in the app config
                    m_config.IsSetUp = true;
                    //attempt to load the keys and run the normal app start code
                    m_ln.LoadKeys();
                    this.OnStart();
                });
                this.MainPage = new NavigationPage(fts)
                {
                    Title = "Locknote First Time Setup"
                };
            });

            //check to see if notebooks exist already
            if (Directory.Exists(NoteManager.GetNotebookDir()))
            {
                Prompt p = new Prompt()
                {
                    PromptTitle = "Found notebooks. Running first time set up will delete these notebooks. Would you like to continue anyway?", NegativeButtonText = "No", PositiveButtonText = "Yes"
                };
                p.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                {
                    MainPage = tutPage;
                });
                p.Show();
            }
            else
            {
                MainPage = tutPage;
            }
        }
Example #2
0
        public App()
        {
            InitializeComponent();

            m_config = ConfigFactory.GetInstance();

            m_ln = LocknoteMgr.GetInstance();

            //attempt to load the keys
            bool keys = m_ln.LoadKeys();

            if (!m_config.IsSetUp)
            { //not set up
                //check to see if the keys are there, if so, ask if the user wants to restore the keys
                if (keys)
                {
                    Prompt p = new Prompt()
                    {
                        PromptTitle = "Found existing keys, would you like to import them?", PositiveButtonText = "Yes", NegativeButtonText = "No"
                    };
                    p.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                    { //Yes - mark as set up
                        m_config.IsSetUp = true;
                        OnStart();
                    });
                    p.OnPromptDismissed += new Prompt.PromptClosedEventListener(() =>
                    { //No - start the tutorial
                        m_ln.SecureErase();
                        StartTutorial();
                    });
                    p.Show();
                }
                else
                { //no keys were found, just start the tutorial
                    StartTutorial();
                }
            }
        }