/****************************************************** * CALL: Changing the slider. * TASK: Updates the input depending on how the user * interacted with the slider. *****************************************************/ private void Slider_Input_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { Slider slider = sender as Slider; _assemblerModel.setInput(new Bit12((short)slider.Value)); ValueRow_Input.ShowMemoryAdress(_assemblerModel.input()); }
// Should be in SkinManager, but how to access getMMRowOfPosition from there? public void changeSkin(Skins skin) { ResourceDictionary selectedDictionary = SkinManager.GetSkin(skin); App.Current.MainWindow.Resources.MergedDictionaries.Add(selectedDictionary); if (_assemblerModel.undoStack().size() == 0) { _currentTextBox.Foreground = (Brush)FindResource("TextBoxForegroundOff"); } else { _currentTextBox.Foreground = (Brush)FindResource("TextBoxForegroundOn"); } for (int i = 0; i <= 255; i++) { getMMRowOfPosition(255 - i).ChangeSkin(selectedDictionary); } for (int i = 0; i < 5; i++) { getStackRowOfPosition(i).ChangeSkin(selectedDictionary); } ValueRow_InstructionPointer.ChangeSkin(selectedDictionary); ValueRow_Input.ChangeSkin(selectedDictionary); ValueRow_Output.ChangeSkin(selectedDictionary); ValueRow_WorkingRegister.ChangeSkin(selectedDictionary); }
public MainWindow() { InitializeComponent(); _assemblerModel = new AssemblerModel(); _assemblerModel.SelfTest(); showMemoryRowNumbers(); _currentTextBox = TextBox_Assembler; updateGUIMemory(0, 255, _currentTextBox); _inputTimerAssembly = new System.Windows.Threading.DispatcherTimer(); _inputTimerMK = new System.Windows.Threading.DispatcherTimer(); _runTimer = new System.Windows.Threading.DispatcherTimer(); _commandWindow = new Commands(); _aboutWin = new About(); Closing += OnClosing; _assemblySaved = true; _mkSaved = true; _keyPressStack = new CircularStack <Key>(20); _password = "******"; _inputTimerAssembly.Interval = new TimeSpan(0, 0, 0, 0, 500); _inputTimerAssembly.Tick += OnInputTimerAssemblyElapsed; _inputTimerMK.Interval = new TimeSpan(0, 0, 0, 0, 500); _inputTimerMK.Tick += OnInputTimerMKElapsed; _runTimer.Interval = new TimeSpan(0, 0, 0, 0, (int)Slider_FastForward.Value); _runTimer.Tick += OnInputTimerRunElapsed; markRow(getMMRowOfPosition(255 - _assemblerModel.instructionPtr())); // Mark current row Slider_FastForward.Value = 200; // Can't be specified in the XAML file, bug ValueRow_WorkingRegister.ShowMemoryAdress(_assemblerModel.workingRegister()); ValueRow_Output.ShowMemoryAdress(_assemblerModel.output()); ValueRow_Input.ShowMemoryAdress(_assemblerModel.input()); ValueRow_InstructionPointer.ShowMemoryAdress(new Bit12(_assemblerModel.instructionPtr())); ValueRow_InstructionPointer.HideChildElements(); EventManager.RegisterClassHandler(typeof(Window), Keyboard.KeyDownEvent, new KeyEventHandler(keyDown), true); }