public void StartAction(bool forkWorker, bool switchToChart, bool switchToOutput, bool autoContinue = false) { if (Exec.IsExecuting() && !KGui.gui.GuiContinueEnabled()) { return; // we are already running a simulation, don't start a concurrent one } if (Exec.IsExecuting() && KGui.gui.GuiContinueEnabled()) // we are already running a simulation; make start button work as continue button { Protocol.continueExecution = true; MainTabbedPage.SwitchToTab(MainTabbedPage.theChartPageNavigation); } else // do a start { MainTabbedPage.theOutputPage.SetModel(modelInfo); MainTabbedPage.theChartPage.SetModel(modelInfo); Exec.Execute_Starter(forkWorker, autoContinue: autoContinue); // This is where it all happens if (switchToChart) { MainTabbedPage.SwitchToTab(MainTabbedPage.theChartPageNavigation); } else if (switchToOutput) { MainTabbedPage.SwitchToTab(MainTabbedPage.theOutputPageNavigation); } } }
public ListView CreateGroupedListView() { var listView = new ListView { Margin = 20, IsGroupingEnabled = true, SeparatorVisibility = SeparatorVisibility.None, GroupDisplayBinding = new Binding("GroupHeading"), // ModelInfoGroup property GroupShortNameBinding = new Binding("GroupHeading"), // ModelInfoGroup property }; var template = new DataTemplate(typeof(MyDocListCell)); template.SetBinding(MyDocListCell.TextProperty, "title"); // ModelInfo property // template.SetBinding(MyDocListCell.DetailProperty, "datestring"); listView.ItemTemplate = template; var headerTemplate = new DataTemplate(typeof(MyDocListHeaderCell)); headerTemplate.SetBinding(MyDocListHeaderCell.TextProperty, "GroupHeading"); // ModelInfoGroup property listView.GroupHeaderTemplate = headerTemplate; listView.ItemSelected += async(object sender, SelectedItemChangedEventArgs e) => { if (e.SelectedItem != null) { ModelInfo modelInfo = e.SelectedItem as ModelInfo; MainTabbedPage.theModelEntryPage.SetModel(modelInfo, editable: false); MainTabbedPage.SwitchToTab(MainTabbedPage.theModelEntryPageNavigation); } listView.SelectedItem = null; // Deselect item (the "ItemSelected" event does not fire if item is alrady selected; the "ItemTapped" event fires even if the item is selected) }; return(listView); }
public ModelListPage() { Title = "My Networks"; IconImageSource = "icons8openedfolder96.png"; // in iOS>Resource the images of the TitleBar buttons must be size 40, otherwise they will scale but still take the horizontal space of the original listView = new ListView { Margin = 20, }; listView.ItemTemplate = new DataTemplate(typeof(MyModelListCell)); // use MyModelListCell here to activate context menus on (ModelInfo) list items listView.ItemTemplate.SetBinding(MyModelListCell.TextProperty, "title"); // binds property in ModelInfo listView.ItemTemplate.SetBinding(MyModelListCell.DetailProperty, "datestring"); // binds property in ModelInfo listView.ItemSelected += async(object sender, SelectedItemChangedEventArgs e) => { if (e.SelectedItem != null) { MainTabbedPage.theModelEntryPage.SetModel(e.SelectedItem as ModelInfo, editable: true); MainTabbedPage.SwitchToTab(MainTabbedPage.theModelEntryPageNavigation); } listView.SelectedItem = null; // Deselect item. }; listView.BackgroundColor = MainTabbedPage.almostWhite; // BACKGROUND COLOR OF MENU ITEMS ToolbarItems.Add( new ToolbarItem("Add", "icons8plus32.png", async() => { MainTabbedPage.theModelEntryPage.SetModel(new ModelInfo(sample), editable: true); MainTabbedPage.SwitchToTab(MainTabbedPage.theModelEntryPageNavigation); })); AbsoluteLayout layout = new AbsoluteLayout(); AbsoluteLayout.SetLayoutBounds(listView, new Rectangle(0, 0, 1, 1)); AbsoluteLayout.SetLayoutFlags(listView, AbsoluteLayoutFlags.All); layout.Children.Add(listView); Content = layout; }