Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int[] BinaryValue = new int[64];
- public MainWindow()
- {
- InitializeComponent();
- for (int i = 0; i<32; i++)
- {
- TopBinaryPanel.Children.Add(new Label { Name = "Bin" + i.ToString(), Content = 0});
- BotBinaryPanel.Children.Add(new Label { Name = "Bin" + (i+32).ToString(), Content = 0 });
- }
- }
- private void BinaryPanel_MouseDown(object sender, MouseButtonEventArgs e)
- {
- Label ChildElem = (Label)e.Source;
- bool PinVal = Convert.ToBoolean(Convert.ToInt16(ChildElem.Content));
- ChildElem.Content = Convert.ToInt16(!PinVal);
- int indexChild = Convert.ToInt32(ChildElem.Name.Substring(3));
- BinaryValue[indexChild] = Convert.ToInt16(ChildElem.Content);
- string FullBinVal = string.Concat<int>(BinaryValue);
- Tablo.Text = Convert.ToString(Convert.ToInt64(FullBinVal, 2));
- }
Advertisement
Add Comment
Please, Sign In to add comment