Guest User

DoubleDown

a guest
Mar 22nd, 2023
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | Fixit | 0 0
  1. private void populateDashboardButtons()
  2. {
  3.  
  4. //Connect to MongoDB, Grab Buttons
  5. MongoDBConnection mongoConnection = new MongoDBConnection();
  6. var dashboardButtons = mongoConnection.ReadButtons("USERID");
  7.  
  8. //Loop Through each button in list
  9. foreach ( var button in dashboardButtons )
  10. {
  11. //add buttons to form (dashboard)
  12. if (flowLayoutDasboardButtons.Controls.Count < 0)
  13. {
  14. flowLayoutDasboardButtons.Controls.Clear();
  15. }
  16. else
  17. {
  18. button.Click += new EventHandler(do_somehting);
  19. flowLayoutDasboardButtons.Controls.Add(button);
  20. //button.Click += new EventHandler(do_somehting);
  21. }
  22. }
  23.  
  24. }
  25. void do_somehting(object sender, EventArgs e)
  26. {
  27. Debug.WriteLine("Holy Shit it started to Execute");
  28. var btn = sender as Button;
  29. if (btn.Text == "This Button")
  30. {
  31. //Do This Code Now
  32. Debug.WriteLine("Holy Shit it worked");
  33. }
  34. else
  35. {
  36. Debug.WriteLine("Holy Shit Code Block Executred");
  37. }
  38.  
  39. //Delete This code (testing only)
  40. //mongoConnection.createPermission("Group A", "RocketButtons", "Create");
  41. //Debug.WriteLine(GetTime.GetNetworkTime().ToString());
  42.  
  43.  
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment