private void FillListWithSamples() { var selectedCategory = CategoryComboBox.SelectedValue?.ToString() ?? ""; SampleList.Children.Clear(); foreach (var sample in AllSamples.GetSamples().Where(s => s.Category == selectedCategory)) { SampleList.Children.Add(CreateRadioButton(sample)); } var firstRadioButton = (RadioButton)SampleList.Children[0]; firstRadioButton.IsChecked = true; firstRadioButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); }
public void BeginRenderSample(string sampleName) { if (AllSamples == null || !AllSamples.ContainsKey(sampleName)) { return; } if (CurrentSample != null) { CurrentSample.OnExit(); } CurrentSample = Activator.CreateInstance(AllSamples[sampleName]) as Sample; CurrentSample.OnInit(); }
public MainPage() { InitializeComponent(); // nullable warning workaround" var test = this.listView ?? throw new InvalidOperationException(); allSamples = AllSamples.GetSamples() ?? new List <ISample>(); var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c); picker !.ItemsSource = categories.ToList <string>(); picker.SelectedIndexChanged += PickerSelectedIndexChanged; picker.SelectedItem = "Forms"; }
private void FillComboBoxWithCategories() { // todo: find proper way to load assembly WmsSample.LoadAssembly(); Tests.Common.Utilities.LoadAssembly(); var categories = AllSamples.GetSamples().Select(s => s.Category).Distinct().OrderBy(c => c); foreach (var category in categories) { CategoryComboBox.Items.Add(category); } CategoryComboBox.SelectedIndex = 1; }
private void FillComboBoxWithCategories() { var categories = AllSamples.GetSamples()?.Select(s => s.Category).Distinct().OrderBy(c => c); if (categories == null) { return; } foreach (var category in categories) { CategoryComboBox.Items?.Add(category); } CategoryComboBox.SelectedIndex = 1; }
public override bool OnCreateOptionsMenu(IMenu menu) { MenuInflater.Inflate(Resource.Menu.menu_main, menu); var categories = AllSamples.GetSamples().Select(s => s.Category).Distinct().OrderBy(c => c); foreach (var category in categories) { var submenu = menu.AddSubMenu(category); foreach (var sample in AllSamples.GetSamples().Where(s => s.Category == category)) { submenu.Add(sample.Name); } } return(true); }
public MainPage() { InitializeComponent(); allSamples = AllSamples.GetSamples(); var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c); foreach (var category in categories) { picker.Items?.Add(category); } picker.SelectedIndexChanged += PickerSelectedIndexChanged; picker.SelectedItem = "Forms"; listView.ItemsSource = allSamples.Select(k => k.Name).ToList(); }
private void FillListWithSamples() { var selectedCategory = CategoryComboBox.SelectedValue?.ToString() ?? ""; SampleList.Children.Clear(); var enumerable = AllSamples.GetSamples()?.Where(s => s.Category == selectedCategory); if (enumerable == null) { return; } foreach (var sample in enumerable) { SampleList.Children.Add(CreateRadioButton(sample)); } }
public override bool OnOptionsItemSelected(IMenuItem item) { var id = item.ItemId; if (item.HasSubMenu) { return(true); } if (id == Resource.Id.action_settings) { return(true); } if (_mapControl == null) { return(false); } if (item.TitleFormatted?.ToString() == SkiaRenderMode.Software.ToString()) { _mapControl.RenderMode = SkiaRenderMode.Software; } else if (item.TitleFormatted?.ToString() == SkiaRenderMode.Hardware.ToString()) { _mapControl.RenderMode = SkiaRenderMode.Hardware; } else { var sample = AllSamples.GetSamples()?.FirstOrDefault(s => s.Name == item.TitleFormatted?.ToString()); if (sample != null) { _mapControl?.Map?.Layers.Clear(); Catch.Exceptions(async() => { await sample.SetupAsync(_mapControl !); }); return(true); } } return(base.OnOptionsItemSelected(item)); }
/// <summary> /// Initializes the sample manager by loading all of the samples in the app. /// </summary> public void Initialize() { // Get the currently-executing assembly. Assembly samplesAssembly = GetType().GetTypeInfo().Assembly; // Get the list of all samples in the assembly. AllSamples = CreateSampleInfos(samplesAssembly).OrderBy(info => info.Category) .ThenBy(info => info.SampleName.ToLowerInvariant()) .ToList(); // Create a tree from the list of all samples. FullTree = BuildFullTree(AllSamples); // Add a special category for featured samples. SearchableTreeNode featured = new SearchableTreeNode("Featured", AllSamples.Where(sample => sample.Tags.Contains("Featured"))); FullTree.Items.Insert(0, featured); }
private void Form1_Load(object sender, EventArgs e) { _helper = new SampleHelper(panelSamples, panelSample, sampleHeader, sampleDescription); var samples = new AllSamples(); var g1 = new SampleGroup() { Name = "Heatmap" }; var s11 = new Sample() { Name = "Color Scale", Description = "Shows Heatmap plot with gradient color scale. The data from two-dimensional array is shown as a table. The color of table's cell depends on the corresponding data value.", ControlName = "Temperature" }; g1.Samples.Add(s11); var s12 = new Sample() { Name = "Color Axis", Description = "Shows Heatmap plot with gradient color axis. The data from function f(x,y) is displayed a heatmap with gradient colouring. The correspondence with color and function value is shown on the auxliary color axis.", ControlName = "ColorAxis" }; g1.Samples.Add(s12); var s13 = new Sample() { Name = "Discrete Color Scale", Description = "Shows Heatmap plot with disrete color scale. In case of disrete color scale, the color depends on which interval the corresponding data value belongs to. All data points from the same interval have the same color. The list of user-defined intervals is shown on the chart legend.", ControlName = "Loading" }; g1.Samples.Add(s13); samples.Groups.Add(g1); if (samples != null) { _helper.InitSamples(samples); } }
private void Form1_Load(object sender, EventArgs e) { _helper = new SampleHelper(panelSamples, panelSample, sampleHeader, sampleDescription); var samples = new AllSamples(); var g1 = new SampleGroup() { Name = "" }; var s11 = new Sample() { Name = "FlexChart Animation", Description = "Shows advanced animation options for FlexChart control.", ControlName = "FlexChartAnimation" }; g1.Samples.Add(s11); var s12 = new Sample() { Name = "FlexPie Animation", Description = "Shows advanced animation options for FlexPie control.", ControlName = "FlexPieAnimation" }; g1.Samples.Add(s12); var s13 = new Sample() { Name = "Custom Animation", Description = "Show how to customize animation with AnimationTransform event.", ControlName = "CustomAnimation" }; g1.Samples.Add(s13); samples.Groups.Add(g1); if (samples != null) { _helper.InitSamples(samples); } }
public override bool OnCreateOptionsMenu(IMenu menu) { MenuInflater.Inflate(Resource.Menu.menu_main, menu); var rendererMenu = menu.AddSubMenu(nameof(SkiaRenderMode)); rendererMenu.Add(SkiaRenderMode.Regular.ToString()); rendererMenu.Add(SkiaRenderMode.Accelerated.ToString()); var categories = AllSamples.GetSamples().Select(s => s.Category).Distinct().OrderBy(c => c); foreach (var category in categories) { var submenu = menu.AddSubMenu(category); foreach (var sample in AllSamples.GetSamples().Where(s => s.Category == category)) { submenu.Add(sample.Name); } } return(true); }
public MainPage() { MapControl.Map?.Layers.Add(OpenStreetMap.CreateTileLayer()); Content = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }, new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) } }, Children = { new VerticalStackLayout() { Spacing = 20, Children = { SampleCategoryPicker, SampleList } }.Column(0).Padding(20), MapControl.Column(1) } }; SampleList.ItemSelected += SampleList_ItemSelected; allSamples = AllSamples.GetSamples() ?? new List <ISampleBase>(); var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c); SampleCategoryPicker !.ItemsSource = categories.ToList <string>(); SampleCategoryPicker.SelectedIndexChanged += SampleCategoryPicker_SelectedIndexChanged;; SampleCategoryPicker.SelectedItem = "Info"; }
public override bool OnCreateOptionsMenu(IMenu?menu) { MenuInflater.Inflate(Resource.Menu.menu_main, menu); if (menu == null) { return(false); } var rendererMenu = menu.AddSubMenu(nameof(SkiaRenderMode)); rendererMenu?.Add(SkiaRenderMode.Software.ToString()); rendererMenu?.Add(SkiaRenderMode.Hardware.ToString()); var categories = AllSamples.GetSamples()?.Select(s => s.Category).Distinct().OrderBy(c => c); if (categories == null) { return(false); } foreach (var category in categories) { var submenu = menu.AddSubMenu(category); var allSamples = AllSamples.GetSamples()?.Where(s => s.Category == category); if (allSamples == null) { return(false); } foreach (var sample in allSamples) { submenu?.Add(sample.Name); } } return(true); }
private void InitializeSamples() { _samples = AllSamples.CreateList(); _map = _samples[_currentSampleIndex](); }
static void Main(string[] args) { AllSamples.Run(); }