protected override void OnStart() { //do nothing here if the app isn't set up yet if (!m_config.IsSetUp) { return; } //check to make sure both keys were loaded if (!m_ln.Loaded) { string t = "Could not load either your private key or public key\n"; t += "\nMake sure the files private.key.pem and public.key.pem exist in the directory "; t += StorageFactory.GetInstance().GetDirectory(); Prompt pt = new Prompt() { PromptTitle = t, PositiveButtonVisible = true, PositiveButtonText = "Continue Anyway", NegativeButtonVisible = false }; pt.OnPromptSaved += new Prompt.PromptClosedEventListener(() => { m_config.IsSetUp = false; m_ln.SecureErase(); StartTutorial(); }); pt.Show(); return; } //start the app resume code ResumeApp(); }
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(); } } }