/// <summary> /// Toggles the execution state when the execute command is activated. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Arguments describing the event.</param> private static void OnToggleExecutionCommand(object sender, ExecutedRoutedEventArgs e) { DemoContentControl control = sender as DemoContentControl; if (control != null) { control.ToggleExecution(); } }
/// <summary> /// Switches sample text when the selected sample changes. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Arguments describing the event.</param> private static void OnSelectedSampleChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { DemoContentControl control = sender as DemoContentControl; if (control != null) { control.editor.Text = control.Samples[control.SelectedSample]; } }
/// <summary> /// Loads the samples and the compiler once the window itself has loaded. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Arguments describing the event.</param> private static void DemoContentControl_Loaded(object sender, RoutedEventArgs e) { DemoContentControl control = sender as DemoContentControl; if (control != null) { control.boxesGrid = new BoxGrid(); control.BoxesGridArea.Content = control.boxesGrid; control.LoadSamples(); control.editor.TextChanged += new EventHandler(control.Editor_TextChanged); control.eval = new DynamicEval(new HighlightDelegate(control.Highlight), new HighlightBoxDelegate(control.HighlightBox), new WaitDelegate(control.Wait)); control.editor.Focus(); } }