private void btnMakeNewMenu_Click(object sender, RoutedEventArgs e) { // Retrieve the object by setting a temporary variable to reference the XAML static resource MenuMaker menuMaker = FindResource("menuMaker") as MenuMaker; menuMaker.UpdateMenu(); }
public MainWindow() { InitializeComponent(); MenuMaker menuMaker = new MenuMaker(); label1.Content = menuMaker.GetMenuItem(); label2.Content = menuMaker.GetMenuItem(); label3.Content = menuMaker.GetMenuItem(); label4.Content = menuMaker.GetMenuItem(); label5.Content = menuMaker.GetMenuItem(); }
public Form1() { InitializeComponent(); MenuMaker maker = new MenuMaker() { Randomizer = new Random() }; label1.Text = maker.GetMenuItem(); label2.Text = maker.GetMenuItem(); label3.Text = maker.GetMenuItem(); label4.Text = maker.GetMenuItem(); label4.Text = maker.GetMenuItem(); label5.Text = maker.GetMenuItem(); label6.Text = maker.GetMenuItem(); }
private void newMenu_Click(object sender, RoutedEventArgs e) { MenuMaker menuMaker = FindResource("menuMaker") as MenuMaker; menuMaker.UpdateMenu(); }