qdrow

Untitled

Oct 18th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public int[] BinaryValue = new int[64];
  2. public MainWindow()
  3. {
  4. InitializeComponent();
  5. for (int i = 0; i<32; i++)
  6. {
  7. TopBinaryPanel.Children.Add(new Label { Name = "Bin" + i.ToString(), Content = 0});
  8. BotBinaryPanel.Children.Add(new Label { Name = "Bin" + (i+32).ToString(), Content = 0 });
  9. }
  10. }
  11. private void BinaryPanel_MouseDown(object sender, MouseButtonEventArgs e)
  12. {
  13. Label ChildElem = (Label)e.Source;
  14. bool PinVal = Convert.ToBoolean(Convert.ToInt16(ChildElem.Content));
  15. ChildElem.Content = Convert.ToInt16(!PinVal);
  16. int indexChild = Convert.ToInt32(ChildElem.Name.Substring(3));
  17. BinaryValue[indexChild] = Convert.ToInt16(ChildElem.Content);
  18. string FullBinVal = string.Concat<int>(BinaryValue);
  19. Tablo.Text = Convert.ToString(Convert.ToInt64(FullBinVal, 2));
  20. }
Advertisement
Add Comment
Please, Sign In to add comment