コード例 #1
0
        private void RecentFilesUpdated()
        {
            recent.Items.Clear();

            foreach (FileInfo file in RecentProjects.Get())
            {
                string projectTitle = "<Could not read campaign title>";

                try
                {
                    projectTitle = Json.Load <CampaignFile>(file).Metadata.Title;
                }
                finally
                {
                    Button button;

                    recent.Items.Add(new StackLayout()
                    {
                        Style   = "no-padding vertical",
                        Spacing = 2,

                        Items =
                        {
                            (button  = new Button()
                            {
                                Text = $"{projectTitle} ({file.Directory.FullName})"
                            })
                        },

                        ContextMenu = new ContextMenu()
                        {
                            Items =
                            {
                                new ButtonMenuItem((sender, e) => RecentProjects.Remove(file))
                                {
                                    Text  = "Remove",
                                    Image = Resources.GetIcon("CloseRed.ico")
                                },
                                new ButtonMenuItem((sender, e) => RecentProjects.Clear())
                                {
                                    Text  = "Clear all",
                                    Image = Resources.GetIcon("CloseGray.ico")
                                }
                            }
                        }
                    });

                    button.Click += (sender, e) =>
                    {
                        RecentProjects.Update(file);
                        editor.LoadFile(file);
                    };
                }
            }
        }
コード例 #2
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (AppSettings.Instance.OpenLastProject && RecentProjects.Get().Length > 0)
            {
                mainView.LoadFile(RecentProjects.Get()[0]);
            }

            //Messages.PreviewMessage();
        }