예제 #1
0
 public static LocknoteMgr GetInstance()
 {
     if (m_theMgr == null)
     {
         m_theMgr = new LocknoteMgr();
     }
     return(m_theMgr);
 }
예제 #2
0
 protected override void OnSleep()
 {
     //is user currently editing a page?
     if (MainPage.GetType() == typeof(HomeMDP) && ((NavigationPage)((HomeMDP)MainPage).Detail).CurrentPage.GetType() == typeof(PageEditor))
     {
         //get the pageeditor
         PageEditor pe = (PageEditor)((NavigationPage)((HomeMDP)MainPage).Detail).CurrentPage;
         //do a temp save so non-saved content is restored on resume
         pe.TempSave();
         //check settings, save page if set
         if (m_config.SaveOnSuspend)
         {
             pe.SavePage(this, new EventArgs());
             NotificationFactory.ShortAlert("Page Saved!");
         }
     }
     //check settings, lock app if set
     if (m_config.LockOnSuspend)
     {
         LocknoteMgr.GetInstance().SecureErase();
     }
 }
예제 #3
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();
                }
            }
        }