protected override void SetThisContent() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Grid grid_sub = new Grid(); grid_sub.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_sub.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) }); grid_main.SetRowColumn(grid_sub, 3, 0); Grid grid_left = new Grid(); grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_sub.SetRowColumn(grid_left, 0, 0); //////// // Id m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center }; Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_id = new Grid(); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.SetRowColumn(m_textBlock_id, 0, 1); grid_id.SetRowColumn(label_id, 0, 0); grid_main.SetRowColumn(grid_id, 0, 0); //////// // Name m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_name = new Grid(); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.SetRowColumn(validator_name, 1, 0); grid_name.SetRowColumn(label_name, 0, 0); grid_main.SetRowColumn(grid_name, 1, 0); //////// // Texture Button button_texture = new Button() { Content = " ... " }; button_texture.Click += (x, y) => { SelectTextureFile(); }; m_textBox_texture = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_texture = new ValidatorPanel(m_textBox_texture, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_texture = new Label() { Content = "Texture File: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_texture = new Grid(); grid_texture.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texture.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texture.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) }); grid_texture.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_texture.SetRowColumn(button_texture, 1, 1); grid_texture.SetRowColumn(validator_texture, 1, 0); Grid.SetColumnSpan(label_texture, 2); grid_texture.SetRowColumn(label_texture, 0, 0); grid_main.SetRowColumn(grid_texture, 2, 0); //////// // Duration m_doubleUpDown_duration = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center }; Label label_duration = new Label() { Content = "Duration: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_duration = new Grid(); grid_duration.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_duration.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_duration.SetRowColumn(m_doubleUpDown_duration, 1, 0); grid_duration.SetRowColumn(label_duration, 0, 0); grid_left.SetRowColumn(grid_duration, 0, 0); //////// // Width m_doubleUpDown_width = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_width = new ValidatorPanel(m_doubleUpDown_width, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_width = new Label() { Content = "Width: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_width = new Grid(); grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_width.SetRowColumn(validator_width, 1, 0); grid_width.SetRowColumn(label_width, 0, 0); grid_left.SetRowColumn(grid_width, 1, 0); //////// // Height m_doubleUpDown_height = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_height = new ValidatorPanel(m_doubleUpDown_height, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_height = new Label() { Content = "Height: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_height = new Grid(); grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_height.SetRowColumn(validator_height, 1, 0); grid_height.SetRowColumn(label_height, 0, 0); grid_left.SetRowColumn(grid_height, 2, 0); //////// // Get/Set Width/Height Button button_getLengths = new Button() { Content = "Get Lengths" }; button_getLengths.Click += (x, y) => { if (m_canvasWithRectangle != null && m_canvasWithRectangle.SizableRectangle != null) { m_doubleUpDown_width.Value = m_canvasWithRectangle.SizableRectangle.Width; m_doubleUpDown_height.Value = m_canvasWithRectangle.SizableRectangle.Height; } }; Button button_setLengths = new Button() { Content = "Set Lengths" }; button_setLengths.Click += (x, y) => { if (m_canvasWithRectangle != null && m_canvasWithRectangle.SizableRectangle != null && m_doubleUpDown_width.Value.HasValue && m_doubleUpDown_height.Value.HasValue) { m_canvasWithRectangle.SizableRectangle.Width = m_doubleUpDown_width.Value.Value; m_canvasWithRectangle.SizableRectangle.Height = m_doubleUpDown_height.Value.Value; } }; Grid grid_getSetLengths = new Grid() { Margin = new Thickness(1.0, 2.5, 1.0, 0.0) }; grid_getSetLengths.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50.0, GridUnitType.Star) }); grid_getSetLengths.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50.0, GridUnitType.Star) }); grid_getSetLengths.SetRowColumn(button_getLengths, 0, 0); grid_getSetLengths.SetRowColumn(button_setLengths, 0, 1); grid_left.SetRowColumn(grid_getSetLengths, 3, 0); //////// // TexCoordTop m_doubleUpDown_texCoordTop = new DoubleUpDown() { Increment = .005, VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_texCoordTop = new ValidatorPanel(m_doubleUpDown_texCoordTop, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_texCoordTop = new Label() { Content = "TexCoordTop: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_texCoordTop = new Grid(); grid_texCoordTop.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texCoordTop.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texCoordTop.SetRowColumn(validator_texCoordTop, 1, 0); grid_texCoordTop.SetRowColumn(label_texCoordTop, 0, 0); grid_left.SetRowColumn(grid_texCoordTop, 4, 0); //////// // TexCoordRight m_doubleUpDown_texCoordRight = new DoubleUpDown() { Increment = .005, VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_texCoordRight = new ValidatorPanel(m_doubleUpDown_texCoordRight, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_texCoordRight = new Label() { Content = "TexCoordRight: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_texCoordRight = new Grid(); grid_texCoordRight.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texCoordRight.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texCoordRight.SetRowColumn(validator_texCoordRight, 1, 0); grid_texCoordRight.SetRowColumn(label_texCoordRight, 0, 0); grid_left.SetRowColumn(grid_texCoordRight, 5, 0); //////// // TexCoordBottom m_doubleUpDown_texCoordBottom = new DoubleUpDown() { Increment = .005, VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_texCoordBottom = new ValidatorPanel(m_doubleUpDown_texCoordBottom, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_texCoordBottom = new Label() { Content = "TexCoordBottom: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_texCoordBottom = new Grid(); grid_texCoordBottom.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texCoordBottom.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texCoordBottom.SetRowColumn(validator_texCoordBottom, 1, 0); grid_texCoordBottom.SetRowColumn(label_texCoordBottom, 0, 0); grid_left.SetRowColumn(grid_texCoordBottom, 6, 0); //////// // TexCoordLeft m_doubleUpDown_texCoordLeft = new DoubleUpDown() { Increment = .005, VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_texCoordLeft = new ValidatorPanel(m_doubleUpDown_texCoordLeft, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_texCoordLeft = new Label() { Content = "TexCoordLeft: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_texCoordLeft = new Grid(); grid_texCoordLeft.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texCoordLeft.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_texCoordLeft.SetRowColumn(validator_texCoordLeft, 1, 0); grid_texCoordLeft.SetRowColumn(label_texCoordLeft, 0, 0); grid_left.SetRowColumn(grid_texCoordLeft, 7, 0); //////// // Canvas m_image = new Image() { Stretch = System.Windows.Media.Stretch.None }; Binding binding_image_imageSource = new Binding("Text") { Source = m_textBox_texture, Mode = BindingMode.OneWay, UpdateSourceTrigger = System.Windows.Data.UpdateSourceTrigger.PropertyChanged, Converter = new BitmapSourceConverter() }; m_image.SetBinding(Image.SourceProperty, binding_image_imageSource); m_canvasWithRectangle = new UserControl_CanvasWithRectangle(new[] { m_image }) { Width = 500, Height = 500 }; m_zoomBox = new Zoombox() { Content = m_canvasWithRectangle, Background = Brushes.Black, Width = m_canvasWithRectangle.Width, Height = m_canvasWithRectangle.Height, Margin = new Thickness(5.0), HorizontalAlignment = System.Windows.HorizontalAlignment.Center, VerticalAlignment = System.Windows.VerticalAlignment.Center, MinScale = 1.0, MaxScale = 100 }; grid_sub.SetRowColumn(m_zoomBox, 0, 1); //////// // FIN ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] { validator_name, validator_texture, validator_width, validator_height, validator_texCoordTop, validator_texCoordRight, validator_texCoordBottom, validator_texCoordLeft }}; }
protected override void SetThisContent() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); //////// // Id m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center }; Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_id = new Grid(); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.SetRowColumn(m_textBlock_id, 0, 1); grid_id.SetRowColumn(label_id, 0, 0); grid_main.SetRowColumn(grid_id, 0, 0); //////// // Name m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_name = new Grid(); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.SetRowColumn(validator_name, 1, 0); grid_name.SetRowColumn(label_name, 0, 0); grid_main.SetRowColumn(grid_name, 1, 0); //////// // FIN ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] { validator_name }}; }
protected override void SetThisContent() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); //////// // Id m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center }; Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_id = new Grid(); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.SetRowColumn(m_textBlock_id, 0, 1); grid_id.SetRowColumn(label_id, 0, 0); grid_main.SetRowColumn(grid_id, 0, 0); //////// // Name m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_name = new Grid(); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.SetRowColumn(validator_name, 1, 0); grid_name.SetRowColumn(label_name, 0, 0); grid_main.SetRowColumn(grid_name, 1, 0); //////// // Order m_integerUpDown_order = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center }; Label label_order = new Label() { Content = "Order: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_order = new Grid(); grid_order.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_order.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_order.SetRowColumn(m_integerUpDown_order, 1, 0); grid_order.SetRowColumn(label_order, 0, 0); grid_main.SetRowColumn(grid_order, 2, 0); //////// // Width m_doubleUpDown_width = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_width = new ValidatorPanel(m_doubleUpDown_width, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_width = new Label() { Content = "Width: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_width = new Grid(); grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_width.SetRowColumn(validator_width, 1, 0); grid_width.SetRowColumn(label_width, 0, 0); grid_main.SetRowColumn(grid_width, 3, 0); //////// // Height m_doubleUpDown_height = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_height = new ValidatorPanel(m_doubleUpDown_height, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_height = new Label() { Content = "Height: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_height = new Grid(); grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_height.SetRowColumn(validator_height, 1, 0); grid_height.SetRowColumn(label_height, 0, 0); grid_main.SetRowColumn(grid_height, 4, 0); //////// // FIN ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] { validator_name, validator_width, validator_height }}; }
protected override void SetThisContent() { Grid grid_main = new Grid(); grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); //////// // Id m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center }; Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_id = new Grid(); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.SetRowColumn(m_textBlock_id, 0, 1); grid_id.SetRowColumn(label_id, 0, 0); grid_main.SetRowColumn(grid_id, 0, 0); //////// // Name /*m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_name = new Grid(); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.SetRowColumn(validator_name, 1, 0); grid_name.SetRowColumn(label_name, 0, 0); grid_main.SetRowColumn(grid_name, 1, 0);*/ //////// // Priority m_integerUpDown_priority = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_priority = new ValidatorPanel(m_integerUpDown_priority, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_priority = new Label() { Content = "Priority: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_priority = new Grid(); grid_priority.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_priority.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_priority.SetRowColumn(validator_priority, 1, 0); grid_priority.SetRowColumn(label_priority, 0, 0); grid_main.SetRowColumn(grid_priority, 2, 0); //////// // X /*m_doubleUpDown_x = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_x = new ValidatorPanel(m_doubleUpDown_x, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_x = new Label() { Content = "X: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_x = new Grid(); grid_x.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_x.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_x.SetRowColumn(validator_x, 1, 0); grid_x.SetRowColumn(label_x, 0, 0); grid_main.SetRowColumn(grid_x, 3, 0);*/ //////// // Y /*m_doubleUpDown_y = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_y = new ValidatorPanel(m_doubleUpDown_y, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_y = new Label() { Content = "Y: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_y = new Grid(); grid_y.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_y.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_y.SetRowColumn(validator_y, 1, 0); grid_y.SetRowColumn(label_y, 0, 0); grid_main.SetRowColumn(grid_y, 4, 0);*/ //////// // Data m_grid_data = new Grid(); m_grid_data.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) }); Grid grid_newData = new Grid(); Label label_data = new Label() { Content = "Data: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; var enumNames = Enum.GetNames(typeof(UserControl_LevelLayoutData.DataType)); var enumValues = Enum.GetValues(typeof(UserControl_LevelLayoutData.DataType)).OfType<UserControl_LevelLayoutData.DataType>().ToArray(); for(int i = 0, j = enumNames.Length, percent = 100 / j; i < j; ++i) { var enumName = enumNames[i]; var enumValue = enumValues[i]; grid_newData.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(percent, GridUnitType.Star) }); Button button_addNewData = new Button() { Content = "+ " + enumName }; button_addNewData.Click += (x,y) => { var ev = enumValue; AddLevelLayoutDataControl(ev); }; grid_newData.SetRowColumn(button_addNewData, 0, i); } Grid grid_data = new Grid(); grid_data.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) }); grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_data.SetRowColumn(m_grid_data, 2, 0); grid_data.SetRowColumn(grid_newData, 1, 0); grid_data.SetRowColumn(label_data, 0, 0); grid_main.SetRowColumn(grid_data, 5, 0); //////// // FIN ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_integerUpDown_priority, Validators = new ValidatorBase[] { //validator_name, validator_priority, //validator_x, //validator_y }}; }
protected override void SetThisContent() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); //////// // Id m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center }; Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_id = new Grid(); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.SetRowColumn(m_textBlock_id, 0, 1); grid_id.SetRowColumn(label_id, 0, 0); grid_main.SetRowColumn(grid_id, 0, 0); //////// // Name m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_name = new Grid(); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.SetRowColumn(validator_name, 1, 0); grid_name.SetRowColumn(label_name, 0, 0); grid_main.SetRowColumn(grid_name, 1, 0); //////// // EntityInstanceDefinition CollectionViewSource collectionViewSource_entityInstanceDefinition = new CollectionViewSource() { Source = DataManager.EntityInstanceDefinitions }; m_comboBox_entityInstanceDefinition = new ComboBox() { DisplayMemberPath = "Name", IsTextSearchEnabled = true }; m_comboBox_entityInstanceDefinition.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_entityInstanceDefinition }); ValidatorPanel validator_entityInstanceDefinition = new ValidatorPanel(m_comboBox_entityInstanceDefinition, ComboBox.SelectedItemProperty, new Validate_NotNull()); Label label_entityInstanceDefinition = new Label() { Content = "Entity Instance: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_entityInstanceDefinition = new Grid(); grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_entityInstanceDefinition.SetRowColumn(validator_entityInstanceDefinition, 1, 0); grid_entityInstanceDefinition.SetRowColumn(label_entityInstanceDefinition, 0, 0); grid_main.SetRowColumn(grid_entityInstanceDefinition, 2, 0); //////// // ZOrder m_integerUpDown_zOrder = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_zOrder = new ValidatorPanel(m_integerUpDown_zOrder, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_zOrder = new Label() { Content = "Z-Order: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_zOrder = new Grid(); grid_zOrder.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_zOrder.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_zOrder.SetRowColumn(validator_zOrder, 1, 0); grid_zOrder.SetRowColumn(label_zOrder, 0, 0); grid_main.SetRowColumn(grid_zOrder, 3, 0); //////// // RenderPass m_integerUpDown_renderPass = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_renderPass = new ValidatorPanel(m_integerUpDown_renderPass, IntegerUpDown.ValueProperty, new Validate_NotNull()); Label label_renderPass = new Label() { Content = "Render Pass: "******"Animation", HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Center }; Label label_radioButton_font = new Label() { Content = "Font", HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Center }; Grid grid_radioButtons = new Grid(); grid_radioButtons.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_radioButtons.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_radioButtons.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_radioButtons.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) }); grid_radioButtons.SetRowColumn(m_radioButton_animation, 0, 0); grid_radioButtons.SetRowColumn(label_radioButton_animation, 0, 1); grid_radioButtons.SetRowColumn(m_radioButton_font, 1, 0); grid_radioButtons.SetRowColumn(label_radioButton_font, 1, 1); MultiValidatorPanel validator_radioButtons = new MultiValidatorPanel(grid_radioButtons, new[] { m_radioButton_animation, m_radioButton_font }, RadioButton.IsCheckedProperty, new Validate_True(), MultiValidatorPanel.ValidationAggregationType.Or); m_groupBox_type = new GroupBox() { Header = "Type", Content = validator_radioButtons }; grid_main.SetRowColumn(m_groupBox_type, 5, 0); if (GraphicsInstanceDefinitionType != GraphicsInstanceDefinition_WithAnimationStateDefinitions.GraphicsInstanceDefinitionType.Undetermined) { switch (GraphicsInstanceDefinitionType) { case GraphicsInstanceDefinition_WithAnimationStateDefinitions.GraphicsInstanceDefinitionType.Animation: m_radioButton_animation.IsChecked = true; break; case GraphicsInstanceDefinition_WithAnimationStateDefinitions.GraphicsInstanceDefinitionType.Font: m_radioButton_font.IsChecked = true; break; } m_groupBox_type.IsEnabled = false; } //////// // FIN ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] { validator_name, validator_entityInstanceDefinition, validator_zOrder, validator_renderPass, validator_radioButtons }}; }
protected override void SetThisContent() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); //////// // Id m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center, Text = (m_behaviorInstanceDefinition != null) ? m_behaviorInstanceDefinition.Id.ToString() : "N/A" }; Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_id = new Grid(); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.SetRowColumn(m_textBlock_id, 0, 1); grid_id.SetRowColumn(label_id, 0, 0); grid_main.SetRowColumn(grid_id, 0, 0); //////// // Name m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_name = new Grid(); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.SetRowColumn(validator_name, 1, 0); grid_name.SetRowColumn(label_name, 0, 0); grid_main.SetRowColumn(grid_name, 1, 0); //////// // EntityInstanceDefinition CollectionViewSource collectionViewSource_entityInstanceDefinition = new CollectionViewSource() { Source = DataManager.EntityInstanceDefinitions }; m_comboBox_entityInstanceDefinition = new ComboBox() { DisplayMemberPath = "Name", IsTextSearchEnabled = true }; m_comboBox_entityInstanceDefinition.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_entityInstanceDefinition }); ValidatorPanel validator_entityInstanceDefinition = new ValidatorPanel(m_comboBox_entityInstanceDefinition, ComboBox.SelectedItemProperty, new Validate_NotNull()); Label label_entityInstanceDefinition = new Label() { Content = "Entity Instance: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_entityInstanceDefinition = new Grid(); grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_entityInstanceDefinition.SetRowColumn(validator_entityInstanceDefinition, 1, 0); grid_entityInstanceDefinition.SetRowColumn(label_entityInstanceDefinition, 0, 0); grid_main.SetRowColumn(grid_entityInstanceDefinition, 2, 0); //////// // Behavior File Button button_behaviorFile = new Button() { Content = " ... " }; button_behaviorFile.Click += (x, y) => { SelectBehaviorFile(); }; m_textBox_behaviorFile = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_behaviorFile = new ValidatorPanel(m_textBox_behaviorFile, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_behaviorFile = new Label() { Content = "Behavior File: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_behaviorFile = new Grid(); grid_behaviorFile.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_behaviorFile.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_behaviorFile.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) }); grid_behaviorFile.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_behaviorFile.SetRowColumn(button_behaviorFile, 1, 1); grid_behaviorFile.SetRowColumn(validator_behaviorFile, 1, 0); Grid.SetColumnSpan(label_behaviorFile, 2); grid_behaviorFile.SetRowColumn(label_behaviorFile, 0, 0); grid_main.SetRowColumn(grid_behaviorFile, 3, 0); //////// // Behavior Constructor m_textBlock_behaviorConstructor = new TextBlock() { VerticalAlignment = VerticalAlignment.Center }; Label label_behaviorConstructor = new Label() { Content = "Behavior Constructor: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_behaviorConstructor = new ValidatorPanel(m_textBlock_behaviorConstructor, TextBlock.TextProperty, new Validate_StringIsNotNullOrEmpty()); Grid grid_behaviorConstructor = new Grid(); grid_behaviorConstructor.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_behaviorConstructor.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_behaviorConstructor.SetRowColumn(validator_behaviorConstructor, 1, 0); grid_behaviorConstructor.SetRowColumn(label_behaviorConstructor, 0, 0); grid_main.SetRowColumn(grid_behaviorConstructor, 4, 0); //////// // FIN ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] { validator_name, validator_entityInstanceDefinition, validator_behaviorFile, validator_behaviorConstructor }}; }
protected override void SetThisContent() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); //////// // BoundingData Grid grid_sub = new Grid(); grid_sub.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(30.0, GridUnitType.Star) }); grid_sub.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(70.0, GridUnitType.Star) }); grid_main.SetRowColumn(grid_sub, 5, 0); m_grid_subSub = new Grid(); grid_sub.SetRowColumn(m_grid_subSub, 0, 0); m_image = new Image() { Stretch = System.Windows.Media.Stretch.None }; m_canvasWithRectangle = new UserControl_CanvasWithRectangle(new[] { m_image }) { Width = 500, Height = 500 }; grid_sub.SetRowColumn(m_canvasWithRectangle, 0, 1); m_canvasWithRectangle.SizableRectangle.Width = m_canvasWithRectangle.SizableRectangle.Height = c_defaultWidthHeight; //////// // Id m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center }; Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_id = new Grid(); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.SetRowColumn(m_textBlock_id, 0, 1); grid_id.SetRowColumn(label_id, 0, 0); grid_main.SetRowColumn(grid_id, 0, 0); //////// // Name m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty()); Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_name = new Grid(); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_name.SetRowColumn(validator_name, 1, 0); grid_name.SetRowColumn(label_name, 0, 0); grid_main.SetRowColumn(grid_name, 1, 0); //////// // EntityInstanceDefinition CollectionViewSource collectionViewSource_entityInstanceDefinition = new CollectionViewSource() { Source = DataManager.EntityInstanceDefinitions }; m_comboBox_entityInstanceDefinition = new ComboBox() { DisplayMemberPath = "Name", IsTextSearchEnabled = true }; m_comboBox_entityInstanceDefinition.SelectionChanged += ComboBox_EntityInstanceDefinition_SelectionChanged; m_comboBox_entityInstanceDefinition.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_entityInstanceDefinition }); ValidatorPanel validator_entityInstanceDefinition = new ValidatorPanel(m_comboBox_entityInstanceDefinition, ComboBox.SelectedItemProperty, new Validate_NotNull()); Label label_entityInstanceDefinition = new Label() { Content = "Entity Instance: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_entityInstanceDefinition = new Grid(); grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_entityInstanceDefinition.SetRowColumn(validator_entityInstanceDefinition, 1, 0); grid_entityInstanceDefinition.SetRowColumn(label_entityInstanceDefinition, 0, 0); grid_main.SetRowColumn(grid_entityInstanceDefinition, 2, 0); //////// // CollisionType CollectionViewSource collectionViewSource_collisionType = new CollectionViewSource() { Source = DataManager.CollisionTypes }; m_comboBox_collisionType = new ComboBox() { DisplayMemberPath = "Name", IsTextSearchEnabled = true }; m_comboBox_collisionType.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_collisionType }); ValidatorPanel validator_collisionType = new ValidatorPanel(m_comboBox_collisionType, ComboBox.SelectedItemProperty, new Validate_NotNull()); Label label_collisionType = new Label() { Content = "Collision Type: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_collisionType = new Grid(); grid_collisionType.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_collisionType.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_collisionType.SetRowColumn(validator_collisionType, 1, 0); grid_collisionType.SetRowColumn(label_collisionType, 0, 0); grid_main.SetRowColumn(grid_collisionType, 3, 0); //////// // PhysType CollectionViewSource collectionViewSource_physType = new CollectionViewSource() { Source = DataManager.PhysTypes }; m_comboBox_physType = new ComboBox() { DisplayMemberPath = "Name", IsTextSearchEnabled = true }; m_comboBox_physType.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_physType }); m_comboBox_physType.SelectionChanged += ComboBox_PhysType_SelectionChanged; ValidatorPanel validator_physType = new ValidatorPanel(m_comboBox_physType, ComboBox.SelectedItemProperty, new Validate_NotNull()); Label label_physType = new Label() { Content = "Phys Type: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; Grid grid_physType = new Grid(); grid_physType.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_physType.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_physType.SetRowColumn(validator_physType, 1, 0); grid_physType.SetRowColumn(label_physType, 0, 0); grid_main.SetRowColumn(grid_physType, 4, 0); //////// // FIN ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] { validator_name, validator_entityInstanceDefinition, validator_collisionType, validator_physType }}; }