private static FileChooser CreateProjectPicker() { var picker = new FileChooser(); picker.FileChosenByUser += The.Workspace.Open; return(picker); }
private Widget CreateHeaderSection() { var header = new Widget { Layout = new TableLayout { ColCount = 2, RowCount = 2, RowSpacing = 6, ColSpacing = 6, RowDefaults = new List <LayoutCell> { new LayoutCell { StretchY = 0 }, new LayoutCell { StretchY = 0 }, }, ColDefaults = new List <LayoutCell> { new LayoutCell { StretchX = 0 }, new LayoutCell(), } }, LayoutCell = new LayoutCell { StretchY = 0 } }; AddPicker(header, "Target platform", platformPicker = new PlatformPicker()); AddPicker(header, "Citrus Project", projectPicker = CreateProjectPicker()); return(header); }
public static Widget ProduceStartPage(IEnumerable <string> recentProjects) { ThemedButton openButton = null; var root = new Frame { Layout = new LinearLayout(LayoutDirection.TopToBottom), Nodes = { (openButton = new ThemedButton("Open") { Clicked = () => FileChooser.ShowOpenCitrusProjectDialog(The.Workspace.Open, recentProjects.FirstOrDefault()), }) }, }; DecorateButton(openButton); foreach (var projectPath in recentProjects) { var projectPathBound = projectPath; Frame f = null; var projectName = Path.GetFileNameWithoutExtension(projectPath); root.AddNode( f = new Frame { Layout = new LinearLayout(LayoutDirection.LeftToRight), Nodes = { (openButton = new ThemedButton($"{projectName}\n at \"{projectPathBound}\"") { Clicked = () => The.Workspace.Load(projectPathBound), }), new ThemedButton("X") { Clicked = () => { The.Workspace.RemoveRecentProject(projectPathBound); root.Nodes.Remove(f); }, } } } ); DecorateButton(openButton); } return(root); void DecorateButton(ThemedButton b) { b.MinSize = Vector2.Zero; b.MaxSize = Vector2.PositiveInfinity; var buttonText = (b["TextPresenter"] as SimpleText); buttonText.FontHeight = 100; buttonText.OverflowMode = TextOverflowMode.Minify; } }