Exemplo n.º 1
0
        public SectionsPage(Notebook nb)
        {
            InitializeComponent();

            m_nb = nb;

            mnu_new_section.Clicked += Mnu_new_section_Clicked;

            listview.ItemTapped += new EventHandler((o, e) =>
            {
                Section sec             = (Section)o;
                PagesPage pp            = new PagesPage(sec);
                pp.Title                = sec.Title + " | Pages";
                pp.ListView.ItemsSource = sec.Pages;
                ((NavigationPage)((HomeMDP)Application.Current.MainPage).Detail).PushAsync(pp);
            });

            listview.ItemLongTapped += new LNListView.ItemLongTappedHandler((o, e) =>
            {
                Section sec          = (Section)o;
                EditNotebookPrompt p = new EditNotebookPrompt()
                {
                    Title = sec.Title, PromptTitle = "Edit Section", Placeholder = "A Section", IsNavPage = true
                };
                p.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                {
                    sec.Title = p.Title;
                    LocknoteMgr.GetInstance().SaveNotebooks(true);
                    listview.ItemsSource = m_nb.Sections;
                });
                p.DeleteClicked += new EventHandler((o2, e2) =>
                {
                    Prompt p2 = new Prompt()
                    {
                        PromptTitle = "Are you sure?", PositiveButtonText = "Yes", NegativeButtonText = "No", IsNavPage = true
                    };
                    p2.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                    {
                        m_nb.DeleteSection(sec);
                        p.Dismiss();
                    });
                    p2.Show(((HomeMDP)Application.Current.MainPage).Detail);
                });
                p.Show(((HomeMDP)Application.Current.MainPage).Detail);
            });
        }
Exemplo n.º 2
0
        public PagesPage(Section sec)
        {
            InitializeComponent();

            mnu_new_page.Clicked += Mnu_new_page_Clicked;

            this.ListView = listview;
            m_sec         = sec;

            listview.ItemTapped += new EventHandler((o, e) =>
            {
                Locknote.Helpers.Objects.Page p = (Locknote.Helpers.Objects.Page)o;
                PageEditor pe = new PageEditor(p);
                pe.Title      = p.Title;
                ((NavigationPage)((HomeMDP)Application.Current.MainPage).Detail).PushAsync(pe);
            });

            listview.ItemLongTapped += new LNListView.ItemLongTappedHandler((o, e) =>
            {
                Locknote.Helpers.Objects.Page pg = (Locknote.Helpers.Objects.Page)o;
                EditNotebookPrompt p             = new EditNotebookPrompt()
                {
                    Title = pg.Title, PromptTitle = "Edit Page", Placeholder = "A Page", IsNavPage = true
                };
                p.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                {
                    pg.Title = p.Title;
                    LocknoteMgr.GetInstance().SaveNotebooks(true);
                    listview.ItemsSource = m_sec.Pages;
                });
                p.DeleteClicked += new EventHandler((o2, e2) =>
                {
                    Prompt p2 = new Prompt()
                    {
                        PromptTitle = "Are you sure?", PositiveButtonText = "Yes", NegativeButtonText = "No", IsNavPage = true
                    };
                    p2.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                    {
                        sec.DeletePage(pg);
                        p.Dismiss();
                    });
                    p2.Show(((HomeMDP)Application.Current.MainPage).Detail);
                });
                p.Show(((HomeMDP)Application.Current.MainPage).Detail);
            });
        }
Exemplo n.º 3
0
        public HomeMDPMaster()
        {
            InitializeComponent();

            ListView = lst_notebooks;

            object version = "";

            App.Current.Resources.TryGetValue("version", out version);
            lbl_version.Text = version.ToString();

            mst_lock_unlock.Clicked += new EventHandler((o, e) =>
            {
                LocknoteMgr.GetInstance().SecureErase();
                ((App)Application.Current).ResumeApp();
            });
            mst_settings.Clicked += new EventHandler((o, e) =>
            {
                ((NavigationPage)((HomeMDP)Application.Current.MainPage).Detail).PushAsync(new SettingsPage());
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });
            mst_new_notebook.Clicked += new EventHandler((o, e) =>
            {
                TextEntryPrompt p = new TextEntryPrompt()
                {
                    IsNavPage = true, PositiveButtonText = "Create", NegativeButtonText = "Cancel", PromptTitle = "New Notebook", Hint = "A Notebook"
                };
                p.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                {
                    LocknoteMgr.GetInstance().NoteManager.NewNotebook(p.Text);
                    LocknoteMgr.GetInstance().SaveNotebooks(true);
                    ((HomeMDP)Application.Current.MainPage).IsPresented = true;
                });
                p.Show(((HomeMDP)Application.Current.MainPage).Detail);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });

            lst_notebooks.ItemTapped += new EventHandler((o, e) =>
            {
                Notebook nb             = (Notebook)o;
                SectionsPage sp         = new SectionsPage(nb);
                sp.Title                = nb.Title + " | Sections";
                sp.ListView.ItemsSource = nb.Sections;
                ((HomeMDP)Application.Current.MainPage).Detail      = new NavigationPage(sp);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });

            lst_notebooks.ItemLongTapped += new LNListView.ItemLongTappedHandler((o, e) =>
            {
                Notebook nb          = (Notebook)o;
                EditNotebookPrompt p = new EditNotebookPrompt()
                {
                    Title = nb.Title, IsNavPage = true
                };
                Xamarin.Forms.Page pg = ((NavigationPage)((HomeMDP)Application.Current.MainPage).Detail).CurrentPage;
                p.OnPromptSaved      += new Prompt.PromptClosedEventListener(() =>
                {
                    nb.Title = p.Title;
                    if (pg.GetType() == typeof(SectionsPage))
                    {
                        pg.Title = p.Title + " | Sections";
                    }
                    LocknoteMgr.GetInstance().SaveNotebooks(true);
                    lst_notebooks.ItemsSource = LocknoteMgr.GetInstance().NoteManager.Notebooks;
                });
                p.DeleteClicked += new EventHandler((o2, e2) =>
                {
                    Prompt p2 = new Prompt()
                    {
                        PromptTitle = "Are you sure?", PositiveButtonText = "Yes", NegativeButtonText = "No", IsNavPage = true
                    };
                    p2.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                    {
                        LocknoteMgr.GetInstance().NoteManager.DeleteNotebook(nb);
                        p.Dismiss();
                    });
                    p2.Show(((HomeMDP)Application.Current.MainPage).Detail);
                });
                p.Show(((HomeMDP)Application.Current.MainPage).Detail);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });
        }