private StackLayout AddButtons(ContentLoader_Optics contentLoader) { List <Button> buttons = contentLoader.GetButtons(); foreach (var item in buttons) { try { string methodName = item.AutomationId; EventHandler handler = (EventHandler)Delegate.CreateDelegate(typeof(EventHandler), this, methodName, false); item.Clicked += handler; PageContent.Children.Add(item); } catch (Exception ex) { string methodName = AutomationId; Label InfoLabel = new Label { Text = "Method name: " + methodName + "\nThere was an Exception: " + ex, TextColor = Color.White }; PageContent.Children.Add(InfoLabel); } } return(PageContent); }
public Sniperx6() { InitializeComponent(); ContentLoader_Optics contentLoader = new ContentLoader_Optics(ContentLoader_Optics.Sights.Sniperx6, PageContent); contentLoader.Fill(); PageContent = AddButtons(contentLoader); }
public Digitalx1() { InitializeComponent(); ContentLoader_Optics contentLoader = new ContentLoader_Optics(ContentLoader_Optics.Sights.Digitalx1, PageContent); contentLoader.Fill(); PageContent = AddButtons(contentLoader); }
public AOGx2_4() { InitializeComponent(); ContentLoader_Optics contentLoader = new ContentLoader_Optics(ContentLoader_Optics.Sights.AOGx2_4, PageContent); contentLoader.Fill(); PageContent = AddButtons(contentLoader); }