Exemple #1
0
 private static UIElement e_23_Col3_ct_dtMethod(UIElement parent)
 {
     // e_25 element
     StackPanel e_25 = new StackPanel();
     e_25.Parent = parent;
     e_25.Name = "e_25";
     // e_26 element
     TextBlock e_26 = new TextBlock();
     e_25.Children.Add(e_26);
     e_26.Name = "e_26";
     Binding binding_e_26_Text = new Binding("Text");
     e_26.SetBinding(TextBlock.TextProperty, binding_e_26_Text);
     // e_27 element
     StackPanel e_27 = new StackPanel();
     e_25.Children.Add(e_27);
     e_27.Name = "e_27";
     e_27.Orientation = Orientation.Horizontal;
     // e_28 element
     TextBlock e_28 = new TextBlock();
     e_27.Children.Add(e_28);
     e_28.Name = "e_28";
     Binding binding_e_28_Text = new Binding("Boolean");
     e_28.SetBinding(TextBlock.TextProperty, binding_e_28_Text);
     // e_29 element
     TextBlock e_29 = new TextBlock();
     e_27.Children.Add(e_29);
     e_29.Name = "e_29";
     Binding binding_e_29_Text = new Binding("Number");
     e_29.SetBinding(TextBlock.TextProperty, binding_e_29_Text);
     return e_25;
 }
 private static UIElement r_11_dtMethod(UIElement parent)
 {
     // e_69 element
     Border e_69 = new Border();
     e_69.Parent = parent;
     e_69.Name = "e_69";
     e_69.Background = new SolidColorBrush(new ColorW(0, 0, 255, 255));
     // e_70 element
     StackPanel e_70 = new StackPanel();
     e_69.Child = e_70;
     e_70.Name = "e_70";
     // e_71 element
     TextBlock e_71 = new TextBlock();
     e_70.Children.Add(e_71);
     e_71.Name = "e_71";
     e_71.HorizontalAlignment = HorizontalAlignment.Center;
     e_71.VerticalAlignment = VerticalAlignment.Center;
     Binding binding_e_71_Text = new Binding("TextData");
     e_71.SetBinding(TextBlock.TextProperty, binding_e_71_Text);
     // e_72 element
     Button e_72 = new Button();
     e_70.Children.Add(e_72);
     e_72.Name = "e_72";
     e_72.Content = "Hide Window";
     Binding binding_e_72_Command = new Binding("HideCommand");
     e_72.SetBinding(Button.CommandProperty, binding_e_72_Command);
     return e_69;
 }
 private static UIElement e_28_Col3_ct_dtMethod(UIElement parent)
 {
     // e_30 element
     StackPanel e_30 = new StackPanel();
     e_30.Parent = parent;
     e_30.Name = "e_30";
     // e_31 element
     TextBlock e_31 = new TextBlock();
     e_30.Children.Add(e_31);
     e_31.Name = "e_31";
     Binding binding_e_31_Text = new Binding("Text");
     e_31.SetBinding(TextBlock.TextProperty, binding_e_31_Text);
     // e_32 element
     StackPanel e_32 = new StackPanel();
     e_30.Children.Add(e_32);
     e_32.Name = "e_32";
     e_32.Orientation = Orientation.Horizontal;
     // e_33 element
     TextBlock e_33 = new TextBlock();
     e_32.Children.Add(e_33);
     e_33.Name = "e_33";
     Binding binding_e_33_Text = new Binding("Boolean");
     e_33.SetBinding(TextBlock.TextProperty, binding_e_33_Text);
     // e_34 element
     TextBlock e_34 = new TextBlock();
     e_32.Children.Add(e_34);
     e_34.Name = "e_34";
     Binding binding_e_34_Text = new Binding("Number");
     e_34.SetBinding(TextBlock.TextProperty, binding_e_34_Text);
     return e_30;
 }
Exemple #4
0
 private void SetupControl(ILogicalKey key)
 {
     _keyText?.SetBinding(TextBlock.TextProperty, new Binding("DisplayName")
     {
         Source = key
     });
     key.PropertyChanged   += Key_PropertyChanged;
     key.LogicalKeyPressed += Key_VirtualKeyPressed;
 }
Exemple #5
0
 private static UIElement combo_dtMethod(UIElement parent)
 {
     // e_4 element
     TextBlock e_4 = new TextBlock();
     e_4.Parent = parent;
     e_4.Name = "e_4";
     e_4.Margin = new Thickness(2F, 2F, 2F, 2F);
     e_4.HorizontalAlignment = HorizontalAlignment.Center;
     Binding binding_e_4_Text = new Binding("Name");
     e_4.SetBinding(TextBlock.TextProperty, binding_e_4_Text);
     return e_4;
 }
Exemple #6
0
        private FrameworkElement BuildRegisterContent(CodeRegister register)
        {
            var textBlock = new TextBlock()
            {
                Text = register.ToString().ToLower()
            };

            var binding = new Binding("DebuggerTextFormat.Register")
            {
                Source = this, Mode = BindingMode.OneWay
            };

            textBlock.SetBinding(TextBlock.ForegroundProperty, binding);

            return(textBlock);
        }
        public DefaultItem()
        {
            Background = new SolidColorBrush(new Color {
                A = 0, R = 0, G = 0, B = 0
            });

            ContentPresenter contentPresenter = new ContentPresenter();
            TextBlock        textBlock        = new TextBlock();

            Children.Add(contentPresenter);
            contentPresenter.Content = textBlock;

            Binding c = new Binding();

            textBlock.SetBinding(TextBlock.TextProperty, c);
        }
        public AccountItemViewer()
        {
            this.InitializeComponent();
            TiltEffect.SetIsTiltEnabled(this, true);
            this.accountItemViewModel = ViewModelLocator.AccountItemViewModel;
            base.Loaded += new RoutedEventHandler(this.AccountItemViewer_Loaded);
            this.NeedReloadData = true;
            this.accountItemViewerViewModel = new AccountItemViewerViewModel();

            this.RelatedItemsPivot.DataContext = this;

            var textTitle = new TextBlock();
            textTitle.SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("CreateDateInfo"));
            textTitle.Tap += textTitle_Tap;
            MainPivot.Title = textTitle;
        }
        public static void AddVerticalLabelGroup(string header, string name, StackPanel stack, bool boldHeader = false)
        {
            //i think we need this.
            TextBlock thisLabel = GetDefaultLabel();

            thisLabel.Text = $"{header}:";
            if (boldHeader == true)
            {
                thisLabel.FontWeight = FontWeights.Bold;
            }
            stack.Children.Add(thisLabel);
            thisLabel = GetDefaultLabel();
            thisLabel.SetBinding(TextBlock.TextProperty, new Binding(name)); //i guess can do old fashioned here too.
            thisLabel.TextWrapping = TextWrapping.Wrap;
            stack.Children.Add(thisLabel);
        }
Exemple #10
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _keySurface       = Template.FindName(ElementSurface, this) as Border;
            _mouseDownSurface = Template.FindName(ElementMouseDownSurface, this) as Border;
            _keyText          = Template.FindName(ElementKeyText, this) as TextBlock;

            _keySurfaceBorderBrush = _keySurface?.BorderBrush;
            _keySurfaceBackground  = _keySurface?.Background;
            _keyTextBrush          = _keyText?.Foreground;
            _keyText?.SetBinding(TextBlock.TextProperty, new Binding("DisplayName")
            {
                Source = this.Key
            });
        }
        public void CreateModel(Block block)
        {
            #region internal elements
            var rect = new Rectangle
            {
                Fill             = Brushes.White,
                Stroke           = Brushes.Black,
                IsHitTestVisible = false
            };

            var blockTitle = new TextBlock()
            {
                Text                = "<<Block>>",
                IsHitTestVisible    = false,
                FontSize            = 10,
                FontStyle           = FontStyles.Oblique,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            var blockName = new TextBlock
            {
                IsHitTestVisible    = false,
                FontSize            = 11,
                HorizontalAlignment = HorizontalAlignment.Center
            };
            var nameBind = new Binding
            {
                Source = block,
                Path   = new PropertyPath("Name"),
                Mode   = BindingMode.OneWay
            };
            blockName.SetBinding(TextBlock.TextProperty, nameBind);
            #endregion

            var stack = new StackPanel
            {
                Orientation = Orientation.Vertical
            };
            stack.Children.Add(blockTitle);
            stack.Children.Add(blockName);

            var grid = new Grid();
            grid.Children.Add(rect);
            grid.Children.Add(stack);

            CreateModel(block, grid);
        }
        public void CreateTabFor(string header, ImageSource icon, bool allowDelete, IViewPlugin viewPlugin, UIElement viewElement, object dataInstance, WellKnownView view, bool select)
        {
            // If allowdelete = false, we also hide the header
            var newTab = new TabItem {
                Header = header, Icon = icon, AllowDelete = allowDelete, ShowHeader = allowDelete, Tag = viewPlugin, WellKnownView = view
            };

            if (viewElement != null)
            {
                newTab.Content = viewElement;
            }

            if (newTab.Content is IControllableTab)
            {
                IControllableTab tab = (IControllableTab)newTab.Content;

                // Create a textblock and bind it to the header property of the tab slave
                TextBlock tb = new TextBlock();
                tb.SetBinding(TextBlock.TextProperty, new Binding("Title")
                {
                    Source = tab
                });

                newTab.Header = tb;

                // Attach the RequestCloseTab event
                tab.RequestCloseTab += delegate { TabHost.RemoveItem(newTab); };

                TabHost.HeaderContent = tab.CustomHeaderContent;
            }

            if (newTab.Content is IPersistableTab)
            {
                Debug.Assert(dataInstance != null, "Data instance can not be null");

                IPersistableTab tab = (IPersistableTab)newTab.Content;

                tab.LoadData(dataInstance);
            }

            TabHost.Items.Add(newTab);

            if (select)
            {
                TabHost.SelectedItem = newTab;
            }
        }
Exemple #13
0
        private void ReSetupParams(int cid, ref Dictionary <string, Dictionary <string, decimal> > @params, UIElementCollection panel)
        {
            foreach (var param in @params)
            {
                StackPanel sp = new StackPanel();
                Label      lb = new Label();
                TextBlock  tb = new TextBlock();

                sp.Orientation = Orientation.Vertical;
                sp.Margin      = new Thickness(2, 0, 2, 2);
                sp.Background  = new SolidColorBrush(Color.FromArgb(0xff, 253, 252, 227));

                // パラメタ名
                lb.HorizontalAlignment = HorizontalAlignment.Left;
                lb.Content             = param.Key;

                // スライダー
                Slider sl = new Slider();
                sl.Name                = param.Key;
                sl.Width               = 100;
                sl.Minimum             = Convert.ToDouble(param.Value["min"]);
                sl.Maximum             = Convert.ToDouble(param.Value["max"]);
                sl.SelectionStart      = Convert.ToDouble(param.Value["min"]);
                sl.SelectionEnd        = Convert.ToDouble(param.Value["max"]);
                sl.Value               = Convert.ToDouble(param.Value["value"]);
                sl.TickFrequency       = Convert.ToDouble(param.Value["step"]);
                sl.LargeChange         = Convert.ToDouble(param.Value["step"]);
                sl.SmallChange         = Convert.ToDouble(param.Value["step"]);
                sl.IsSnapToTickEnabled = true;

                sl.ValueChanged += (sender, args) => {
                    param.Value["value"] = Convert.ToDecimal(sl.Value);
                };

                // 数値(表示)
                Binding myBinding = new Binding("Value");
                myBinding.Source = sl;
                tb.SetBinding(TextBlock.TextProperty, myBinding);
                tb.HorizontalAlignment = HorizontalAlignment.Center;

                sp.Children.Add(lb);
                sp.Children.Add(sl);
                sp.Children.Add(tb);

                panel.Add(sp);
            }
        }
        private AccordionItem addDetailControl(IUserDetailControl detailControl)
        {
            AccordionItem band = new AccordionItem();

            band.HorizontalContentAlignment = HorizontalAlignment.Stretch;
            band.VerticalContentAlignment   = VerticalAlignment.Stretch;

            //Bug fixing: MEF tworzy singletony i po pierwszym dodaniu kontroki jako dziecko parenta przy drugim mamy wyjątek dlatego trzeba odłączyc od starego
            FrameworkElement element = detailControl as FrameworkElement;

            if (element != null && element.Parent != null)
            {
                ((ContentControl)element.Parent).Content = null;
                element.Tag = band;
            }
            //band.Text = detailControl.Caption;

            band.Tag         = detailControl;
            band.DataContext = detailControl;
            band.Content     = detailControl;

            StackPanel panel = new StackPanel();

            panel.Orientation = Orientation.Horizontal;
            Image img = new Image();

            img.Source = detailControl.SmallImage;
            img.Width  = img.Height = 16;
            panel.Children.Add(img);
            TextBlock textBlock = new TextBlock();
            Binding   result    = new Binding("Caption");

            result.Source = detailControl;
            textBlock.SetBinding(TextBlock.TextProperty, result);

            textBlock.Style = (Style)this.FindResource("accordionHeaderText");
            panel.Children.Add(textBlock);
            band.Header = panel;

            //band.LargeImage = detailControl.SmallImage;
            //band.SmallImage = detailControl.SmallImage;
            //Control ctrl = (Control)detailControl;
            //ctrl.Dock = DockStyle.Fill;
            //band.ClientArea.Controls.Add(ctrl);
            //naviBar1.Controls.Add(band);))
            return(band);
        }
        private static UIElement r_3_dtMethod(UIElement parent)
        {
            // e_2 element
            Border e_2 = new Border();

            e_2.Parent     = parent;
            e_2.Name       = "e_2";
            e_2.Background = new SolidColorBrush(new ColorW(0, 0, 255, 255));
            // e_3 element
            StackPanel e_3 = new StackPanel();

            e_2.Child = e_3;
            e_3.Name  = "e_3";
            // e_4 element
            TextBlock e_4 = new TextBlock();

            e_3.Children.Add(e_4);
            e_4.Name = "e_4";
            e_4.HorizontalAlignment = HorizontalAlignment.Center;
            e_4.VerticalAlignment   = VerticalAlignment.Center;
            Binding binding_e_4_Text = new Binding("TextData");

            binding_e_4_Text.UseGeneratedBindings = true;
            e_4.SetBinding(TextBlock.TextProperty, binding_e_4_Text);
            // e_5 element
            TextBlock e_5 = new TextBlock();

            e_3.Children.Add(e_5);
            e_5.Name = "e_5";
            e_5.HorizontalAlignment = HorizontalAlignment.Center;
            e_5.VerticalAlignment   = VerticalAlignment.Center;
            Binding binding_e_5_Text = new Binding("ManualBinding");

            binding_e_5_Text.UseGeneratedBindings = true;
            e_5.SetBinding(TextBlock.TextProperty, binding_e_5_Text);
            // e_6 element
            Button e_6 = new Button();

            e_3.Children.Add(e_6);
            e_6.Name    = "e_6";
            e_6.Content = "Hide Window";
            Binding binding_e_6_Command = new Binding("HideCommand");

            binding_e_6_Command.UseGeneratedBindings = true;
            e_6.SetBinding(Button.CommandProperty, binding_e_6_Command);
            return(e_2);
        }
Exemple #16
0
        private void SetupControl(ILogicalKey key)
        {
            CornerRadius        = new CornerRadius(3);
            BorderBrush         = _keyOutsideBorderBrush;
            BorderThickness     = new Thickness(1);
            SnapsToDevicePixels = true;

            var g = new Grid();

            Child = g;

            _keySurface = new Border
            {
                CornerRadius        = new CornerRadius(3),
                BorderBrush         = _keySurfaceBorderBrush,
                BorderThickness     = new Thickness(1),
                Background          = _keySurfaceBrush,
                SnapsToDevicePixels = true
            };
            g.Children.Add(_keySurface);

            _mouseDownSurface = new Border
            {
                CornerRadius        = new CornerRadius(3),
                Background          = Brushes.White,
                Opacity             = 0,
                SnapsToDevicePixels = true
            };
            g.Children.Add(_mouseDownSurface);

            _keyText = new TextBlock
            {
                FontSize            = 20,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Foreground          = Brushes.White,
                SnapsToDevicePixels = true
            };
            _keyText.SetBinding(TextBlock.TextProperty, new Binding("DisplayName")
            {
                Source = key
            });
            g.Children.Add(_keyText);

            key.PropertyChanged   += Key_PropertyChanged;
            key.LogicalKeyPressed += Key_VirtualKeyPressed;
        }
Exemple #17
0
        private static TextBlock createDataLabel(string bindingPath, IValueConverter converter, object converterParam)
        {
            TextBlock element = new TextBlock();

            element.SetResourceReference(TextBlock.StyleProperty, "DynamicData");

            if (!String.IsNullOrEmpty(bindingPath))
            {
                Binding binding = new Binding(bindingPath);
                binding.Mode               = BindingMode.OneWay;
                binding.Converter          = converter;
                binding.ConverterParameter = converterParam;
                element.SetBinding(TextBlock.TextProperty, binding);
            }

            return(element);
        }
        public void Init()
        {
            if (ThisSpace == null)
            {
                throw new BasicBlankException("Must send in the space");
            }
            _mainGame = Resolve <BingoMainGameClass>();
            _thisDraw = new SKElement();
            _thisDraw.PaintSurface    += ThisDraw_PaintSurface;
            ThisSpace.PropertyChanged += ThisSpace_PropertyChanged;
            Width            = 100;
            CommandParameter = ThisSpace;
            Height           = 100;
            Name             = nameof(BingoMainViewModel.SelectSpace);
            GamePackageViewModelBinder.ManuelElements.Add(this);
            Grid thisGrid = new Grid();

            thisGrid.Children.Add(_thisDraw);
            TextBlock thisLabel = new TextBlock();

            thisLabel.HorizontalAlignment = HorizontalAlignment.Center;
            thisLabel.VerticalAlignment   = VerticalAlignment.Center; // needs to stretch for background.
            thisLabel.TextAlignment       = TextAlignment.Center;     // will be centered for drawing text (hopefully this work)
            thisLabel.FontWeight          = FontWeights.Bold;
            if (ThisSpace.IsEnabled == false)
            {
                thisLabel.Foreground = Brushes.White;
                thisLabel.FontSize   = 40;
            }
            else
            {
                thisLabel.Foreground = Brushes.Black; // otherwise, can't do the other part.
                if (ThisSpace.Text == "Free")
                {
                    thisLabel.FontSize = 34;
                }
                else
                {
                    thisLabel.FontSize = 45;
                }
            }
            thisLabel.DataContext = ThisSpace; // i think
            thisLabel.SetBinding(TextBlock.TextProperty, new Binding(nameof(SpaceInfoCP.Text)));
            thisGrid.Children.Add(thisLabel);
            Content = thisGrid;
        }
Exemple #19
0
        /// <summary>
        /// 添加日志
        /// </summary>
        /// <param name="log"></param>
        /// <param name="level">1显示绿色,2显示红色,3黄色</param>
        public void AddLogs(string log, LogLevel level)
        {
            TextBlock textBlock = new TextBlock {
                Text       = DateTime.Now.ToLongTimeString() + ":" + log,
                Background = Brushes.White
            };

            switch (level)
            {
            case LogLevel.Info:
                textBlock.Background = Brushes.White;
                break;

            case LogLevel.Error:
                textBlock.Background = Brushes.Red;
                break;

            case LogLevel.Warning:
                textBlock.Background = Brushes.Yellow;
                break;

            case LogLevel.Success:
                textBlock.Background = Brushes.LightGreen;
                break;

            case LogLevel.Exception:
                textBlock.Background = Brushes.Red;
                break;

            default:
                textBlock.Background = Brushes.White;
                break;
            }
            textBlock.SetBinding(TextBlock.MaxWidthProperty, new Binding("ActualWidth")
            {
                Source = this
            });
            textBlock.TextWrapping = TextWrapping.Wrap;
            this.list_Log.Items.Add(textBlock);
            this.list_Log.SelectedIndex = this.list_Log.Items.Count - 1;
            this.list_Log.ScrollIntoView(this.list_Log.SelectedItem);
            if (list_Log.Items.Count > 50)
            {
                list_Log.Items.RemoveAt(0);
            }
        }
        public UIBoundToCustomerWithStyleAndMultiTriggers()
        {
            var stack = new StackPanel();

            Content = stack;

            var textBlock = new TextBlock();

            textBlock.SetBinding(TextBlock.TextProperty, new Binding("FirstName"));
            stack.Children.Add(textBlock);

            textBlock = new TextBlock();
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("LastName"));
            textBlock.Style = CreateStyle();

            stack.Children.Add(textBlock);
        }
        private void InitializeStatusBar()
        {
            var textBlock = new TextBlock
            {
                DataContext         = DataContext,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Right
            };

            textBlock.SetBinding(TextBlock.TextProperty,
                                 new Binding("EntriesViewModel.View.Count")
            {
                Mode = BindingMode.OneWay
            });

            ViewManager.RightStatusBarContent = textBlock;
        }
Exemple #22
0
        public static Grid GetPlayerIcon(PvPPlayer player)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }

            var nameBinding = new Binding("Name")
            {
                Source = player,
            };

            var heightBinding = new Binding("ActualHeight")
            {
                RelativeSource = RelativeSource.Self,
            };

            var grid = new Grid();

            grid.SetBinding(Grid.WidthProperty, heightBinding);

            var ellipse = new Ellipse()
            {
                Fill    = player.IdentityColor,
                Stretch = Stretch.Uniform,
            };

            ellipse.SetBinding(Ellipse.HeightProperty, heightBinding);

            grid.Children.Add(ellipse);

            var nameView = new Viewbox()
            {
                Margin = new Thickness(2),
            };
            var nameTextBlock = new TextBlock()
            {
                Foreground = Brushes.White,
            };

            nameTextBlock.SetBinding(TextBlock.TextProperty, nameBinding);
            nameView.Child = nameTextBlock;
            grid.Children.Add(nameView);

            return(grid);
        }
        private TextBlock GenerateLabelPropertyName(PropertyInfo property)
        {
            try
            {
                var label             = new TextBlock();
                var foregroundBinding = new Binding();
                foregroundBinding.Source = this;
                foregroundBinding.Mode   = BindingMode.TwoWay;
                foregroundBinding.Path   = new PropertyPath("ForegroundText");
                label.SetBinding(TextBlock.ForegroundProperty, foregroundBinding);
                label.FontSize   = this.LabelFontSize;
                label.FontWeight = this.LabelFontWeight;
                var displayAttribute = Helpers.AttributeHelper <DisplayAttribute> .GetAttributeValue(property);

                if (displayAttribute != null)
                {
                    label.Text = displayAttribute.Label;
                }
                else
                {
                    label.Text = property.Name;
                }

                return(label);
            }
            catch (Exception ex)
            {
            }
            return(null);
            //var binding = new Binding();
            //if (parentProperty != null)
            //{
            //    binding.Path = new PropertyPath(parentProperty.Name + "." + property.Name);
            //    num.Name = parentProperty.Name + "_" + property.Name;
            //}
            //else
            //{
            //    binding.Path = new PropertyPath(property.Name);
            //    num.Name = property.Name;
            //}
            //binding.Source = this.DataContext;
            //binding.Mode = BindingMode.TwoWay;
            //// binding.NotifyOnValidationError = true;
            //binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            //num.SetBinding(NumericUpDown.ValueProperty, binding);
        }
Exemple #24
0
        /// <summary>
        /// Generate a label centered on a line segment.
        /// </summary>
        /// <param name="mg">
        /// The mg.
        /// </param>
        /// <param name="labels">
        /// The labels.
        /// </param>
        /// <param name="pointStart">
        /// The point start.
        /// </param>
        /// <param name="pointEnd">
        /// The point end.
        /// </param>
        /// <param name="origin">
        /// The origin.
        /// </param>
        /// <returns>
        /// A label (as a TextBlock) to be added to the graphic.
        /// </returns>
        public static TextBlock GenerateCenteredLabel(
            MilGraphic mg, string[] labels, Point pointStart, Point pointEnd, Point origin)
        {
            bool            leftSide;
            MatrixTransform mt = GenerateLabelTransform(pointStart, pointEnd, origin, out leftSide);
            var             tb = new TextBlock
            {
                Style           = SymbolData.GetStyle("BT20"),
                RenderTransform = mt,
                Foreground      = mg.ContentControl.Brush,
                Name            = "Skip" + counter++
            };

            tb.SetBinding(UIElement.VisibilityProperty,
                          new Binding {
                Source = mg.TextVisibility, Mode = BindingMode.OneWay
            });

            var count = labels.Length;

            for (int i = 0; i < count; i++)
            {
                tb.Inlines.Add(new Run {
                    Text = labels[i]
                });
                if (i < count - 1)
                {
                    tb.Inlines.Add(new LineBreak());
                }
            }

            tb.FindTextExtent();
            double left = leftSide ? tb.Width : 0.0;

            // if (left != 0.0)
            if (Math.Abs(left) > double.Epsilon)
            {
                tb.TextAlignment = TextAlignment.Right;
            }

            Point p = mt.Matrix.Rotate(new Point(tb.Height / 2.0, left));

            tb.SetValue(Canvas.TopProperty, pointStart.Y - p.X);
            tb.SetValue(Canvas.LeftProperty, pointStart.X - p.Y);
            return(tb);
        }
        private Grid InitToolTip(List <YuMiBaoZiModel> model, Series col)
        {
            Grid       grid     = new Grid();
            StackPanel verStack = new StackPanel();

            verStack.Orientation = Orientation.Vertical;
            StackPanel horStack = new StackPanel();

            horStack.Orientation = Orientation.Horizontal;
            StackPanel stackBlock = new StackPanel();
            TextBlock  xBlock     = new TextBlock();

            xBlock.SetBinding(TextBlock.TextProperty, new Binding()
            {
                Path = new PropertyPath("Item.xLabel")
            });
            TextBlock yBlock = new TextBlock();

            yBlock.SetBinding(TextBlock.TextProperty, new Binding()
            {
                Path = new PropertyPath("Item.canShuName")
            });
            stackBlock.Children.Add(xBlock);
            stackBlock.Children.Add(yBlock);
            StackPanel stackText = new StackPanel();
            TextBlock  xText     = new TextBlock();

            xText.SetBinding(TextBlock.TextProperty, new Binding()
            {
                Path = new PropertyPath("Item.xData")
            });
            TextBlock yText = new TextBlock();

            yText.SetBinding(TextBlock.TextProperty, new Binding()
            {
                Path = new PropertyPath("Item.yData")
            });
            stackText.Children.Add(xText);
            stackText.Children.Add(yText);

            horStack.Children.Add(stackBlock);
            horStack.Children.Add(stackText);
            verStack.Children.Add(horStack);
            grid.Children.Add(verStack);
            return(grid);
        }
        public UIWithPrioritybindingToStyle()
        {
            var stack = new StackPanel();

            Content = stack;

            var textBlock = new TextBlock();

            textBlock.SetBinding(TextBlock.TextProperty, new Binding("FirstName"));
            stack.Children.Add(textBlock);

            textBlock = new TextBlock();
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("LastName"));
            textBlock.Style = CreateStyle();

            stack.Children.Add(textBlock);
        }
Exemple #27
0
        public void showParsing(int start)
        {
            if ((spisok == null) || (spisok.Count == 0))
            {
                return;
            }

            Parsing parsing = spisok[start];

            current = start;

            lbNomer.Text    = parsing.Nomer;
            lbData.Text     = parsing.Data;
            lbPreparat.Text = parsing.Preparat;
            lbProducer.Text = parsing.Producer;
            tbProtokol.Text = parsing.Protokol;
            lbPacient.Text  = parsing.Pacient;
            lbAddress.Text  = parsing.Address;
            lbDuration.Text = parsing.Duration;
            lbForma.Text    = parsing.Forma;

            // для ширины поля
            Binding bind = new Binding();

            bind.Source    = this;
            bind.Path      = new PropertyPath("ActualWidth");
            bind.Mode      = BindingMode.OneWay;
            bind.Converter = new MyConverter();

            int n = 1;

            boxBases.Items.Clear();
            foreach (string b in parsing.Bases)
            {
                TextBlock tb;
                tb = new TextBlock();
                tb.TextWrapping = TextWrapping.Wrap;
                tb.SetBinding(TextBlock.WidthProperty, bind);
                tb.Margin = new Thickness(4);
                string nomer = string.Format("{0}. ", n);
                tb.Inlines.Add(new Bold(new Run(nomer)));
                tb.Inlines.Add(b);
                boxBases.Items.Add(tb);
                n++;
            }
        }
Exemple #28
0
        public void AddFieldTextBlockToPanel(StackPanel theSP, int planNum, int fldNum, int width, string idText, object curFieldProp)
        {
            TextBlock newTb = new TextBlock();

            newTb.Width         = width;
            newTb.Name          = "p" + planNum + "_f" + fldNum + "_" + idText;
            newTb.TextAlignment = TextAlignment.Center;
            newTb.FontSize      = 12;
            theSP.Children.Add(newTb);

            Binding b = new Binding(idText);

            b.Source       = curFieldProp;
            b.Mode         = BindingMode.OneWay;
            b.StringFormat = "{0:N1}";
            newTb.SetBinding(TextBlock.TextProperty, b);
        }
Exemple #29
0
        public void ForceSourceToNull()
        {
            Person source = new Person {
                Age = 7
            };
            TextBlock block = new TextBlock();

            block.SetBinding(TextBlock.TextProperty, new Binding {
                Path            = new PropertyPath("Age"),
                Mode            = BindingMode.TwoWay,
                TargetNullValue = "",
            });

            block.DataContext = source;
            block.Text        = "";
            Assert.IsNull(source.Age, "#1");
        }
Exemple #30
0
        protected override void InitializeComponents()
        {
            Border border = new Border();

            border.Background = new SolidColorBrush(new ColorW(0, 0, 0, 128));
            this.Content      = border;

            StackPanel panel = new StackPanel();

            panel.Orientation = Orientation.Horizontal;
            border.Child      = panel;

            Border blank = new Border();

            blank.SetBinding(Border.VisibilityProperty, new Binding(IsShortModeProperty)
            {
                Source = this, Converter = UIHelper.CreateConverter((bool o) => o ? Visibility.Visible : Visibility.Collapsed)
            });
            blank.SetBinding(Border.WidthProperty, new Binding(PaddingLeftProperty)
            {
                Source = this
            });
            blank.SetBinding(Border.HeightProperty, new Binding(HeightProperty)
            {
                Source = this
            });
            panel.Children.Add(blank);

            TextBlock textBlock = new TextBlock();

            textBlock.Foreground          = Brushes.Cyan;
            textBlock.Margin              = new Thickness(6, 0, 0, 0);
            textBlock.HorizontalAlignment = HorizontalAlignment.Left;
            textBlock.VerticalAlignment   = VerticalAlignment.Center;

            textBlock.SetBinding(TextBlock.TextProperty, new Binding(TextProperty)
            {
                Source = this
            });
            panel.Children.Add(textBlock);

            this.Height           = 16;
            this.IsHitTestVisible = false;
            base.InitializeComponents();
        }
Exemple #31
0
        public MethodControl(Canvas parentCanvas)
            : base(parentCanvas, null)
        {
            Grid grid = new Grid();

            grid.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
            AddChild(grid);

            var label = new TextBlock()
            {
                Foreground          = Brushes.White,//TryFindResource("TextForeground") as Brush,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Margin = new Thickness(3, 2, 3, 2),
                //BorderBrush = Brushes.Black,
                //BorderThickness = new CSUtility.Support.Thickness(0, 0.5, 0, 0.5),
                //HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center
            };

            label.SetBinding(TextBlock.TextProperty, new Binding("Idx")
            {
                Source = this
            });
            grid.Children.Add(label);

            methodEll = new CodeGenerateSystem.Controls.LinkInControl()
            {
                Margin              = new Thickness(0, 0, -15, 0),
                Width               = 10,
                Height              = 10,
                BackBrush           = new SolidColorBrush(Color.FromRgb(130, 130, 216)),
                HorizontalAlignment = HorizontalAlignment.Right,
                Direction           = CodeGenerateSystem.Base.enBezierType.Right,
            };
            grid.Children.Add(methodEll);
            //methodEll.MouseLeftButtonDown += new MouseButtonEventHandler(ResultTrue_MouseLeftButtonDown);
            //LinkObjInfo linkObj = new LinkObjInfo();
            //linkObj.m_linkType = enLinkType.Method; //enLinkType.MethodListOut;
            //linkObj.m_linkElement = methodEll;
            ////linkObj.m_linkElementOffset = new Point(methodEll.ActualWidth + 1, methodEll.ActualHeight * 0.5);
            //linkObj.m_bezierType = enBezierType.Right;
            //linkObj.m_linkOpType = enLinkOpType.End;
            //AddLinkObject(linkObj);
            AddLinkObject(CodeGenerateSystem.Base.enLinkType.Method, methodEll, CodeGenerateSystem.Base.enBezierType.Right, CodeGenerateSystem.Base.enLinkOpType.End, null, false);
        }
        private void CreateControl(Test t)
        {
            var grid = new Grid();

            grid.SetBinding(Grid.DataContextProperty, new Binding {
                Source = DataContext, Mode = BindingMode.TwoWay
            });
            //grid.DataContext = this.DataContext;
            var tb = new TextBlock();

            tb.SetBinding(TextBlock.TextProperty, new Binding {
                Source = t.HeaderText, Mode = BindingMode.TwoWay
                , UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            });

            grid.Children.Add(tb);
            gridlayout.Children.Add(grid);
        }
        internal static DataTemplate GetDataTemplateForDisplayMemberPath(string displayMemberPath)
        {
            DataTemplate template = new DataTemplate();

            template._methodToInstantiateFrameworkTemplate = control =>
            {
                TemplateInstance templateInstance = new TemplateInstance();

                TextBlock textBlock = new TextBlock();
                textBlock.SetBinding(TextBlock.TextProperty, new Binding(displayMemberPath ?? string.Empty));

                templateInstance.TemplateContent = textBlock;

                return(templateInstance);
            };

            return(template);
        }
        private FrameworkElement GenerateElement(object childData)
        {
            TextBlock textBlock = new TextBlock();

            //textBlock.DataContext = childData;
            textBlock.VerticalAlignment = VerticalAlignment.Center;
            Binding b = GetBinding();

            if (b != null)
            {
                textBlock.SetBinding(TextBlock.TextProperty, b);
            }
            else if (childData is string)
            {
                textBlock.Text = (string)childData;
            }
            return(textBlock);
        }
        internal override FrameworkElement GenerateElement(object childData)
        {
            TextBlock textBlock = new TextBlock();

            //textBlock.DataContext = childData;
            textBlock.VerticalAlignment = VerticalAlignment.Center;
            Binding b = this.INTERNAL_GetBinding(DataGridBoundColumn.BindingProperty); //we get the Binding in the Binding property set by the user.

            if (b != null)
            {
                textBlock.SetBinding(TextBlock.TextProperty, b);
            }
            else if (childData is string)
            {
                textBlock.Text = (string)childData;
            }
            return(textBlock);
        }
        protected override void OnViewportChanged()
        {
            var bounds = ParentMap.ViewportTransform.Inverse.TransformBounds(new Rect(new Point(), ParentMap.RenderSize));
            var start = ParentMap.MapTransform.Transform(new Point(bounds.X, bounds.Y));
            var end = ParentMap.MapTransform.Transform(new Point(bounds.X + bounds.Width, bounds.Y + bounds.Height));
            var minSpacing = MinLineSpacing * 360d / (Math.Pow(2d, ParentMap.ZoomLevel) * 256d);
            var spacing = LineSpacings[LineSpacings.Length - 1];

            if (spacing >= minSpacing)
            {
                spacing = LineSpacings.FirstOrDefault(s => s >= minSpacing);
            }

            var labelStart = new Location(
                Math.Ceiling(start.Latitude / spacing) * spacing,
                Math.Ceiling(start.Longitude / spacing) * spacing);

            var labelEnd = new Location(
                Math.Floor(end.Latitude / spacing) * spacing,
                Math.Floor(end.Longitude / spacing) * spacing);

            var lineStart = new Location(
                Math.Min(Math.Max(labelStart.Latitude - spacing, -ParentMap.MapTransform.MaxLatitude), ParentMap.MapTransform.MaxLatitude),
                labelStart.Longitude - spacing);

            var lineEnd = new Location(
                Math.Min(Math.Max(labelEnd.Latitude + spacing, -ParentMap.MapTransform.MaxLatitude), ParentMap.MapTransform.MaxLatitude),
                labelEnd.Longitude + spacing);

            if (!lineStart.Equals(graticuleStart) || !lineEnd.Equals(graticuleEnd))
            {
                graticuleStart = lineStart;
                graticuleEnd = lineEnd;

                var geometry = (PathGeometry)path.Data;
                geometry.Figures.Clear();
                geometry.Transform = ParentMap.ViewportTransform;

                for (var lat = labelStart.Latitude; lat <= end.Latitude; lat += spacing)
                {
                    var figure = new PathFigure
                    {
                        StartPoint = ParentMap.MapTransform.Transform(new Location(lat, lineStart.Longitude)),
                        IsClosed = false,
                        IsFilled = false
                    };

                    figure.Segments.Add(new LineSegment
                    {
                        Point = ParentMap.MapTransform.Transform(new Location(lat, lineEnd.Longitude)),
                    });

                    geometry.Figures.Add(figure);
                }

                for (var lon = labelStart.Longitude; lon <= end.Longitude; lon += spacing)
                {
                    var figure = new PathFigure
                    {
                        StartPoint = ParentMap.MapTransform.Transform(new Location(lineStart.Latitude, lon)),
                        IsClosed = false,
                        IsFilled = false
                    };

                    figure.Segments.Add(new LineSegment
                    {
                        Point = ParentMap.MapTransform.Transform(new Location(lineEnd.Latitude, lon)),
                    });

                    geometry.Figures.Add(figure);
                }

                var childIndex = 1; // 0 for Path
                var format = spacing < 1d ? "{0} {1}°{2:00}'" : "{0} {1}°";

                for (var lat = labelStart.Latitude; lat <= end.Latitude; lat += spacing)
                {
                    for (var lon = labelStart.Longitude; lon <= end.Longitude; lon += spacing)
                    {
                        TextBlock label;

                        if (childIndex < Children.Count)
                        {
                            label = (TextBlock)Children[childIndex];
                        }
                        else
                        {
                            var renderTransform = new TransformGroup();
                            renderTransform.Children.Add(new TranslateTransform());
                            renderTransform.Children.Add(ParentMap.RotateTransform);
                            renderTransform.Children.Add(new TranslateTransform());

                            label = new TextBlock
                            {
                                RenderTransform = renderTransform
                            };

                            label.SetBinding(TextBlock.ForegroundProperty, new Binding
                            {
                                Source = this,
                                Path = new PropertyPath("Foreground")
                            });

                            Children.Add(label);
                        }

                        childIndex++;

                        if (FontFamily != null)
                        {
                            label.FontFamily = FontFamily;
                        }

                        label.FontSize = FontSize;
                        label.FontStyle = FontStyle;
                        label.FontStretch = FontStretch;
                        label.FontWeight = FontWeight;
                        label.Text = string.Format("{0}\n{1}", CoordinateString(lat, format, "NS"), CoordinateString(Location.NormalizeLongitude(lon), format, "EW"));
                        label.Tag = new Location(lat, lon);
                        label.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                        var translateTransform = (TranslateTransform)((TransformGroup)label.RenderTransform).Children[0];
                        translateTransform.X = StrokeThickness / 2d + 2d;
                        translateTransform.Y = -label.DesiredSize.Height / 2d;
                    }
                }

                while (Children.Count > childIndex)
                {
                    Children.RemoveAt(Children.Count - 1);
                }
            }

            // don't use MapPanel.Location because labels may be at more than 180° distance from map center

            for (int i = 1; i < Children.Count; i++)
            {
                var label = (TextBlock)Children[i];
                var location = (Location)label.Tag;
                var viewportTransform = (TranslateTransform)((TransformGroup)label.RenderTransform).Children[2];
                var viewportPosition = ParentMap.LocationToViewportPoint(location);
                viewportTransform.X = viewportPosition.X;
                viewportTransform.Y = viewportPosition.Y;
            }

            base.OnViewportChanged();
        }
Exemple #37
0
 private static UIElement e_11_dtMethod(UIElement parent)
 {
     // e_12 element
     TextBlock e_12 = new TextBlock();
     e_12.Parent = parent;
     e_12.Name = "e_12";
     e_12.Margin = new Thickness(2F, 2F, 2F, 2F);
     e_12.HorizontalAlignment = HorizontalAlignment.Center;
     Binding binding_e_12_Text = new Binding("Name");
     e_12.SetBinding(TextBlock.TextProperty, binding_e_12_Text);
     return e_12;
 }
 private static UIElement savesList_dtMethod(UIElement parent) {
     // e_2 element
     StackPanel e_2 = new StackPanel();
     e_2.Parent = parent;
     e_2.Name = "e_2";
     e_2.Margin = new Thickness(2F, 2F, 2F, 2F);
     e_2.Orientation = Orientation.Horizontal;
     // e_3 element
     TextBlock e_3 = new TextBlock();
     e_2.Children.Add(e_3);
     e_3.Name = "e_3";
     e_3.Margin = new Thickness(0F, 5F, 5F, 5F);
     Binding binding_e_3_Text = new Binding("CreatedOn");
     e_3.SetBinding(TextBlock.TextProperty, binding_e_3_Text);
     // e_4 element
     TextBlock e_4 = new TextBlock();
     e_2.Children.Add(e_4);
     e_4.Name = "e_4";
     e_4.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_4_Text = new Binding("Label");
     e_4.SetBinding(TextBlock.TextProperty, binding_e_4_Text);
     return e_2;
 }
 private static UIElement r_5_dtMethod(UIElement parent)
 {
     // e_8 element
     TextBlock e_8 = new TextBlock();
     e_8.Parent = parent;
     e_8.Name = "e_8";
     e_8.Margin = new Thickness(2F, 2F, 2F, 2F);
     Binding binding_e_8_Text = new Binding("Name");
     binding_e_8_Text.UseGeneratedBindings = true;
     e_8.SetBinding(TextBlock.TextProperty, binding_e_8_Text);
     return e_8;
 }
        private StackPanel CreateIntervalTimeSliderPanel()
        {
            var child = CreatePanel(Resources.AppResources.IntervalTime);
            Debug.WriteLine("create panel: " + Resources.AppResources.IntervalTime);

            var slider = CreateSlider(5, 30);
            slider.Value = ApplicationSettings.GetInstance().IntervalTime;

            slider.ValueChanged += (sender, e) =>
            {
                ApplicationSettings.GetInstance().IntervalTime = (int)e.NewValue;
            };

            var hPanel = new StackPanel
            {
                Orientation = System.Windows.Controls.Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Center
            };

            var selectedbind = new Binding()
            {
                Source = ApplicationSettings.GetInstance(),
                Path = new PropertyPath("IntervalTime"),
                Mode = BindingMode.TwoWay
            };
            var indicator = new TextBlock
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = System.Windows.VerticalAlignment.Top,
                    Style = Application.Current.Resources["PhoneTextNormalStyle"] as Style,
                    Margin = new Thickness(10, 15, 0, 0),
                    MinWidth = 25
                };
            indicator.SetBinding(TextBlock.TextProperty, selectedbind);
            slider.SetBinding(Slider.ValueProperty, selectedbind);

            hPanel.Children.Add(indicator);
            hPanel.Children.Add(slider);

            child.Children.Add(hPanel);
            return child;
        }
 private static UIElement sessionList_dtMethod(UIElement parent) {
     // e_10 element
     StackPanel e_10 = new StackPanel();
     e_10.Parent = parent;
     e_10.Name = "e_10";
     e_10.Margin = new Thickness(2F, 2F, 2F, 2F);
     e_10.Orientation = Orientation.Horizontal;
     // e_11 element
     TextBlock e_11 = new TextBlock();
     e_10.Children.Add(e_11);
     e_11.Name = "e_11";
     e_11.Width = 150F;
     e_11.Margin = new Thickness(0F, 5F, 5F, 5F);
     Binding binding_e_11_Text = new Binding("Name");
     e_11.SetBinding(TextBlock.TextProperty, binding_e_11_Text);
     // e_12 element
     TextBlock e_12 = new TextBlock();
     e_10.Children.Add(e_12);
     e_12.Name = "e_12";
     e_12.Width = 50F;
     e_12.Margin = new Thickness(5F, 5F, 0F, 5F);
     e_12.TextAlignment = TextAlignment.Right;
     Binding binding_e_12_Text = new Binding("Players");
     e_12.SetBinding(TextBlock.TextProperty, binding_e_12_Text);
     return e_10;
 }
Exemple #42
0
        private void displayEventList(List<Event> events, bool noStartHour, bool noEndhour)
        {
            // if the event last all day, only 1 iteration
            int _maxHour = (noStartHour && noEndhour) ? 1 : 24;

            // display the events that starts and ends at the selected date
            for (int i = 0; i < _maxHour; i++)
            {
                foreach (Event e in events)
                {

                    int _startHour = noStartHour ? 0 :Int32.Parse(e.Start.DateTime.Substring(11, 2));
                    int _endHour = noEndhour ? 0 : Int32.Parse(e.End.DateTime.Substring(11, 2));

                    if (_startHour == i)
                    {
                        // filling the tab of the day cal with the current event
                        int k = 0;
                        while (eventTabFill[i, k] != false)
                        {
                            k++;
                        }

                        int _nbHour = _endHour == 00 ? 24 - _startHour : _endHour - _startHour;
                        for (int j = 0; j < _nbHour; j++)
                        {
                            eventTabFill[i + j, k] = true;
                        }

                        // getting R G B from the colorID of the event
                        string _eventColor = calendar.getEventColorById(e.ColorId != null ? e.ColorId : "1").Background;
                        int _red = Int32.Parse(_eventColor.Substring(1, 2), NumberStyles.AllowHexSpecifier);
                        int _green = Int32.Parse(_eventColor.Substring(3, 2), NumberStyles.AllowHexSpecifier);
                        int _blue = Int32.Parse(_eventColor.Substring(5, 2), NumberStyles.AllowHexSpecifier);

                        // creating a rectangle colored with the event's color
                        if (_nbHour > 12)
                        {
                            Rectangle _rect = new Rectangle();
                            _rect.Height = 12 * 100;
                            _rect.Width = 10;
                            _rect.SetValue(Rectangle.FillProperty, new SolidColorBrush(Color.FromArgb((BitConverter.GetBytes(255))[0], (BitConverter.GetBytes(_red))[0], (BitConverter.GetBytes(_green))[0], (BitConverter.GetBytes(_blue))[0])));
                            _rect.Visibility = Visibility.Visible;
                            _rect.Margin = new Thickness((k * eventWidth), i * 100, 0, 0);
                            _rect.VerticalAlignment = VerticalAlignment.Top;
                            _rect.HorizontalAlignment = HorizontalAlignment.Left;

                            Rectangle _rect2 = new Rectangle();
                            _rect2.Height = (_nbHour - 12) * 100;
                            _rect2.Width = 10;
                            _rect2.SetValue(Rectangle.FillProperty, new SolidColorBrush(Color.FromArgb((BitConverter.GetBytes(255))[0], (BitConverter.GetBytes(_red))[0], (BitConverter.GetBytes(_green))[0], (BitConverter.GetBytes(_blue))[0])));
                            _rect2.Visibility = Visibility.Visible;
                            _rect2.Margin = new Thickness((k * eventWidth), i * 100 + 1200, 0, 0);
                            _rect2.VerticalAlignment = VerticalAlignment.Top;
                            _rect2.HorizontalAlignment = HorizontalAlignment.Left;
                            Events.Children.Add(_rect);
                            Events.Children.Add(_rect2);
                        }
                        else
                        {
                            Rectangle _rect = new Rectangle();
                            _rect.Height = _nbHour == 0 ? 30 : _nbHour * 100;
                            _rect.Width = 10;
                            _rect.SetValue(Rectangle.FillProperty, new SolidColorBrush(Color.FromArgb((BitConverter.GetBytes(255))[0], (BitConverter.GetBytes(_red))[0], (BitConverter.GetBytes(_green))[0], (BitConverter.GetBytes(_blue))[0])));
                            _rect.Visibility = Visibility.Visible;
                            _rect.Margin = new Thickness((k * eventWidth), i * 100, 0, 0);
                            _rect.VerticalAlignment = VerticalAlignment.Top;
                            _rect.HorizontalAlignment = HorizontalAlignment.Left;
                            Events.Children.Add(_rect);
                        }

                        // creating the textblock for the title of the event (clickable) colored with the event's color
                        TextBlock _title = new TextBlock();
                        _title.DataContext = e;
                        _title.SetBinding(TextBlock.TextProperty, new Binding("Summary"));
                        _title.SetValue(TextBlock.ForegroundProperty, new SolidColorBrush(Color.FromArgb((BitConverter.GetBytes(255))[0], (BitConverter.GetBytes(_red))[0], (BitConverter.GetBytes(_green))[0], (BitConverter.GetBytes(_blue))[0])));
                        _title.Height = 30;
                        _title.Width = eventWidth - 10;
                        _title.Margin = new Thickness((k * eventWidth) + 13, i * 100 + 3, 3, 3);
                        _title.VerticalAlignment = VerticalAlignment.Top;
                        _title.HorizontalAlignment = HorizontalAlignment.Left;
                        _title.TextWrapping = TextWrapping.Wrap;
                        _title.MouseLeftButtonDown += new MouseButtonEventHandler(title_MouseLeftButtonDown);

                        // creating the textblock for the description of the event
                        TextBlock _desc = new TextBlock();
                        _desc.DataContext = e;
                        _desc.SetBinding(TextBlock.TextProperty, new Binding("Description"));
                        _desc.Height = _nbHour == 0 ? 30 : 70 + ((_nbHour - 1) * 100);
                        _desc.Width = eventWidth - 10;
                        _desc.Margin = new Thickness((k * eventWidth) + 13, (i * 100) + 33, 3, 3);
                        _desc.VerticalAlignment = VerticalAlignment.Top;
                        _desc.HorizontalAlignment = HorizontalAlignment.Left;
                        _desc.TextWrapping = TextWrapping.Wrap;

                        Events.Children.Add(_title);
                        Events.Children.Add(_desc);

                    }
                }
            }
        }
Exemple #43
0
        private void RenderViewItem(Item item)
        {
            // get the item type
            ItemType itemType = null;
            if (ItemType.ItemTypes.TryGetValue(item.ItemTypeID, out itemType) == false)
                return;

            // create a list of all the first subitems in each of the sublists of the item (e.g. Contacts, Places, etc)
            var subLists = App.ViewModel.Items.Where(i => i.ParentID == item.ID && i.IsList == true).ToList();
            var subItems = new List<Item>();
            foreach (var subList in subLists)
            {
                var itemRef = App.ViewModel.Items.FirstOrDefault(i => i.ParentID == subList.ID && i.ItemTypeID == SystemItemTypes.Reference);
                if (itemRef != null)
                {
                    var target = App.ViewModel.Items.FirstOrDefault(i => i.ID == itemRef.ItemRef);
                    if (target != null)
                        subItems.Add(target);
                }
            }

            // render fields
            int row = 0;
            foreach (ActionType action in App.ViewModel.Constants.ActionTypes.OrderBy(a => a.SortOrder))
            {
                FieldValue fieldValue = item.FieldValues.FirstOrDefault(fv => fv.FieldName == action.FieldName);
                if (fieldValue == null)
                {
                    bool found = false;
                    foreach (var i in subItems)
                    {
                        fieldValue = i.FieldValues.FirstOrDefault(fv => fv.FieldName == action.FieldName);
                        if (fieldValue != null)
                        {
                            found = true;
                            break;
                        }
                    }

                    // if fieldvalue isn't found on this item or other subitems, don't process the action
                    if (found == false)
                        continue;
                }

                // get the value of the property
                string currentValue = fieldValue.Value;

                // for our purposes, an empty value is the same as null
                if (currentValue == "")
                    currentValue = null;

                // render this property if it's not null/empty
                if (currentValue != null)
                {
                    // first make sure that we do want to render (type-specific logic goes here)
                    switch (action.ActionName)
                    {
                        case "Postpone":
                            // if the date is already further in the future than today, omit adding this action
                            if (Convert.ToDateTime(currentValue).Date > DateTime.Today.Date)
                                continue;
                            break;
                    }

                    // add a new row
                    ViewGrid.RowDefinitions.Add(new RowDefinition() { MaxHeight = 72 });
                    Thickness margin = new Thickness(12, 20, 0, 0);  // bounding rectangle of padding

                    // create a new buton for the action (verb)
                    var button = new Button()
                    {
                        Content = action.DisplayName,
                        MinWidth = 200
                    };
                    button.SetValue(Grid.ColumnProperty, 0);
                    button.SetValue(Grid.RowProperty, row);
                    ViewGrid.Children.Add(button);

                    // create a label which holds the noun the verb will act upon
                    // usually extracted from the item field's contents
                    var valueTextBlock = new TextBlock()
                    {
                        DataContext = fieldValue,
                        Style = (Style)App.Current.Resources["PhoneTextNormalStyle"],
                        Margin = margin,
                    };

                    //value.SetBinding(TextBlock.TextProperty, new Binding(pi.Name));
                    valueTextBlock.SetValue(Grid.ColumnProperty, 1);
                    valueTextBlock.SetValue(Grid.RowProperty, row++);
                    ViewGrid.Children.Add(valueTextBlock);

                    // render the action based on the action type
                    switch (action.ActionName)
                    {
                        case ActionNames.Navigate:
                            try
                            {
                                Item targetList = App.ViewModel.Items.Single(i => i.ID == Guid.Parse(currentValue));
                                //valueTextBlock.Text = String.Format("to {0}", targetList.Name);
                                button.Click += new RoutedEventHandler(delegate
                                {
                                    // trace page navigation
                                    TraceHelper.StartMessage("Item: Navigate to List");

                                    // Navigate to the new page
                                    NavigationService.Navigate(
                                        new Uri(String.Format("/ListPage.xaml?type=Folder&ID={0}&ParentID={1}", targetList.FolderID, targetList.ID),
                                        UriKind.Relative));
                                });
                            }
                            catch (Exception)
                            {
                                valueTextBlock.Text = "(list not found)";
                            }
                            break;
                        case ActionNames.Postpone:
                            valueTextBlock.Text = "to tomorrow";
                            button.Click += new RoutedEventHandler(delegate
                            {
                                item.DueDate = DateTime.Today.Date.AddDays(1.0).ToString("yyyy-MM-dd");
                                folder.NotifyPropertyChanged("FirstDue");
                                folder.NotifyPropertyChanged("FirstDueColor");
                            });
                            break;
                        case ActionNames.AddToCalendar:
                            valueTextBlock.DataContext = item;
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding("DueDisplay"));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                folder.NotifyPropertyChanged("FirstDue");
                                folder.NotifyPropertyChanged("FirstDueColor");
                            });
                            break;
                        case ActionNames.Map:
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding("Value"));
                            button.Click += new RoutedEventHandler(delegate
                            {
            #if WINPHONE7 // Pre-MANGO
                                string mapUrl = "maps:";
                                bool space = false;
                                foreach (string part in valueString.Split(' '))
                                {
                                    if (space == true)
                                        mapUrl += "%20";
                                    mapUrl += part;
                                    space = true;
                                }
                                WebBrowserItem mapItem = new WebBrowserItem() { Uri = new Uri(mapUrl) };
            #else // MANGO
                                BingMapsTask mapItem = new BingMapsTask() { SearchTerm = currentValue };
            #endif
                                mapItem.Show();
                            });
                            break;
                        case ActionNames.Call:
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding("Value"));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                PhoneCallTask phoneCallTask = new PhoneCallTask() { PhoneNumber = (string)currentValue };
                                phoneCallTask.Show();
                            });
                            break;
                        case ActionNames.TextMessage:
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding("Value"));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                SmsComposeTask smsTask = new SmsComposeTask() { To = (string)currentValue };
                                smsTask.Show();
                            });
                            break;
                        case ActionNames.Browse:
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding("Value"));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                string url = (string)currentValue;
                                if (url.Substring(1, 4) != "http")
                                    url = String.Format("http://{0}", url);
                                WebBrowserTask browserTask = new WebBrowserTask() { Uri = new Uri(url) };
                                browserTask.Show();
                            });
                            break;
                        case ActionNames.SendEmail:
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding("Value"));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                EmailComposeTask emailItem = new EmailComposeTask() { To = (string)currentValue };
                                emailItem.Show();
                            });
                            break;
                    }
                }
            }
        }
    protected void FindProjects()
    {
        try
        {
            string path = System.IO.Path.GetFullPath(Configuration.GetPath("projects") + System.IO.Path.DirectorySeparatorChar + App.Game.GameConfiguration.ID);
            if (!System.IO.Directory.Exists(path))
                System.IO.Directory.CreateDirectory(path);
            string[] files = System.IO.Directory.GetDirectories(path);
            foreach (string file in files)
            {
                System.IO.FileAttributes attr = System.IO.File.GetAttributes(@file);
                if ((attr & System.IO.FileAttributes.Directory) == System.IO.FileAttributes.Directory)
                {
                    string id = System.IO.Path.GetFileName(file);
                    bool add = true;
                    foreach (ModProject project in ModProjects)
                    {
                        if (project.ID == id)
                        {
                            add = false;
                            break;
                        }
                    }
                    if (add && ModAPI.Data.Mod.Header.VerifyModID(id))
                        ModProjects.Add(new ModProject(App.Game, id));
                }
            }

            /** Add new projects **/
            foreach (ModProject project in ModProjects)
            {
                bool add = true;
                foreach (ListViewItem item in _Projects)
                {
                    if (((ModProjectViewModel)item.DataContext).Project == project)
                    {
                        add = false;
                        break;
                    }
                }
                if (add)
                {
                    ListViewItem newItem = new ListViewItem();
                    newItem.DataContext = new ModProjectViewModel(project);
                    Grid panel = new Grid();
                    Image image = new Image();
                    image.Height = 20;
                    BitmapImage source = new BitmapImage();
                    source.BeginInit();
                    source.UriSource = new Uri("pack://application:,,,/ModAPI;component/resources/textures/Icons/Icon_Warning.png");
                    source.EndInit();
                    image.Source = source;
                    image.HorizontalAlignment = HorizontalAlignment.Right;
                    //image.Margin = new Thickness(0, 0, 5, 0);
                    image.SetBinding(Image.VisibilityProperty, "Error");

                    Image image2 = new Image();
                    image2.Height = 20;
                    BitmapImage source2 = new BitmapImage();
                    source2.BeginInit();
                    source2.UriSource = new Uri("pack://application:,,,/ModAPI;component/resources/textures/Icons/Icon_Error.png");
                    source2.EndInit();
                    image2.Source = source2;
                    image2.HorizontalAlignment = HorizontalAlignment.Right;
                    image.Margin = new Thickness(5, 0, 0, 0);
                    image2.SetBinding(Image.VisibilityProperty, "SaveError");

                    TextBlock label = new TextBlock();
                    label.SetBinding(TextBlock.TextProperty, "ID");

                    panel.Children.Add(label);
                    panel.Children.Add(image);
                    panel.Children.Add(image2);

                    newItem.Content = panel;
                    _Projects.Add(newItem);
                }
            }

            for (int i = 0; i < ModProjects.Count; i++)
            {
                ModProject p = ModProjects[i];
                string checkPath = Configuration.GetPath("projects") + System.IO.Path.DirectorySeparatorChar + App.Game.GameConfiguration.ID + System.IO.Path.DirectorySeparatorChar + p.ID;
                if (!System.IO.Directory.Exists(checkPath))
                {
                    ModProjects.RemoveAt(i);
                    i--;
                }
            }
            /** Remove deleted projects **/
            for (int i = 0; i < _Projects.Count; i++)
            {
                ListViewItem item = _Projects[i];
                ModProject check = ((ModProjectViewModel)item.DataContext).Project;
                if (!ModProjects.Contains(check))
                {
                    _Projects.RemoveAt(i);
                    i--;
                }
            }
        }
        catch (Exception e)
        {
            Debug.Log("F", e.ToString());
        }
    }
        private void InitPopup()
        {
            popup = new Popup();
            popup.Opened += popup_Opened;

            Binding backgroundBinding = new Binding("Background");
            backgroundBinding.Source = this;

            Binding foregroundBinding = new Binding("Foreground");
            foregroundBinding.Source = this;

            Grid border = new Grid();
            border.Background = new SolidColorBrush(Color.FromArgb(200, 0, 0, 0));
            border.Width = Application.Current.Host.Content.ActualWidth;
            border.Height = Application.Current.Host.Content.ActualHeight;

            Grid container = new Grid();
            CompositeTransform transform = new CompositeTransform()
            {
                TranslateY = -Application.Current.Host.Content.ActualHeight
            };
            container.RenderTransform = transform;
            container.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            container.SetBinding(Grid.BackgroundProperty, backgroundBinding);

            #region init grid rows

            RowDefinition row1 = new RowDefinition()
            {
                Height = GridLength.Auto
            };
            container.RowDefinitions.Add(row1);

            RowDefinition row2 = new RowDefinition()
            {
                Height = GridLength.Auto
            };
            container.RowDefinitions.Add(row2);

            RowDefinition row3 = new RowDefinition()
            {
                Height = GridLength.Auto
            };
            container.RowDefinitions.Add(row3);

            #endregion

            TextBlock title = new TextBlock()
            {
                Margin = new Thickness(12),
                FontSize = 30,
                FontWeight = FontWeights.Black
            };
            Binding titleBinding = new Binding("Title");
            titleBinding.Source = this;
            title.SetBinding(TextBlock.TextProperty, titleBinding);

            title.SetBinding(TextBlock.ForegroundProperty, foregroundBinding);
            container.Children.Add(title);

            TextBlock content = new TextBlock()
            {
                Margin = new Thickness(12),
                FontSize = 26,
                FontWeight = FontWeights.Medium
            };

            Binding contentBinding = new Binding("Content");
            contentBinding.Source = this;
            content.SetBinding(TextBlock.TextProperty, contentBinding);

            content.SetBinding(TextBlock.ForegroundProperty, foregroundBinding);
            content.SetValue(Grid.RowProperty, 1);
            container.Children.Add(content);

            switch (MessageBoxButtons)
            {
                case MessageBoxButton.OK:
                    {
                        Button btn = new Button()
                        {
                            Content = "OK",
                            Margin = new Thickness(0, 0, 0, 10)
                        };

                        btn.Click += (s, args) =>
                        {
                            var handler = OKClick;
                            if (null != handler)
                            {
                                handler(this, new RoutedEventArgs());
                            }

                            GetCloseAnimation();
                        };

                        btn.SetValue(Grid.RowProperty, 2);
                        container.Children.Add(btn);
                    }
                    break;
                case MessageBoxButton.OKCancel:
                    {
                        Grid btnGrid = new Grid();
                        btnGrid.Margin = new Thickness(0, 0, 0, 10);
                        btnGrid.SetValue(Grid.RowProperty, 2);
                        ColumnDefinition column1 = new ColumnDefinition();
                        ColumnDefinition column2 = new ColumnDefinition();
                        btnGrid.ColumnDefinitions.Add(column1);
                        btnGrid.ColumnDefinitions.Add(column2);

                        Button btnOK = new Button()
                        {
                            Content = "OK"
                        };
                        btnOK.Click += (s, args) =>
                        {
                            var handler = OKClick;
                            if (null != handler)
                            {
                                handler(this, new RoutedEventArgs());
                            }

                            GetCloseAnimation();
                        };
                        btnGrid.Children.Add(btnOK);

                        Button btnCancel = new Button()
                        {
                            Content = "Cancel"
                        };
                        btnCancel.Click += (s, args) =>
                        {
                            var handler = CancelClick;
                            if (null != handler)
                            {
                                handler(this, new RoutedEventArgs());
                            }

                            GetCloseAnimation();
                        };
                        btnCancel.SetValue(Grid.ColumnProperty, 1);
                        btnGrid.Children.Add(btnCancel);

                        container.Children.Add(btnGrid);
                    }
                    break;
            }

            border.Children.Add(container);
            popup.Child = border;
        }
 private static UIElement r_6_dtMethod(UIElement parent)
 {
     // e_66 element
     TextBlock e_66 = new TextBlock();
     e_66.Parent = parent;
     e_66.Name = "e_66";
     e_66.Margin = new Thickness(2F, 2F, 2F, 2F);
     Binding binding_e_66_Text = new Binding("Name");
     e_66.SetBinding(TextBlock.TextProperty, binding_e_66_Text);
     return e_66;
 }
Exemple #47
0
        private void RenderViewTask(Task task)
        {
            int row = 0;
            // render fields
            foreach (TaskStoreClientEntities.Action action in App.ViewModel.Constants.Actions.OrderBy(a => a.SortOrder))
            {
                PropertyInfo pi;
                // make sure the property exists on the local type
                try
                {
                    pi = task.GetType().GetProperty(action.FieldName);
                    if (pi == null)
                        continue;  // see comment below
                }
                catch (Exception)
                {
                    // we can't do anything with this property since we don't have it on the local type
                    // this indicates that the phone software isn't caught up with the service version
                    // but that's ok - we can keep going
                    continue;
                }

                // get the value of the property
                var val = pi.GetValue(task, null);

                // for our purposes, an empty value is the same as null
                if (val != null && val.GetType() == typeof(String))
                    if ((string)val == "")
                        val = null;

                // render this property if it's not null/empty
                if (val != null)
                {
                    // first make sure that we do want to render (type-specific logic goes here)
                    switch (action.ActionType)
                    {
                        case "Postpone":
                            // if the date is already further in the future than today, omit adding this action
                            if (((DateTime)val).Date > DateTime.Today.Date)
                                continue;
                            break;
                    }

                    // add a new row
                    ViewGrid.RowDefinitions.Add(new RowDefinition() { MaxHeight = 72 });

                    string valueString = val.ToString();
                    Thickness margin = new Thickness(12, 20, 0, 0);  // bounding rectangle of padding

                    // create a new buton for the action (verb)
                    var button = new Button()
                    {
                        Content = action.DisplayName,
                        MinWidth = 200
                    };
                    button.SetValue(Grid.ColumnProperty, 0);
                    button.SetValue(Grid.RowProperty, row);
                    ViewGrid.Children.Add(button);

                    // create a label which holds the noun the verb will act upon
                    // usually extracted from the task field's contents
                    var valueTextBlock = new TextBlock()
                    {
                        DataContext = task,
                        Style = (Style)App.Current.Resources["PhoneTextNormalStyle"],
                        Margin = margin,
                    };

                    //value.SetBinding(TextBlock.TextProperty, new Binding(pi.Name));
                    valueTextBlock.SetValue(Grid.ColumnProperty, 1);
                    valueTextBlock.SetValue(Grid.RowProperty, row++);
                    ViewGrid.Children.Add(valueTextBlock);

                    // render the action based on the action type
                    switch (action.ActionType)
                    {
                        case "Navigate":
                            try
                            {
                                TaskList tl = App.ViewModel.TaskLists.Single(t => t.ID == (Guid)val);
                                valueTextBlock.Text = String.Format("to {0}", tl.Name);
                                button.Click += new RoutedEventHandler(delegate
                                {
                                    // trace page navigation
                                    TraceHelper.StartMessage("Task: Navigate to TaskList");

                                    // Navigate to the new page
                                    //NavigationService.Navigate(new Uri("/TaskListPage.xaml?type=TaskList&ID=" + tl.ID.ToString(), UriKind.Relative));
                                    NavigationService.Navigate(new Uri("/ListPage.xaml?type=TaskList&ID=" + tl.ID.ToString(), UriKind.Relative));
                                });
                            }
                            catch (Exception)
                            {
                                valueTextBlock.Text = "(list not found)";
                            }
                            break;
                        case "Postpone":
                            valueTextBlock.Text = "to tomorrow";
                            button.Click += new RoutedEventHandler(delegate
                            {
                                pi.SetValue(task, DateTime.Today.Date.AddDays(1.0), null);
                                taskList.NotifyPropertyChanged("FirstDue");
                                taskList.NotifyPropertyChanged("FirstDueColor");
                            });
                            break;
                        case "AddToCalendar":
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding("DueDisplay"));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                taskList.NotifyPropertyChanged("FirstDue");
                                taskList.NotifyPropertyChanged("FirstDueColor");
                            });
                            break;
                        case "Map":
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding(pi.Name));
                            button.Click += new RoutedEventHandler(delegate
                            {
            #if WINPHONE7 // Pre-MANGO
                                string mapUrl = "maps:";
                                bool space = false;
                                foreach (string part in valueString.Split(' '))
                                {
                                    if (space == true)
                                        mapUrl += "%20";
                                    mapUrl += part;
                                    space = true;
                                }
                                WebBrowserTask mapTask = new WebBrowserTask() { Uri = new Uri(mapUrl) };
            #else // MANGO
                                BingMapsTask mapTask = new BingMapsTask() { SearchTerm = valueString };
            #endif
                                mapTask.Show();
                            });
                            break;
                        case "Phone":
                            // format as phone number
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding(pi.Name));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                PhoneCallTask phoneCallTask = new PhoneCallTask() { PhoneNumber = (string)val };
                                phoneCallTask.Show();
                            });
                            break;
                        case "TextMessage":
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding(pi.Name));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                SmsComposeTask smsTask = new SmsComposeTask() { To = (string)val };
                                smsTask.Show();
                            });
                            break;
                        case "Browse":
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding(pi.Name));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                string url = (string)val;
                                if (url.Substring(1, 4) != "http")
                                    url = String.Format("http://{0}", url);
                                WebBrowserTask browserTask = new WebBrowserTask() { Uri = new Uri(url) };
                                browserTask.Show();
                            });
                            break;
                        case "Email":
                            valueTextBlock.SetBinding(TextBlock.TextProperty, new Binding(pi.Name));
                            button.Click += new RoutedEventHandler(delegate
                            {
                                EmailComposeTask emailTask = new EmailComposeTask() { To = (string)val };
                                emailTask.Show();
                            });
                            break;
                    }
                }
            }
        }
		/// <summary>
		/// When overridden in a derived class, gets a read-only element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding"/> property value.
		/// </summary>
		/// <param name="cell">The cell that will contain the generated element.</param>
		/// <param name="dataItem">The data item represented by the row that contains the intended cell.</param>
		/// <returns>
		/// A new, read-only element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding"/> property value.
		/// </returns>
		protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
		{            
            TextBlock block = new TextBlock
            {
                Margin = new Thickness(4.0),
                VerticalAlignment = VerticalAlignment.Center
            };

            if (!string.IsNullOrEmpty(Field))
            {
                var codedValueSources = Utilities.DynamicCodedValueSource.GetCodedValueSources(LookupField, FieldInfo, dataItem, DynamicCodedValueSource, nullableSources);
                if (codedValueSources != null)
                {

                    if (!string.IsNullOrEmpty(LookupField) && DynamicCodedValueSource != null)
                    {
                        nameConverter.LookupField = this.LookupField;
                        nameConverter.Field = this.Field;

                        Binding binding =
#if SILVERLIGHT
                        new Binding();
#else
				        new Binding("Attributes["+Field+"]");
#endif
                        binding.Mode = BindingMode.OneWay;
                        binding.Converter = nameConverter;
                        binding.ConverterParameter =
#if SILVERLIGHT
                        DynamicCodedValueSource;
#else
				        new Object[] { DynamicCodedValueSource, block };
#endif
                        block.SetBinding(TextBlock.TextProperty, binding);
                    }
                }
                else if (FieldInfo.Type == Client.Field.FieldType.Date)
                {                    
                    if (!string.IsNullOrEmpty(Field))
                    {
                        dateTimeConverter.DateTimeFormat = this.DateTimeFormat;
                        dateTimeConverter.DateTimeKind = this.DateTimeKind;

                        Binding binding =
#if SILVERLIGHT
                        new Binding(Field);
#else
				        new Binding("Attributes["+Field+"]");			
#endif
                        binding.Mode = BindingMode.OneWay;
                        binding.Converter = dateTimeConverter;
                        block.SetBinding(TextBlock.TextProperty, binding);
                    }
                }
                else
                {
                    
                    Binding binding =
#if SILVERLIGHT
                    new Binding(Field);
#else
				    new Binding("Attributes["+Field+"]");			
#endif
                    binding.Mode = BindingMode.OneWay;
                    block.SetBinding(TextBlock.TextProperty, binding);                    
                }
            }
            return block;
		}
Exemple #49
0
        /// <summary>
        /// Gets the template parts and sets binding.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _notificationBlock = base.GetTemplateChild(NotificationBlock) as TextBlock;
            _messageBlock = base.GetTemplateChild(MessageBlock) as TextBlock;
            _backTitleBlock = base.GetTemplateChild(BackTitleBlock) as TextBlock;
            _titlePanel = base.GetTemplateChild(TitlePanel) as Panel;

            //Do binding in code to avoid exposing unnecessary value converters.
            if (_notificationBlock != null)
            {
                Binding bindVisible = new Binding();
                bindVisible.Source = this;
                bindVisible.Path = new PropertyPath("DisplayNotification");
                bindVisible.Converter = new VisibilityConverter();
                bindVisible.ConverterParameter = false;
                _notificationBlock.SetBinding(TextBlock.VisibilityProperty, bindVisible);
            }

            if (_messageBlock != null)
            {
                Binding bindCollapsed = new Binding();
                bindCollapsed.Source = this;
                bindCollapsed.Path = new PropertyPath("DisplayNotification");
                bindCollapsed.Converter = new VisibilityConverter();
                bindCollapsed.ConverterParameter = true;
                _messageBlock.SetBinding(TextBlock.VisibilityProperty, bindCollapsed);
            }

            if (_backTitleBlock != null)
            {
                Binding bindTitle = new Binding();
                bindTitle.Source = this;
                bindTitle.Path = new PropertyPath("Title");
                bindTitle.Converter = new MultipleToSingleLineStringConverter();
                _backTitleBlock.SetBinding(TextBlock.TextProperty, bindTitle);
            }

            UpdateVisualState();
        }
Exemple #50
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_TabControl_Items()
 {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // e_3 element
     TabItem e_3 = new TabItem();
     e_3.Name = "e_3";
     e_3.HorizontalContentAlignment = HorizontalAlignment.Stretch;
     e_3.Header = "Controls";
     // e_4 element
     Grid e_4 = new Grid();
     e_3.Content = e_4;
     e_4.Name = "e_4";
     RowDefinition row_e_4_0 = new RowDefinition();
     row_e_4_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_0);
     RowDefinition row_e_4_1 = new RowDefinition();
     row_e_4_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_1);
     RowDefinition row_e_4_2 = new RowDefinition();
     row_e_4_2.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_2);
     RowDefinition row_e_4_3 = new RowDefinition();
     row_e_4_3.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_3);
     RowDefinition row_e_4_4 = new RowDefinition();
     row_e_4_4.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_4);
     RowDefinition row_e_4_5 = new RowDefinition();
     row_e_4_5.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_5);
     RowDefinition row_e_4_6 = new RowDefinition();
     row_e_4_6.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_6);
     RowDefinition row_e_4_7 = new RowDefinition();
     row_e_4_7.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_7);
     RowDefinition row_e_4_8 = new RowDefinition();
     row_e_4_8.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_8);
     RowDefinition row_e_4_9 = new RowDefinition();
     row_e_4_9.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_9);
     RowDefinition row_e_4_10 = new RowDefinition();
     row_e_4_10.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_10);
     RowDefinition row_e_4_11 = new RowDefinition();
     row_e_4_11.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_11);
     ColumnDefinition col_e_4_0 = new ColumnDefinition();
     col_e_4_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_4.ColumnDefinitions.Add(col_e_4_0);
     ColumnDefinition col_e_4_1 = new ColumnDefinition();
     e_4.ColumnDefinitions.Add(col_e_4_1);
     // e_5 element
     TextBlock e_5 = new TextBlock();
     e_4.Children.Add(e_5);
     e_5.Name = "e_5";
     e_5.VerticalAlignment = VerticalAlignment.Center;
     e_5.Text = "Button";
     // button1 element
     Button button1 = new Button();
     e_4.Children.Add(button1);
     button1.Name = "button1";
     button1.Height = 30F;
     button1.Width = 200F;
     button1.Margin = new Thickness(5F, 5F, 5F, 5F);
     button1.HorizontalAlignment = HorizontalAlignment.Left;
     button1.TabIndex = 1;
     button1.Content = "Button 1";
     button1.CommandParameter = "Click Button 1";
     Grid.SetColumn(button1, 1);
     Grid.SetRow(button1, 0);
     Binding binding_button1_Command = new Binding("ButtonCommand");
     button1.SetBinding(Button.CommandProperty, binding_button1_Command);
     // button2 element
     Button button2 = new Button();
     e_4.Children.Add(button2);
     button2.Name = "button2";
     button2.Height = 30F;
     button2.Width = 200F;
     button2.Margin = new Thickness(5F, 5F, 5F, 5F);
     button2.HorizontalAlignment = HorizontalAlignment.Left;
     button2.TabIndex = 2;
     button2.Content = "Button 2";
     button2.CommandParameter = "Click Button 2";
     Grid.SetColumn(button2, 1);
     Grid.SetRow(button2, 1);
     Binding binding_button2_IsEnabled = new Binding("ButtonEnabled");
     button2.SetBinding(Button.IsEnabledProperty, binding_button2_IsEnabled);
     Binding binding_button2_Command = new Binding("ButtonCommand");
     button2.SetBinding(Button.CommandProperty, binding_button2_Command);
     // buttonResult element
     TextBlock buttonResult = new TextBlock();
     e_4.Children.Add(buttonResult);
     buttonResult.Name = "buttonResult";
     buttonResult.HorizontalAlignment = HorizontalAlignment.Left;
     Grid.SetColumn(buttonResult, 1);
     Grid.SetRow(buttonResult, 2);
     Binding binding_buttonResult_Text = new Binding("ButtonResult");
     buttonResult.SetBinding(TextBlock.TextProperty, binding_buttonResult_Text);
     // e_6 element
     TextBlock e_6 = new TextBlock();
     e_4.Children.Add(e_6);
     e_6.Name = "e_6";
     e_6.VerticalAlignment = VerticalAlignment.Center;
     e_6.Text = "CheckBox";
     Grid.SetRow(e_6, 3);
     // checkBox element
     CheckBox checkBox = new CheckBox();
     e_4.Children.Add(checkBox);
     checkBox.Name = "checkBox";
     checkBox.Margin = new Thickness(5F, 5F, 5F, 5F);
     checkBox.HorizontalAlignment = HorizontalAlignment.Left;
     checkBox.TabIndex = 3;
     checkBox.Content = "Check Box";
     Grid.SetColumn(checkBox, 1);
     Grid.SetRow(checkBox, 3);
     // e_7 element
     TextBlock e_7 = new TextBlock();
     e_4.Children.Add(e_7);
     e_7.Name = "e_7";
     e_7.VerticalAlignment = VerticalAlignment.Center;
     e_7.Text = "ProgressBar";
     Grid.SetRow(e_7, 4);
     // e_8 element
     ProgressBar e_8 = new ProgressBar();
     e_4.Children.Add(e_8);
     e_8.Name = "e_8";
     e_8.Height = 30F;
     e_8.Width = 200F;
     e_8.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_8.HorizontalAlignment = HorizontalAlignment.Left;
     Grid.SetColumn(e_8, 1);
     Grid.SetRow(e_8, 4);
     Binding binding_e_8_Value = new Binding("ProgressValue");
     e_8.SetBinding(ProgressBar.ValueProperty, binding_e_8_Value);
     // e_9 element
     TextBlock e_9 = new TextBlock();
     e_4.Children.Add(e_9);
     e_9.Name = "e_9";
     e_9.VerticalAlignment = VerticalAlignment.Center;
     e_9.Text = "Slider";
     Grid.SetRow(e_9, 5);
     // slider element
     Slider slider = new Slider();
     e_4.Children.Add(slider);
     slider.Name = "slider";
     slider.Width = 200F;
     slider.HorizontalAlignment = HorizontalAlignment.Left;
     slider.TabIndex = 4;
     slider.Minimum = 5F;
     slider.Maximum = 20F;
     Grid.SetColumn(slider, 1);
     Grid.SetRow(slider, 5);
     Binding binding_slider_Value = new Binding("SliderValue");
     slider.SetBinding(Slider.ValueProperty, binding_slider_Value);
     // e_10 element
     TextBlock e_10 = new TextBlock();
     e_4.Children.Add(e_10);
     e_10.Name = "e_10";
     e_10.VerticalAlignment = VerticalAlignment.Center;
     e_10.Text = "TextBox";
     Grid.SetRow(e_10, 6);
     // textBox element
     TextBox textBox = new TextBox();
     e_4.Children.Add(textBox);
     textBox.Name = "textBox";
     textBox.Width = 200F;
     textBox.Margin = new Thickness(5F, 5F, 5F, 5F);
     textBox.HorizontalAlignment = HorizontalAlignment.Left;
     textBox.TabIndex = 5;
     textBox.SelectionBrush = new SolidColorBrush(new ColorW(255, 0, 0, 255));
     textBox.UndoLimit = 20;
     Grid.SetColumn(textBox, 1);
     Grid.SetRow(textBox, 6);
     Binding binding_textBox_Text = new Binding("TextBoxText");
     textBox.SetBinding(TextBox.TextProperty, binding_textBox_Text);
     // e_11 element
     TextBlock e_11 = new TextBlock();
     e_4.Children.Add(e_11);
     e_11.Name = "e_11";
     e_11.VerticalAlignment = VerticalAlignment.Center;
     e_11.Text = "Numeric";
     Grid.SetRow(e_11, 7);
     // numTextBox element
     NumericTextBox numTextBox = new NumericTextBox();
     e_4.Children.Add(numTextBox);
     numTextBox.Name = "numTextBox";
     numTextBox.Width = 200F;
     numTextBox.Margin = new Thickness(5F, 5F, 5F, 5F);
     numTextBox.HorizontalAlignment = HorizontalAlignment.Left;
     numTextBox.TabIndex = 6;
     numTextBox.ValueFormat = "F0";
     numTextBox.ValueStyle = ((System.Globalization.NumberStyles)(7));
     Grid.SetColumn(numTextBox, 1);
     Grid.SetRow(numTextBox, 7);
     Binding binding_numTextBox_Value = new Binding("NumericTextBoxValue");
     numTextBox.SetBinding(NumericTextBox.ValueProperty, binding_numTextBox_Value);
     // e_12 element
     TextBlock e_12 = new TextBlock();
     e_4.Children.Add(e_12);
     e_12.Name = "e_12";
     e_12.VerticalAlignment = VerticalAlignment.Center;
     e_12.Text = "PasswordBox";
     Grid.SetRow(e_12, 8);
     // e_13 element
     PasswordBox e_13 = new PasswordBox();
     e_4.Children.Add(e_13);
     e_13.Name = "e_13";
     e_13.Width = 200F;
     e_13.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_13.HorizontalAlignment = HorizontalAlignment.Left;
     e_13.TabIndex = 7;
     Grid.SetColumn(e_13, 1);
     Grid.SetRow(e_13, 8);
     Binding binding_e_13_Password = new Binding("Password");
     e_13.SetBinding(PasswordBox.PasswordProperty, binding_e_13_Password);
     // e_14 element
     TextBlock e_14 = new TextBlock();
     e_4.Children.Add(e_14);
     e_14.Name = "e_14";
     e_14.VerticalAlignment = VerticalAlignment.Center;
     e_14.Text = "ComboBox";
     Grid.SetRow(e_14, 9);
     // combo element
     ComboBox combo = new ComboBox();
     e_4.Children.Add(combo);
     combo.Name = "combo";
     combo.Width = 200F;
     combo.Margin = new Thickness(5F, 5F, 5F, 5F);
     combo.HorizontalAlignment = HorizontalAlignment.Left;
     combo.TabIndex = 8;
     combo.ItemsSource = Get_combo_Items();
     combo.SelectedIndex = 2;
     Grid.SetColumn(combo, 1);
     Grid.SetRow(combo, 9);
     // e_15 element
     TextBlock e_15 = new TextBlock();
     e_4.Children.Add(e_15);
     e_15.Name = "e_15";
     e_15.VerticalAlignment = VerticalAlignment.Center;
     e_15.Text = "ListBox";
     Grid.SetRow(e_15, 10);
     // e_16 element
     Grid e_16 = new Grid();
     e_4.Children.Add(e_16);
     e_16.Name = "e_16";
     ColumnDefinition col_e_16_0 = new ColumnDefinition();
     e_16.ColumnDefinitions.Add(col_e_16_0);
     ColumnDefinition col_e_16_1 = new ColumnDefinition();
     e_16.ColumnDefinitions.Add(col_e_16_1);
     Grid.SetColumn(e_16, 1);
     Grid.SetRow(e_16, 10);
     // e_17 element
     ListBox e_17 = new ListBox();
     e_16.Children.Add(e_17);
     e_17.Name = "e_17";
     e_17.TabIndex = 9;
     DragDrop.SetIsDragSource(e_17, true);
     DragDrop.SetIsDropTarget(e_17, true);
     Binding binding_e_17_ItemsSource = new Binding("DataOne");
     e_17.SetBinding(ListBox.ItemsSourceProperty, binding_e_17_ItemsSource);
     // e_18 element
     ListBox e_18 = new ListBox();
     e_16.Children.Add(e_18);
     e_18.Name = "e_18";
     e_18.TabIndex = 10;
     Grid.SetColumn(e_18, 1);
     DragDrop.SetIsDragSource(e_18, true);
     DragDrop.SetIsDropTarget(e_18, true);
     Binding binding_e_18_ItemsSource = new Binding("DataTwo");
     e_18.SetBinding(ListBox.ItemsSourceProperty, binding_e_18_ItemsSource);
     // e_19 element
     TextBlock e_19 = new TextBlock();
     e_4.Children.Add(e_19);
     e_19.Name = "e_19";
     e_19.VerticalAlignment = VerticalAlignment.Center;
     e_19.Text = "RadioButton";
     Grid.SetRow(e_19, 11);
     // e_20 element
     StackPanel e_20 = new StackPanel();
     e_4.Children.Add(e_20);
     e_20.Name = "e_20";
     e_20.Orientation = Orientation.Horizontal;
     Grid.SetColumn(e_20, 1);
     Grid.SetRow(e_20, 11);
     // e_21 element
     RadioButton e_21 = new RadioButton();
     e_20.Children.Add(e_21);
     e_21.Name = "e_21";
     e_21.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_21.Content = "Radio Button 1";
     e_21.GroupName = "testGroup1";
     // e_22 element
     RadioButton e_22 = new RadioButton();
     e_20.Children.Add(e_22);
     e_22.Name = "e_22";
     e_22.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_22.Content = "Radio Button 2";
     e_22.GroupName = "testGroup1";
     // e_23 element
     RadioButton e_23 = new RadioButton();
     e_20.Children.Add(e_23);
     e_23.Name = "e_23";
     e_23.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_23.Content = "Radio Button 3";
     e_23.GroupName = "testGroup1";
     // e_24 element
     RadioButton e_24 = new RadioButton();
     e_20.Children.Add(e_24);
     e_24.Name = "e_24";
     e_24.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_24.Content = "Radio Button 4";
     e_24.GroupName = "testGroup2";
     // e_25 element
     RadioButton e_25 = new RadioButton();
     e_20.Children.Add(e_25);
     e_25.Name = "e_25";
     e_25.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_25.Content = "Radio Button 5";
     e_25.GroupName = "testGroup2";
     // e_26 element
     RadioButton e_26 = new RadioButton();
     e_20.Children.Add(e_26);
     e_26.Name = "e_26";
     e_26.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_26.Content = "Radio Button 6";
     e_26.GroupName = "testGroup2";
     items.Add(e_3);
     // e_27 element
     TabItem e_27 = new TabItem();
     e_27.Name = "e_27";
     e_27.Header = "DataGrid";
     // e_28 element
     DataGrid e_28 = new DataGrid();
     e_27.Content = e_28;
     e_28.Name = "e_28";
     e_28.AutoGenerateColumns = false;
     DataGridTextColumn e_28_Col0 = new DataGridTextColumn();
     e_28_Col0.Header = "#";
     Binding e_28_Col0_b = new Binding("Number");
     e_28_Col0.Binding = e_28_Col0_b;
     e_28.Columns.Add(e_28_Col0);
     DataGridTextColumn e_28_Col1 = new DataGridTextColumn();
     e_28_Col1.Width = 200F;
     e_28_Col1.Header = "Text";
     Style e_28_Col1_e_s = new Style(typeof(DataGridCell));
     Setter e_28_Col1_e_s_S_0 = new Setter(DataGridCell.BackgroundProperty, new SolidColorBrush(new ColorW(128, 128, 128, 255)));
     e_28_Col1_e_s.Setters.Add(e_28_Col1_e_s_S_0);
     Setter e_28_Col1_e_s_S_1 = new Setter(DataGridCell.HorizontalAlignmentProperty, HorizontalAlignment.Center);
     e_28_Col1_e_s.Setters.Add(e_28_Col1_e_s_S_1);
     Setter e_28_Col1_e_s_S_2 = new Setter(DataGridCell.VerticalAlignmentProperty, VerticalAlignment.Center);
     e_28_Col1_e_s.Setters.Add(e_28_Col1_e_s_S_2);
     e_28_Col1.ElementStyle = e_28_Col1_e_s;
     Binding e_28_Col1_b = new Binding("Text");
     e_28_Col1.Binding = e_28_Col1_b;
     e_28.Columns.Add(e_28_Col1);
     DataGridCheckBoxColumn e_28_Col2 = new DataGridCheckBoxColumn();
     e_28_Col2.Width = DataGridLength.SizeToHeader;
     e_28_Col2.Header = "Bool";
     Binding e_28_Col2_b = new Binding("Boolean");
     e_28_Col2.Binding = e_28_Col2_b;
     e_28.Columns.Add(e_28_Col2);
     DataGridTemplateColumn e_28_Col3 = new DataGridTemplateColumn();
     e_28_Col3.Width = new DataGridLength(1F, DataGridLengthUnitType.Star);
     // e_29 element
     TextBlock e_29 = new TextBlock();
     e_29.Name = "e_29";
     e_29.Text = "Template Column";
     e_28_Col3.Header = e_29;
     Style e_28_Col3_h_s = new Style(typeof(DataGridColumnHeader));
     Setter e_28_Col3_h_s_S_0 = new Setter(DataGridColumnHeader.ForegroundProperty, new SolidColorBrush(new ColorW(255, 165, 0, 255)));
     e_28_Col3_h_s.Setters.Add(e_28_Col3_h_s_S_0);
     e_28_Col3.HeaderStyle = e_28_Col3_h_s;
     Func<UIElement, UIElement> e_28_Col3_ct_dtFunc = e_28_Col3_ct_dtMethod;
     e_28_Col3.CellTemplate = new DataTemplate(e_28_Col3_ct_dtFunc);
     e_28.Columns.Add(e_28_Col3);
     Binding binding_e_28_ItemsSource = new Binding("GridData");
     e_28.SetBinding(DataGrid.ItemsSourceProperty, binding_e_28_ItemsSource);
     items.Add(e_27);
     // e_35 element
     TabItem e_35 = new TabItem();
     e_35.Name = "e_35";
     e_35.Header = "TreeView";
     // e_36 element
     TreeView e_36 = new TreeView();
     e_35.Content = e_36;
     e_36.Name = "e_36";
     Binding binding_e_36_ItemsSource = new Binding("TreeItems");
     e_36.SetBinding(TreeView.ItemsSourceProperty, binding_e_36_ItemsSource);
     items.Add(e_35);
     // e_37 element
     TabItem e_37 = new TabItem();
     e_37.Name = "e_37";
     e_37.Header = "Chart";
     // e_38 element
     Chart e_38 = new Chart();
     e_37.Content = e_38;
     e_38.Name = "e_38";
     e_38.AxisYMajorUnit = 50F;
     // e_39 element
     LineSeries2D e_39 = new LineSeries2D();
     e_38.Series.Add(e_39);
     e_39.Name = "e_39";
     // p_40 point
     SeriesPoint p_40 = new SeriesPoint();
     e_39.Points.Add(p_40);
     p_40.Argument = 0F;
     p_40.Value = 0F;
     // p_41 point
     SeriesPoint p_41 = new SeriesPoint();
     e_39.Points.Add(p_41);
     p_41.Argument = 1F;
     p_41.Value = 10F;
     // p_42 point
     SeriesPoint p_42 = new SeriesPoint();
     e_39.Points.Add(p_42);
     p_42.Argument = 2F;
     p_42.Value = 20F;
     // p_43 point
     SeriesPoint p_43 = new SeriesPoint();
     e_39.Points.Add(p_43);
     p_43.Argument = 3F;
     p_43.Value = 50F;
     // p_44 point
     SeriesPoint p_44 = new SeriesPoint();
     e_39.Points.Add(p_44);
     p_44.Argument = 4F;
     p_44.Value = 100F;
     // p_45 point
     SeriesPoint p_45 = new SeriesPoint();
     e_39.Points.Add(p_45);
     p_45.Argument = 5F;
     p_45.Value = 200F;
     // p_46 point
     SeriesPoint p_46 = new SeriesPoint();
     e_39.Points.Add(p_46);
     p_46.Argument = 6F;
     p_46.Value = 500F;
     // e_47 element
     LineSeries2D e_47 = new LineSeries2D();
     e_38.Series.Add(e_47);
     e_47.Name = "e_47";
     e_47.Foreground = new SolidColorBrush(new ColorW(255, 165, 0, 255));
     e_47.LineThickness = 1F;
     Binding binding_e_47_DataSource = new Binding("ChartData");
     e_47.SetBinding(LineSeries2D.DataSourceProperty, binding_e_47_DataSource);
     items.Add(e_37);
     // e_48 element
     TabItem e_48 = new TabItem();
     e_48.Name = "e_48";
     e_48.Header = "Shapes";
     // e_49 element
     Grid e_49 = new Grid();
     e_48.Content = e_49;
     e_49.Name = "e_49";
     RowDefinition row_e_49_0 = new RowDefinition();
     e_49.RowDefinitions.Add(row_e_49_0);
     RowDefinition row_e_49_1 = new RowDefinition();
     e_49.RowDefinitions.Add(row_e_49_1);
     RowDefinition row_e_49_2 = new RowDefinition();
     e_49.RowDefinitions.Add(row_e_49_2);
     ColumnDefinition col_e_49_0 = new ColumnDefinition();
     e_49.ColumnDefinitions.Add(col_e_49_0);
     ColumnDefinition col_e_49_1 = new ColumnDefinition();
     e_49.ColumnDefinitions.Add(col_e_49_1);
     ColumnDefinition col_e_49_2 = new ColumnDefinition();
     e_49.ColumnDefinitions.Add(col_e_49_2);
     // e_50 element
     Rectangle e_50 = new Rectangle();
     e_49.Children.Add(e_50);
     e_50.Name = "e_50";
     e_50.Height = 100F;
     e_50.Width = 200F;
     e_50.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_50.Fill = new SolidColorBrush(new ColorW(0, 128, 0, 255));
     e_50.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_50.StrokeThickness = 5F;
     e_50.RadiusX = 10F;
     e_50.RadiusY = 10F;
     // e_51 element
     Rectangle e_51 = new Rectangle();
     e_49.Children.Add(e_51);
     e_51.Name = "e_51";
     e_51.Height = 100F;
     e_51.Width = 200F;
     e_51.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_51.Fill = new SolidColorBrush(new ColorW(255, 165, 0, 255));
     Grid.SetColumn(e_51, 1);
     // e_52 element
     Rectangle e_52 = new Rectangle();
     e_49.Children.Add(e_52);
     e_52.Name = "e_52";
     e_52.Height = 100F;
     e_52.Width = 200F;
     e_52.Margin = new Thickness(5F, 5F, 5F, 5F);
     LinearGradientBrush e_52_Fill = new LinearGradientBrush();
     e_52_Fill.StartPoint = new PointF(0F, 0F);
     e_52_Fill.EndPoint = new PointF(1F, 1F);
     e_52_Fill.SpreadMethod = GradientSpreadMethod.Pad;
     e_52_Fill.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0.5F));
     e_52_Fill.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0F));
     e_52.Fill = e_52_Fill;
     LinearGradientBrush e_52_Stroke = new LinearGradientBrush();
     e_52_Stroke.StartPoint = new PointF(0F, 0F);
     e_52_Stroke.EndPoint = new PointF(1F, 1F);
     e_52_Stroke.SpreadMethod = GradientSpreadMethod.Pad;
     e_52_Stroke.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0.5F));
     e_52_Stroke.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0F));
     e_52.Stroke = e_52_Stroke;
     e_52.StrokeThickness = 5F;
     e_52.RadiusX = 10F;
     e_52.RadiusY = 10F;
     Grid.SetColumn(e_52, 2);
     // e_53 element
     Ellipse e_53 = new Ellipse();
     e_49.Children.Add(e_53);
     e_53.Name = "e_53";
     e_53.Height = 100F;
     e_53.Width = 200F;
     e_53.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_53.Fill = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_53.Stroke = new SolidColorBrush(new ColorW(0, 128, 0, 255));
     e_53.StrokeThickness = 10F;
     Grid.SetRow(e_53, 1);
     // e_54 element
     Ellipse e_54 = new Ellipse();
     e_49.Children.Add(e_54);
     e_54.Name = "e_54";
     e_54.Height = 100F;
     e_54.Width = 200F;
     e_54.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_54.Stroke = new SolidColorBrush(new ColorW(255, 165, 0, 255));
     e_54.StrokeThickness = 10F;
     Grid.SetColumn(e_54, 1);
     Grid.SetRow(e_54, 1);
     // e_55 element
     Ellipse e_55 = new Ellipse();
     e_49.Children.Add(e_55);
     e_55.Name = "e_55";
     e_55.Height = 100F;
     e_55.Width = 200F;
     e_55.Margin = new Thickness(5F, 5F, 5F, 5F);
     LinearGradientBrush e_55_Fill = new LinearGradientBrush();
     e_55_Fill.StartPoint = new PointF(0F, 0F);
     e_55_Fill.EndPoint = new PointF(1F, 1F);
     e_55_Fill.SpreadMethod = GradientSpreadMethod.Pad;
     e_55_Fill.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0.5F));
     e_55_Fill.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0F));
     e_55.Fill = e_55_Fill;
     LinearGradientBrush e_55_Stroke = new LinearGradientBrush();
     e_55_Stroke.StartPoint = new PointF(0F, 0F);
     e_55_Stroke.EndPoint = new PointF(1F, 1F);
     e_55_Stroke.SpreadMethod = GradientSpreadMethod.Pad;
     e_55_Stroke.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0.5F));
     e_55_Stroke.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0F));
     e_55.Stroke = e_55_Stroke;
     e_55.StrokeThickness = 10F;
     Grid.SetColumn(e_55, 2);
     Grid.SetRow(e_55, 1);
     // e_56 element
     Line e_56 = new Line();
     e_49.Children.Add(e_56);
     e_56.Name = "e_56";
     e_56.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_56.StrokeThickness = 10F;
     e_56.X1 = 10F;
     e_56.X2 = 150F;
     e_56.Y1 = 10F;
     e_56.Y2 = 150F;
     Grid.SetRow(e_56, 2);
     // e_57 element
     Line e_57 = new Line();
     e_49.Children.Add(e_57);
     e_57.Name = "e_57";
     e_57.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_57.StrokeThickness = 10F;
     e_57.X1 = 100F;
     e_57.X2 = 100F;
     e_57.Y1 = 10F;
     e_57.Y2 = 100F;
     Grid.SetRow(e_57, 2);
     // e_58 element
     Line e_58 = new Line();
     e_49.Children.Add(e_58);
     e_58.Name = "e_58";
     e_58.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_58.StrokeThickness = 10F;
     e_58.X1 = 10F;
     e_58.X2 = 100F;
     e_58.Y1 = 100F;
     e_58.Y2 = 100F;
     Grid.SetRow(e_58, 2);
     // e_59 element
     Rectangle e_59 = new Rectangle();
     e_49.Children.Add(e_59);
     e_59.Name = "e_59";
     e_59.Height = 100F;
     e_59.Width = 200F;
     e_59.Margin = new Thickness(5F, 5F, 5F, 5F);
     ImageBrush e_59_Fill = new ImageBrush();
     BitmapImage e_59_Fill_bm = new BitmapImage();
     e_59_Fill_bm.TextureAsset = "Images/MonoGameLogo";
     e_59_Fill.ImageSource = e_59_Fill_bm;
     e_59_Fill.Stretch = Stretch.None;
     e_59.Fill = e_59_Fill;
     e_59.Stroke = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_59.StrokeThickness = 1F;
     e_59.RadiusX = 10F;
     e_59.RadiusY = 10F;
     Grid.SetColumn(e_59, 1);
     Grid.SetRow(e_59, 2);
     // e_60 element
     Image e_60 = new Image();
     e_49.Children.Add(e_60);
     e_60.Name = "e_60";
     Grid.SetColumn(e_60, 2);
     Grid.SetRow(e_60, 2);
     Binding binding_e_60_Source = new Binding("RenderTargetSource");
     e_60.SetBinding(Image.SourceProperty, binding_e_60_Source);
     items.Add(e_48);
     // e_61 element
     TabItem e_61 = new TabItem();
     e_61.Name = "e_61";
     e_61.Header = "Animations";
     // e_62 element
     Grid e_62 = new Grid();
     e_61.Content = e_62;
     e_62.Name = "e_62";
     ColumnDefinition col_e_62_0 = new ColumnDefinition();
     e_62.ColumnDefinitions.Add(col_e_62_0);
     ColumnDefinition col_e_62_1 = new ColumnDefinition();
     e_62.ColumnDefinitions.Add(col_e_62_1);
     // e_63 element
     StackPanel e_63 = new StackPanel();
     e_62.Children.Add(e_63);
     e_63.Name = "e_63";
     // animButton1 element
     Button animButton1 = new Button();
     e_63.Children.Add(animButton1);
     animButton1.Name = "animButton1";
     animButton1.TabIndex = 1;
     animButton1.Content = "Mouse Over me!";
     animButton1.SetResourceReference(Button.StyleProperty, "buttonAnimStyle");
     // animButton2 element
     Button animButton2 = new Button();
     e_63.Children.Add(animButton2);
     animButton2.Name = "animButton2";
     animButton2.TabIndex = 2;
     animButton2.Content = "Mouse Over me!";
     animButton2.SetResourceReference(Button.StyleProperty, "buttonAnimStyle");
     // animButton3 element
     Button animButton3 = new Button();
     e_63.Children.Add(animButton3);
     animButton3.Name = "animButton3";
     animButton3.TabIndex = 3;
     animButton3.Content = "Mouse Over me!";
     animButton3.SetResourceReference(Button.StyleProperty, "buttonAnimStyle");
     // animButton4 element
     Button animButton4 = new Button();
     e_63.Children.Add(animButton4);
     animButton4.Name = "animButton4";
     animButton4.TabIndex = 4;
     animButton4.Content = "Mouse Over me!";
     animButton4.SetResourceReference(Button.StyleProperty, "buttonAnimStyle");
     // animBorder1 element
     Border animBorder1 = new Border();
     e_62.Children.Add(animBorder1);
     animBorder1.Name = "animBorder1";
     animBorder1.Height = 100F;
     animBorder1.Width = 200F;
     animBorder1.Margin = new Thickness(0F, 10F, 0F, 10F);
     animBorder1.VerticalAlignment = VerticalAlignment.Top;
     EventTrigger animBorder1_ET_0 = new EventTrigger(Border.LoadedEvent, animBorder1);
     animBorder1.Triggers.Add(animBorder1_ET_0);
     BeginStoryboard animBorder1_ET_0_AC_0 = new BeginStoryboard();
     animBorder1_ET_0_AC_0.Name = "animBorder1_ET_0_AC_0";
     animBorder1_ET_0.AddAction(animBorder1_ET_0_AC_0);
     Storyboard animBorder1_ET_0_AC_0_SB = new Storyboard();
     animBorder1_ET_0_AC_0.Storyboard = animBorder1_ET_0_AC_0_SB;
     animBorder1_ET_0_AC_0_SB.Name = "animBorder1_ET_0_AC_0_SB";
     SolidColorBrushAnimation animBorder1_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation();
     animBorder1_ET_0_AC_0_SB_TL_0.Name = "animBorder1_ET_0_AC_0_SB_TL_0";
     animBorder1_ET_0_AC_0_SB_TL_0.AutoReverse = true;
     animBorder1_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 5, 0));
     animBorder1_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever;
     animBorder1_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 255, 0, 255);
     animBorder1_ET_0_AC_0_SB_TL_0.To = new ColorW(0, 0, 255, 255);
     ExponentialEase animBorder1_ET_0_AC_0_SB_TL_0_EA = new ExponentialEase();
     animBorder1_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder1_ET_0_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetName(animBorder1_ET_0_AC_0_SB_TL_0, "animBorder1");
     Storyboard.SetTargetProperty(animBorder1_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty);
     animBorder1_ET_0_AC_0_SB.Children.Add(animBorder1_ET_0_AC_0_SB_TL_0);
     Grid.SetColumn(animBorder1, 1);
     // animBorder2 element
     Border animBorder2 = new Border();
     e_62.Children.Add(animBorder2);
     animBorder2.Name = "animBorder2";
     animBorder2.Height = 50F;
     animBorder2.Width = 100F;
     animBorder2.Margin = new Thickness(50F, 35F, 50F, 35F);
     animBorder2.VerticalAlignment = VerticalAlignment.Top;
     EventTrigger animBorder2_ET_0 = new EventTrigger(Border.LoadedEvent, animBorder2);
     animBorder2.Triggers.Add(animBorder2_ET_0);
     BeginStoryboard animBorder2_ET_0_AC_0 = new BeginStoryboard();
     animBorder2_ET_0_AC_0.Name = "animBorder2_ET_0_AC_0";
     animBorder2_ET_0.AddAction(animBorder2_ET_0_AC_0);
     Storyboard animBorder2_ET_0_AC_0_SB = new Storyboard();
     animBorder2_ET_0_AC_0.Storyboard = animBorder2_ET_0_AC_0_SB;
     animBorder2_ET_0_AC_0_SB.Name = "animBorder2_ET_0_AC_0_SB";
     SolidColorBrushAnimation animBorder2_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation();
     animBorder2_ET_0_AC_0_SB_TL_0.Name = "animBorder2_ET_0_AC_0_SB_TL_0";
     animBorder2_ET_0_AC_0_SB_TL_0.AutoReverse = true;
     animBorder2_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 3, 0));
     animBorder2_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever;
     animBorder2_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 0, 0, 255);
     animBorder2_ET_0_AC_0_SB_TL_0.To = new ColorW(255, 255, 255, 255);
     CubicEase animBorder2_ET_0_AC_0_SB_TL_0_EA = new CubicEase();
     animBorder2_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder2_ET_0_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_0, "animBorder2");
     Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty);
     animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_0);
     FloatAnimation animBorder2_ET_0_AC_0_SB_TL_1 = new FloatAnimation();
     animBorder2_ET_0_AC_0_SB_TL_1.Name = "animBorder2_ET_0_AC_0_SB_TL_1";
     animBorder2_ET_0_AC_0_SB_TL_1.AutoReverse = true;
     animBorder2_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 4, 0));
     animBorder2_ET_0_AC_0_SB_TL_1.RepeatBehavior = RepeatBehavior.Forever;
     animBorder2_ET_0_AC_0_SB_TL_1.From = 1F;
     animBorder2_ET_0_AC_0_SB_TL_1.To = 0F;
     Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_1, "animBorder2");
     Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_1, Border.OpacityProperty);
     animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_1);
     Grid.SetColumn(animBorder2, 1);
     items.Add(e_61);
     // e_64 element
     TabItem e_64 = new TabItem();
     e_64.Name = "e_64";
     e_64.Header = "Tetris";
     // e_65 element
     Border e_65 = new Border();
     e_64.Content = e_65;
     e_65.Name = "e_65";
     // e_66 element
     Grid e_66 = new Grid();
     e_65.Child = e_66;
     e_66.Name = "e_66";
     e_66.Margin = new Thickness(10F, 10F, 10F, 10F);
     RowDefinition row_e_66_0 = new RowDefinition();
     row_e_66_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_66.RowDefinitions.Add(row_e_66_0);
     RowDefinition row_e_66_1 = new RowDefinition();
     row_e_66_1.Height = new GridLength(420F, GridUnitType.Pixel);
     e_66.RowDefinitions.Add(row_e_66_1);
     ColumnDefinition col_e_66_0 = new ColumnDefinition();
     e_66.ColumnDefinitions.Add(col_e_66_0);
     ColumnDefinition col_e_66_1 = new ColumnDefinition();
     e_66.ColumnDefinitions.Add(col_e_66_1);
     ColumnDefinition col_e_66_2 = new ColumnDefinition();
     e_66.ColumnDefinitions.Add(col_e_66_2);
     // e_67 element
     StackPanel e_67 = new StackPanel();
     e_66.Children.Add(e_67);
     e_67.Name = "e_67";
     e_67.HorizontalAlignment = HorizontalAlignment.Right;
     e_67.Orientation = Orientation.Vertical;
     Grid.SetRow(e_67, 1);
     // e_68 element
     TextBlock e_68 = new TextBlock();
     e_67.Children.Add(e_68);
     e_68.Name = "e_68";
     e_68.Text = "Next";
     // e_69 element
     Border e_69 = new Border();
     e_67.Children.Add(e_69);
     e_69.Name = "e_69";
     e_69.Height = 81F;
     e_69.Width = 81F;
     e_69.BorderBrush = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_69.BorderThickness = new Thickness(0F, 0F, 1F, 1F);
     // tetrisNextContainer1 element
     Canvas tetrisNextContainer1 = new Canvas();
     e_69.Child = tetrisNextContainer1;
     tetrisNextContainer1.Name = "tetrisNextContainer1";
     tetrisNextContainer1.Height = 80F;
     tetrisNextContainer1.Width = 80F;
     // e_70 element
     Border e_70 = new Border();
     e_66.Children.Add(e_70);
     e_70.Name = "e_70";
     e_70.Height = 401F;
     e_70.Width = 201F;
     e_70.BorderBrush = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_70.BorderThickness = new Thickness(0F, 0F, 1F, 1F);
     Grid.SetColumn(e_70, 1);
     Grid.SetRow(e_70, 1);
     // tetrisContainer1 element
     Canvas tetrisContainer1 = new Canvas();
     e_70.Child = tetrisContainer1;
     tetrisContainer1.Name = "tetrisContainer1";
     tetrisContainer1.Height = 400F;
     tetrisContainer1.Width = 200F;
     tetrisContainer1.HorizontalAlignment = HorizontalAlignment.Left;
     tetrisContainer1.VerticalAlignment = VerticalAlignment.Top;
     // e_71 element
     Grid e_71 = new Grid();
     e_66.Children.Add(e_71);
     e_71.Name = "e_71";
     RowDefinition row_e_71_0 = new RowDefinition();
     row_e_71_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_71.RowDefinitions.Add(row_e_71_0);
     RowDefinition row_e_71_1 = new RowDefinition();
     row_e_71_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_71.RowDefinitions.Add(row_e_71_1);
     ColumnDefinition col_e_71_0 = new ColumnDefinition();
     col_e_71_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_71.ColumnDefinitions.Add(col_e_71_0);
     ColumnDefinition col_e_71_1 = new ColumnDefinition();
     col_e_71_1.Width = new GridLength(1F, GridUnitType.Star);
     e_71.ColumnDefinitions.Add(col_e_71_1);
     ColumnDefinition col_e_71_2 = new ColumnDefinition();
     col_e_71_2.Width = new GridLength(1F, GridUnitType.Auto);
     e_71.ColumnDefinitions.Add(col_e_71_2);
     Grid.SetColumnSpan(e_71, 3);
     Binding binding_e_71_DataContext = new Binding("Tetris");
     e_71.SetBinding(Grid.DataContextProperty, binding_e_71_DataContext);
     // e_72 element
     Button e_72 = new Button();
     e_71.Children.Add(e_72);
     e_72.Name = "e_72";
     e_72.Height = 30F;
     e_72.Content = "Start";
     Grid.SetColumnSpan(e_72, 3);
     Binding binding_e_72_Command = new Binding("StartCommand");
     e_72.SetBinding(Button.CommandProperty, binding_e_72_Command);
     // e_73 element
     Grid e_73 = new Grid();
     e_71.Children.Add(e_73);
     e_73.Name = "e_73";
     RowDefinition row_e_73_0 = new RowDefinition();
     row_e_73_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_73.RowDefinitions.Add(row_e_73_0);
     ColumnDefinition col_e_73_0 = new ColumnDefinition();
     e_73.ColumnDefinitions.Add(col_e_73_0);
     ColumnDefinition col_e_73_1 = new ColumnDefinition();
     col_e_73_1.Width = new GridLength(70F, GridUnitType.Pixel);
     e_73.ColumnDefinitions.Add(col_e_73_1);
     ColumnDefinition col_e_73_2 = new ColumnDefinition();
     e_73.ColumnDefinitions.Add(col_e_73_2);
     Grid.SetColumn(e_73, 1);
     Grid.SetRow(e_73, 1);
     // spPlayer1 element
     StackPanel spPlayer1 = new StackPanel();
     e_73.Children.Add(spPlayer1);
     spPlayer1.Name = "spPlayer1";
     spPlayer1.HorizontalAlignment = HorizontalAlignment.Right;
     spPlayer1.Orientation = Orientation.Vertical;
     // e_74 element
     TextBlock e_74 = new TextBlock();
     spPlayer1.Children.Add(e_74);
     e_74.Name = "e_74";
     Binding binding_e_74_Text = new Binding("Score");
     e_74.SetBinding(TextBlock.TextProperty, binding_e_74_Text);
     // e_75 element
     TextBlock e_75 = new TextBlock();
     spPlayer1.Children.Add(e_75);
     e_75.Name = "e_75";
     Binding binding_e_75_Text = new Binding("Lines");
     e_75.SetBinding(TextBlock.TextProperty, binding_e_75_Text);
     // e_76 element
     TextBlock e_76 = new TextBlock();
     spPlayer1.Children.Add(e_76);
     e_76.Name = "e_76";
     Binding binding_e_76_Text = new Binding("Level");
     e_76.SetBinding(TextBlock.TextProperty, binding_e_76_Text);
     // e_77 element
     StackPanel e_77 = new StackPanel();
     e_73.Children.Add(e_77);
     e_77.Name = "e_77";
     e_77.HorizontalAlignment = HorizontalAlignment.Center;
     e_77.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_77, 1);
     // e_78 element
     TextBlock e_78 = new TextBlock();
     e_77.Children.Add(e_78);
     e_78.Name = "e_78";
     e_78.Text = "SCORE";
     // e_79 element
     TextBlock e_79 = new TextBlock();
     e_77.Children.Add(e_79);
     e_79.Name = "e_79";
     e_79.Text = "LINES";
     // e_80 element
     TextBlock e_80 = new TextBlock();
     e_77.Children.Add(e_80);
     e_80.Name = "e_80";
     e_80.Text = "LEVEL";
     // e_81 element
     StackPanel e_81 = new StackPanel();
     e_73.Children.Add(e_81);
     e_81.Name = "e_81";
     e_81.HorizontalAlignment = HorizontalAlignment.Left;
     e_81.Orientation = Orientation.Horizontal;
     // e_82 element
     TextBlock e_82 = new TextBlock();
     e_81.Children.Add(e_82);
     e_82.Name = "e_82";
     e_82.Text = "Use A,S,D,W for left, down, right, rotate";
     items.Add(e_64);
     // e_83 element
     TabItem e_83 = new TabItem();
     e_83.Name = "e_83";
     e_83.Header = "User Control";
     // e_84 element
     UserControlTest e_84 = new UserControlTest();
     e_83.Content = e_84;
     e_84.Name = "e_84";
     items.Add(e_83);
     return items;
 }
		/// <summary>
		/// When overridden in a derived class, gets a read-only element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding"/> property value.
		/// </summary>
		/// <param name="cell">The cell that will contain the generated element.</param>
		/// <param name="dataItem">The data item represented by the row that contains the intended cell.</param>
		/// <returns>
		/// A new, read-only element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding"/> property value.
		/// </returns>
		protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
		{
			TextBlock block = new TextBlock()
			{
				Margin = new Thickness(4.0),
				VerticalAlignment = VerticalAlignment.Center
			};
			if (!string.IsNullOrEmpty(Field) && this.CodedValueSources != null)
			{
				nameConverter.Field = this.Field;
				Binding binding =
#if SILVERLIGHT
				new Binding();
#else
				new Binding("Attributes["+Field+"]");
#endif
				binding.Mode = BindingMode.OneWay;
				binding.Converter = nameConverter;
				binding.ConverterParameter = this.CodedValueSources;									
				block.SetBinding(TextBlock.TextProperty, binding);
			}
			return block;
		}
Exemple #52
0
        private void InitPopup()
        {
            Binding fontSizeBinding = new Binding("FontSize");
            fontSizeBinding.Source = this;

            Binding fontWeightBinding = new Binding("FontWeight");
            fontWeightBinding.Source = this;

            Binding foregroundBinding = new Binding("Foreground");
            foregroundBinding.Source = this;

            popup = new Popup();
            popup.VerticalOffset = SystemTray.IsVisible ? 30 : 0;

            Grid grid = new Grid();
            grid.MinHeight = MinHeight;
            grid.Width = Application.Current.Host.Content.ActualWidth;
            PlaneProjection projection = new PlaneProjection()
            {
                RotationX = -90
            };
            grid.Projection = projection;

            Binding backBinding = new Binding("Background");
            backBinding.Source = this;
            grid.SetBinding(Grid.BackgroundProperty, backBinding);

            ColumnDefinition col1 = new ColumnDefinition()
            {
                Width = GridLength.Auto
            };
            ColumnDefinition col2 = new ColumnDefinition()
            {
                Width = GridLength.Auto
            };
            ColumnDefinition col3 = new ColumnDefinition();

            grid.ColumnDefinitions.Add(col1);
            grid.ColumnDefinitions.Add(col2);
            grid.ColumnDefinitions.Add(col3);

            Image imgIcon = new Image();
            imgIcon.Margin = new Thickness(4);
            Binding imgBinding = new Binding("Icon");
            imgBinding.Source = this;

            var imageMaxWidthBinding = new Binding("MinHeight");
            imageMaxWidthBinding.Source = this;
            imgIcon.SetBinding(Image.MaxWidthProperty, imageMaxWidthBinding);
            imgIcon.Stretch = Stretch.Fill;
            imgIcon.SetBinding(Image.SourceProperty, imgBinding);
            grid.Children.Add(imgIcon);

            TextBlock tbkTitle = new TextBlock();
            tbkTitle.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            tbkTitle.Margin = new Thickness(4);
            Binding titleBinding = new Binding("Title");
            titleBinding.Source = this;
            tbkTitle.SetBinding(TextBlock.TextProperty, titleBinding);
            tbkTitle.SetBinding(TextBlock.FontSizeProperty, fontSizeBinding);
            tbkTitle.SetBinding(TextBlock.FontWeightProperty, fontWeightBinding);
            tbkTitle.SetBinding(TextBlock.ForegroundProperty, foregroundBinding);
            tbkTitle.SetValue(Grid.ColumnProperty, 1);
            grid.Children.Add(tbkTitle);

            TextBlock tbkContent = new TextBlock();
            tbkContent.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            tbkContent.Margin = new Thickness(4);
            Binding contentBinding = new Binding("Content");
            contentBinding.Source = this;
            tbkContent.SetBinding(TextBlock.TextProperty, contentBinding);
            tbkContent.SetBinding(TextBlock.FontSizeProperty, fontSizeBinding);
            tbkContent.SetBinding(TextBlock.FontWeightProperty, fontWeightBinding);
            tbkContent.SetBinding(TextBlock.ForegroundProperty, foregroundBinding);
            tbkContent.SetValue(Grid.ColumnProperty, 2);
            grid.Children.Add(tbkContent);

            popup.Child = grid;
        }
        private void Button_Load(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                FeatureSet featureSet = FeatureSet.FromJson(JsonTextBox.Text);

                GraphicsLayer graphicsLayerFromFeatureSet = new GraphicsLayer()
                {
                    Graphics = new GraphicCollection(featureSet)
                };

                if (!featureSet.SpatialReference.Equals(MyMap.SpatialReference))
                {
                    if (MyMap.SpatialReference.Equals(new SpatialReference(102100)) &&
                        featureSet.SpatialReference.Equals(new SpatialReference(4326)))
                        foreach (Graphic g in graphicsLayerFromFeatureSet.Graphics)
                            g.Geometry = _mercator.FromGeographic(g.Geometry);

                    else if (MyMap.SpatialReference.Equals(new SpatialReference(4326)) &&
                        featureSet.SpatialReference.Equals(new SpatialReference(102100)))
                        foreach (Graphic g in graphicsLayerFromFeatureSet.Graphics)
                            g.Geometry = _mercator.ToGeographic(g.Geometry);

                    else
                    {
                        GeometryService geometryService =
                            new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

                        geometryService.ProjectCompleted += (s, a) =>
                        {
                            for (int i = 0; i < a.Results.Count; i++)
                                graphicsLayerFromFeatureSet.Graphics[i].Geometry = a.Results[i].Geometry;
                        };

                        geometryService.Failed += (s, a) =>
                        {
                            MessageBox.Show("Projection error: " + a.Error.Message);
                        };

                        geometryService.ProjectAsync(graphicsLayerFromFeatureSet.Graphics, MyMap.SpatialReference);
                    }
                }

                SimpleRenderer simpleRenderer = new SimpleRenderer();
                SolidColorBrush symbolColor = new SolidColorBrush(Colors.Blue);
                graphicsLayerFromFeatureSet.Renderer = simpleRenderer;

                if (featureSet.GeometryType == GeometryType.Polygon || featureSet.GeometryType == GeometryType.Polygon)
                {
                    simpleRenderer.Symbol = new SimpleFillSymbol()
                    {
                        Fill = symbolColor
                    };
                }
                else if (featureSet.GeometryType == GeometryType.Polyline)
                {
                    simpleRenderer.Symbol = new SimpleLineSymbol()
                    {
                        Color = symbolColor
                    };
                }
                else // Point
                {
                    simpleRenderer.Symbol = new SimpleMarkerSymbol()
                    {
                        Color = symbolColor,
                        Size = 12
                    };
                }

                myInfoWindow = new InfoWindow()
                {
                    Background = new SolidColorBrush(Colors.Black),
                    BorderBrush = new SolidColorBrush(Colors.White),
                    BorderThickness = new Thickness(1),
                    CornerRadius = 10,
                    Map = MyMap,
                };
                myInfoWindow.MouseLeftButtonDown += myInfoWindow_MouseLeftButtonDown;

                StackPanel stackPanelParent = new StackPanel()
                {
                    Orientation = System.Windows.Controls.Orientation.Vertical,
                    Margin = new Thickness(12)
                };

                foreach (KeyValuePair<string, string> keyvalue in featureSet.FieldAliases)
                {
                    StackPanel stackPanelChild = new StackPanel()
                    {
                        Orientation = System.Windows.Controls.Orientation.Horizontal,
                        Margin = new Thickness(0, 0, 0, 6)
                    };
                    TextBlock textValue = new TextBlock()
                    {
                        Text = keyvalue.Value + ": "
                    };

                    TextBlock textKey = new TextBlock();
                    Binding keyBinding = new Binding(string.Format("[{0}]", keyvalue.Key));
                    textKey.SetBinding(TextBlock.TextProperty, keyBinding);

                    stackPanelChild.Children.Add(textValue);
                    stackPanelChild.Children.Add(textKey);

                    if (keyvalue.Key == featureSet.DisplayFieldName)
                    {
                        textKey.FontWeight = textValue.FontWeight = FontWeights.Bold;
                        stackPanelParent.Children.Insert(0, stackPanelChild);
                    }
                    else
                        stackPanelParent.Children.Add(stackPanelChild);

                }

                myInfoWindow.Content = stackPanelParent;
                ContentPanel.Children.Add(myInfoWindow);

                MyMap.Layers.Add(graphicsLayerFromFeatureSet);
                graphicsLayerFromFeatureSet.MouseLeftButtonDown += graphicsLayerFromFeatureSet_MouseLeftButtonDown;
                JsonPivot.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "GraphicsLayer creation failed", MessageBoxButton.OK);
            }
        }
Exemple #54
0
    protected void UpdateMods()
    {
        foreach (KeyValuePair<string, Mod> kv in Mod.Mods)
        {
            bool add = true;
            ModViewModel alreadyVM = null;
            foreach (ListViewItem i in _Mods)
            {
                ModViewModel vm = ((ModViewModel)i.DataContext);
                if (vm.versions.Values.Contains(kv.Value))
                {
                    add = false;
                }
                if (vm.ID == kv.Value.ID)
                {
                    alreadyVM = vm;
                }
            }
            if (add)
            {
                Mod mod = kv.Value;
                if (alreadyVM != null)
                {
                    alreadyVM.versions.Add(Mod.Header.ParseModVersion(mod.header.GetVersion()), mod);
                    alreadyVM.OnPropertyChanged("Version");
                    alreadyVM.OnPropertyChanged("Name");
                }
                else
                {
                    ListViewItem item = new ListViewItem();

                    StackPanel outerPanel = new StackPanel();
                    outerPanel.Orientation = Orientation.Horizontal;
                    outerPanel.Margin = new Thickness(-5, 0, 0, 0);
                    CheckBox checkBox = new CheckBox();
                    checkBox.SetBinding(CheckBox.IsCheckedProperty, "Selected");
                    outerPanel.Children.Add(checkBox);

                    StackPanel panel = new StackPanel();

                    TextBlock textBlock = new TextBlock();
                    textBlock.SetBinding(TextBlock.TextProperty, "Name");
                    panel.Children.Add(textBlock);

                    TextBlock textBlock2 = new TextBlock();
                    textBlock2.SetBinding(TextBlock.TextProperty, "Version");
                    textBlock2.FontSize = 14;
                    panel.Children.Add(textBlock2);
                    outerPanel.Children.Add(panel);

                    ModViewModel mvm = new ModViewModel(mod);
                    item.DataContext = mvm;
                    item.Content = outerPanel;
                    _Mods.Add(item);
                }
            }
        }

        foreach (ListViewItem item in _Mods)
        {
            ModViewModel vm = (ModViewModel)item.DataContext;
            vm.Initialized();
        }
        _FirstBatchLoaded = true;
        if (_SelectNewestModVersions)
            SelectNewestVersions();
    }
 private static UIElement r_3_dtMethod(UIElement parent)
 {
     // e_2 element
     Border e_2 = new Border();
     e_2.Parent = parent;
     e_2.Name = "e_2";
     e_2.Background = new SolidColorBrush(new ColorW(0, 0, 255, 255));
     // e_3 element
     StackPanel e_3 = new StackPanel();
     e_2.Child = e_3;
     e_3.Name = "e_3";
     // e_4 element
     TextBlock e_4 = new TextBlock();
     e_3.Children.Add(e_4);
     e_4.Name = "e_4";
     e_4.HorizontalAlignment = HorizontalAlignment.Center;
     e_4.VerticalAlignment = VerticalAlignment.Center;
     Binding binding_e_4_Text = new Binding("TextData");
     binding_e_4_Text.UseGeneratedBindings = true;
     e_4.SetBinding(TextBlock.TextProperty, binding_e_4_Text);
     // e_5 element
     TextBlock e_5 = new TextBlock();
     e_3.Children.Add(e_5);
     e_5.Name = "e_5";
     e_5.HorizontalAlignment = HorizontalAlignment.Center;
     e_5.VerticalAlignment = VerticalAlignment.Center;
     Binding binding_e_5_Text = new Binding("ManualBinding");
     binding_e_5_Text.UseGeneratedBindings = true;
     e_5.SetBinding(TextBlock.TextProperty, binding_e_5_Text);
     // e_6 element
     Button e_6 = new Button();
     e_3.Children.Add(e_6);
     e_6.Name = "e_6";
     e_6.Content = "Hide Window";
     Binding binding_e_6_Command = new Binding("HideCommand");
     binding_e_6_Command.UseGeneratedBindings = true;
     e_6.SetBinding(Button.CommandProperty, binding_e_6_Command);
     return e_2;
 }
Exemple #56
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_TabControl_Items()
 {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // e_3 element
     TabItem e_3 = new TabItem();
     e_3.Name = "e_3";
     e_3.HorizontalContentAlignment = HorizontalAlignment.Stretch;
     e_3.Header = "Controls";
     // e_4 element
     Grid e_4 = new Grid();
     e_3.Content = e_4;
     e_4.Name = "e_4";
     RowDefinition row_e_4_0 = new RowDefinition();
     row_e_4_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_0);
     RowDefinition row_e_4_1 = new RowDefinition();
     row_e_4_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_1);
     RowDefinition row_e_4_2 = new RowDefinition();
     row_e_4_2.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_2);
     RowDefinition row_e_4_3 = new RowDefinition();
     row_e_4_3.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_3);
     RowDefinition row_e_4_4 = new RowDefinition();
     row_e_4_4.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_4);
     RowDefinition row_e_4_5 = new RowDefinition();
     row_e_4_5.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_5);
     RowDefinition row_e_4_6 = new RowDefinition();
     row_e_4_6.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_6);
     RowDefinition row_e_4_7 = new RowDefinition();
     row_e_4_7.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_7);
     RowDefinition row_e_4_8 = new RowDefinition();
     row_e_4_8.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_8);
     RowDefinition row_e_4_9 = new RowDefinition();
     row_e_4_9.Height = new GridLength(1F, GridUnitType.Auto);
     e_4.RowDefinitions.Add(row_e_4_9);
     ColumnDefinition col_e_4_0 = new ColumnDefinition();
     col_e_4_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_4.ColumnDefinitions.Add(col_e_4_0);
     ColumnDefinition col_e_4_1 = new ColumnDefinition();
     e_4.ColumnDefinitions.Add(col_e_4_1);
     // e_5 element
     TextBlock e_5 = new TextBlock();
     e_4.Children.Add(e_5);
     e_5.Name = "e_5";
     e_5.VerticalAlignment = VerticalAlignment.Center;
     e_5.Text = "Button";
     // button1 element
     Button button1 = new Button();
     e_4.Children.Add(button1);
     button1.Name = "button1";
     button1.Height = 30F;
     button1.Width = 200F;
     button1.Margin = new Thickness(5F, 5F, 5F, 5F);
     button1.HorizontalAlignment = HorizontalAlignment.Left;
     button1.TabIndex = 1;
     button1.Content = "Button 1";
     button1.CommandParameter = "Click Button 1";
     Grid.SetColumn(button1, 1);
     Grid.SetRow(button1, 0);
     Binding binding_button1_Command = new Binding("ButtonCommand");
     button1.SetBinding(Button.CommandProperty, binding_button1_Command);
     // button2 element
     Button button2 = new Button();
     e_4.Children.Add(button2);
     button2.Name = "button2";
     button2.Height = 30F;
     button2.Width = 200F;
     button2.Margin = new Thickness(5F, 5F, 5F, 5F);
     button2.HorizontalAlignment = HorizontalAlignment.Left;
     button2.TabIndex = 2;
     button2.Content = "Button 2";
     button2.CommandParameter = "Click Button 2";
     Grid.SetColumn(button2, 1);
     Grid.SetRow(button2, 1);
     Binding binding_button2_IsEnabled = new Binding("ButtonEnabled");
     button2.SetBinding(Button.IsEnabledProperty, binding_button2_IsEnabled);
     Binding binding_button2_Command = new Binding("ButtonCommand");
     button2.SetBinding(Button.CommandProperty, binding_button2_Command);
     // buttonResult element
     TextBlock buttonResult = new TextBlock();
     e_4.Children.Add(buttonResult);
     buttonResult.Name = "buttonResult";
     buttonResult.HorizontalAlignment = HorizontalAlignment.Left;
     Grid.SetColumn(buttonResult, 1);
     Grid.SetRow(buttonResult, 2);
     Binding binding_buttonResult_Text = new Binding("ButtonResult");
     buttonResult.SetBinding(TextBlock.TextProperty, binding_buttonResult_Text);
     // e_6 element
     TextBlock e_6 = new TextBlock();
     e_4.Children.Add(e_6);
     e_6.Name = "e_6";
     e_6.VerticalAlignment = VerticalAlignment.Center;
     e_6.Text = "CheckBox";
     Grid.SetRow(e_6, 3);
     // checkBox element
     CheckBox checkBox = new CheckBox();
     e_4.Children.Add(checkBox);
     checkBox.Name = "checkBox";
     checkBox.Margin = new Thickness(5F, 5F, 5F, 5F);
     checkBox.HorizontalAlignment = HorizontalAlignment.Left;
     checkBox.TabIndex = 3;
     checkBox.Content = "Check Box";
     Grid.SetColumn(checkBox, 1);
     Grid.SetRow(checkBox, 3);
     // e_7 element
     TextBlock e_7 = new TextBlock();
     e_4.Children.Add(e_7);
     e_7.Name = "e_7";
     e_7.VerticalAlignment = VerticalAlignment.Center;
     e_7.Text = "ProgressBar";
     Grid.SetRow(e_7, 4);
     // e_8 element
     ProgressBar e_8 = new ProgressBar();
     e_4.Children.Add(e_8);
     e_8.Name = "e_8";
     e_8.Height = 30F;
     e_8.Width = 200F;
     e_8.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_8.HorizontalAlignment = HorizontalAlignment.Left;
     Grid.SetColumn(e_8, 1);
     Grid.SetRow(e_8, 4);
     Binding binding_e_8_Value = new Binding("ProgressValue");
     e_8.SetBinding(ProgressBar.ValueProperty, binding_e_8_Value);
     // e_9 element
     TextBlock e_9 = new TextBlock();
     e_4.Children.Add(e_9);
     e_9.Name = "e_9";
     e_9.VerticalAlignment = VerticalAlignment.Center;
     e_9.Text = "Slider";
     Grid.SetRow(e_9, 5);
     // slider element
     Slider slider = new Slider();
     e_4.Children.Add(slider);
     slider.Name = "slider";
     slider.Width = 200F;
     slider.HorizontalAlignment = HorizontalAlignment.Left;
     slider.TabIndex = 4;
     slider.Minimum = 5F;
     slider.Maximum = 20F;
     Grid.SetColumn(slider, 1);
     Grid.SetRow(slider, 5);
     Binding binding_slider_Value = new Binding("SliderValue");
     slider.SetBinding(Slider.ValueProperty, binding_slider_Value);
     // e_10 element
     TextBlock e_10 = new TextBlock();
     e_4.Children.Add(e_10);
     e_10.Name = "e_10";
     e_10.VerticalAlignment = VerticalAlignment.Center;
     e_10.Text = "TextBox";
     Grid.SetRow(e_10, 6);
     // textBox element
     TextBox textBox = new TextBox();
     e_4.Children.Add(textBox);
     textBox.Name = "textBox";
     textBox.Width = 200F;
     textBox.Margin = new Thickness(5F, 5F, 5F, 5F);
     textBox.HorizontalAlignment = HorizontalAlignment.Left;
     textBox.TabIndex = 5;
     Grid.SetColumn(textBox, 1);
     Grid.SetRow(textBox, 6);
     Binding binding_textBox_Text = new Binding("TextBoxText");
     textBox.SetBinding(TextBox.TextProperty, binding_textBox_Text);
     // e_11 element
     TextBlock e_11 = new TextBlock();
     e_4.Children.Add(e_11);
     e_11.Name = "e_11";
     e_11.VerticalAlignment = VerticalAlignment.Center;
     e_11.Text = "PasswordBox";
     Grid.SetRow(e_11, 7);
     // e_12 element
     PasswordBox e_12 = new PasswordBox();
     e_4.Children.Add(e_12);
     e_12.Name = "e_12";
     e_12.Width = 200F;
     e_12.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_12.HorizontalAlignment = HorizontalAlignment.Left;
     e_12.TabIndex = 6;
     Grid.SetColumn(e_12, 1);
     Grid.SetRow(e_12, 7);
     // e_13 element
     TextBlock e_13 = new TextBlock();
     e_4.Children.Add(e_13);
     e_13.Name = "e_13";
     e_13.VerticalAlignment = VerticalAlignment.Center;
     e_13.Text = "ComboBox";
     Grid.SetRow(e_13, 8);
     // combo element
     ComboBox combo = new ComboBox();
     e_4.Children.Add(combo);
     combo.Name = "combo";
     combo.Width = 200F;
     combo.Margin = new Thickness(5F, 5F, 5F, 5F);
     combo.HorizontalAlignment = HorizontalAlignment.Left;
     combo.TabIndex = 7;
     combo.ItemsSource = Get_combo_Items();
     combo.SelectedIndex = 2;
     Grid.SetColumn(combo, 1);
     Grid.SetRow(combo, 8);
     // e_14 element
     TextBlock e_14 = new TextBlock();
     e_4.Children.Add(e_14);
     e_14.Name = "e_14";
     e_14.VerticalAlignment = VerticalAlignment.Center;
     e_14.Text = "ListBox";
     Grid.SetRow(e_14, 9);
     // e_15 element
     ListBox e_15 = new ListBox();
     e_4.Children.Add(e_15);
     e_15.Name = "e_15";
     e_15.TabIndex = 8;
     e_15.ItemsSource = Get_e_15_Items();
     Grid.SetColumn(e_15, 1);
     Grid.SetRow(e_15, 9);
     items.Add(e_3);
     // e_22 element
     TabItem e_22 = new TabItem();
     e_22.Name = "e_22";
     e_22.Header = "DataGrid";
     // e_23 element
     DataGrid e_23 = new DataGrid();
     e_22.Content = e_23;
     e_23.Name = "e_23";
     e_23.AutoGenerateColumns = false;
     DataGridTextColumn e_23_Col0 = new DataGridTextColumn();
     e_23_Col0.Header = "#";
     Binding e_23_Col0_b = new Binding("Number");
     e_23_Col0.Binding = e_23_Col0_b;
     e_23.Columns.Add(e_23_Col0);
     DataGridTextColumn e_23_Col1 = new DataGridTextColumn();
     e_23_Col1.Header = "Text";
     Style e_23_Col1_e_s = new Style(typeof(DataGridCell));
     Setter e_23_Col1_e_s_S_0 = new Setter(DataGridCell.BackgroundProperty, new SolidColorBrush(new ColorW(128, 128, 128, 255)));
     e_23_Col1_e_s.Setters.Add(e_23_Col1_e_s_S_0);
     Setter e_23_Col1_e_s_S_1 = new Setter(DataGridCell.HorizontalAlignmentProperty, HorizontalAlignment.Center);
     e_23_Col1_e_s.Setters.Add(e_23_Col1_e_s_S_1);
     Setter e_23_Col1_e_s_S_2 = new Setter(DataGridCell.VerticalAlignmentProperty, VerticalAlignment.Center);
     e_23_Col1_e_s.Setters.Add(e_23_Col1_e_s_S_2);
     e_23_Col1.ElementStyle = e_23_Col1_e_s;
     Binding e_23_Col1_b = new Binding("Text");
     e_23_Col1.Binding = e_23_Col1_b;
     e_23.Columns.Add(e_23_Col1);
     DataGridCheckBoxColumn e_23_Col2 = new DataGridCheckBoxColumn();
     e_23_Col2.Header = "Bool";
     Binding e_23_Col2_b = new Binding("Boolean");
     e_23_Col2.Binding = e_23_Col2_b;
     e_23.Columns.Add(e_23_Col2);
     DataGridTemplateColumn e_23_Col3 = new DataGridTemplateColumn();
     e_23_Col3.Width = 200F;
     // e_24 element
     TextBlock e_24 = new TextBlock();
     e_24.Name = "e_24";
     e_24.Text = "Template Column";
     e_23_Col3.Header = e_24;
     Style e_23_Col3_h_s = new Style(typeof(DataGridColumnHeader));
     Setter e_23_Col3_h_s_S_0 = new Setter(DataGridColumnHeader.ForegroundProperty, new SolidColorBrush(new ColorW(255, 165, 0, 255)));
     e_23_Col3_h_s.Setters.Add(e_23_Col3_h_s_S_0);
     e_23_Col3.HeaderStyle = e_23_Col3_h_s;
     Func<UIElement, UIElement> e_23_Col3_ct_dtFunc = e_23_Col3_ct_dtMethod;
     e_23_Col3.CellTemplate = new DataTemplate(e_23_Col3_ct_dtFunc);
     e_23.Columns.Add(e_23_Col3);
     Binding binding_e_23_ItemsSource = new Binding("GridData");
     e_23.SetBinding(DataGrid.ItemsSourceProperty, binding_e_23_ItemsSource);
     items.Add(e_22);
     // e_30 element
     TabItem e_30 = new TabItem();
     e_30.Name = "e_30";
     e_30.Header = "TreeView";
     // e_31 element
     TreeView e_31 = new TreeView();
     e_30.Content = e_31;
     e_31.Name = "e_31";
     Binding binding_e_31_ItemsSource = new Binding("TreeItems");
     e_31.SetBinding(TreeView.ItemsSourceProperty, binding_e_31_ItemsSource);
     items.Add(e_30);
     // e_32 element
     TabItem e_32 = new TabItem();
     e_32.Name = "e_32";
     e_32.Header = "Shapes";
     // e_33 element
     Grid e_33 = new Grid();
     e_32.Content = e_33;
     e_33.Name = "e_33";
     RowDefinition row_e_33_0 = new RowDefinition();
     e_33.RowDefinitions.Add(row_e_33_0);
     RowDefinition row_e_33_1 = new RowDefinition();
     e_33.RowDefinitions.Add(row_e_33_1);
     RowDefinition row_e_33_2 = new RowDefinition();
     e_33.RowDefinitions.Add(row_e_33_2);
     ColumnDefinition col_e_33_0 = new ColumnDefinition();
     e_33.ColumnDefinitions.Add(col_e_33_0);
     ColumnDefinition col_e_33_1 = new ColumnDefinition();
     e_33.ColumnDefinitions.Add(col_e_33_1);
     ColumnDefinition col_e_33_2 = new ColumnDefinition();
     e_33.ColumnDefinitions.Add(col_e_33_2);
     // e_34 element
     Rectangle e_34 = new Rectangle();
     e_33.Children.Add(e_34);
     e_34.Name = "e_34";
     e_34.Height = 100F;
     e_34.Width = 200F;
     e_34.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_34.Fill = new SolidColorBrush(new ColorW(0, 128, 0, 255));
     e_34.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_34.StrokeThickness = 5F;
     e_34.RadiusX = 10F;
     e_34.RadiusY = 10F;
     // e_35 element
     Rectangle e_35 = new Rectangle();
     e_33.Children.Add(e_35);
     e_35.Name = "e_35";
     e_35.Height = 100F;
     e_35.Width = 200F;
     e_35.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_35.Fill = new SolidColorBrush(new ColorW(255, 165, 0, 255));
     Grid.SetColumn(e_35, 1);
     // e_36 element
     Rectangle e_36 = new Rectangle();
     e_33.Children.Add(e_36);
     e_36.Name = "e_36";
     e_36.Height = 100F;
     e_36.Width = 200F;
     e_36.Margin = new Thickness(5F, 5F, 5F, 5F);
     LinearGradientBrush e_36_Fill = new LinearGradientBrush();
     e_36_Fill.StartPoint = new PointF(0F, 0F);
     e_36_Fill.EndPoint = new PointF(1F, 1F);
     e_36_Fill.SpreadMethod = GradientSpreadMethod.Pad;
     e_36_Fill.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0.5F));
     e_36_Fill.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0F));
     e_36.Fill = e_36_Fill;
     LinearGradientBrush e_36_Stroke = new LinearGradientBrush();
     e_36_Stroke.StartPoint = new PointF(0F, 0F);
     e_36_Stroke.EndPoint = new PointF(1F, 1F);
     e_36_Stroke.SpreadMethod = GradientSpreadMethod.Pad;
     e_36_Stroke.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0.5F));
     e_36_Stroke.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0F));
     e_36.Stroke = e_36_Stroke;
     e_36.StrokeThickness = 5F;
     e_36.RadiusX = 10F;
     e_36.RadiusY = 10F;
     Grid.SetColumn(e_36, 2);
     // e_37 element
     Ellipse e_37 = new Ellipse();
     e_33.Children.Add(e_37);
     e_37.Name = "e_37";
     e_37.Height = 100F;
     e_37.Width = 200F;
     e_37.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_37.Fill = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_37.Stroke = new SolidColorBrush(new ColorW(0, 128, 0, 255));
     e_37.StrokeThickness = 10F;
     Grid.SetRow(e_37, 1);
     // e_38 element
     Ellipse e_38 = new Ellipse();
     e_33.Children.Add(e_38);
     e_38.Name = "e_38";
     e_38.Height = 100F;
     e_38.Width = 200F;
     e_38.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_38.Stroke = new SolidColorBrush(new ColorW(255, 165, 0, 255));
     e_38.StrokeThickness = 10F;
     Grid.SetColumn(e_38, 1);
     Grid.SetRow(e_38, 1);
     // e_39 element
     Ellipse e_39 = new Ellipse();
     e_33.Children.Add(e_39);
     e_39.Name = "e_39";
     e_39.Height = 100F;
     e_39.Width = 200F;
     e_39.Margin = new Thickness(5F, 5F, 5F, 5F);
     LinearGradientBrush e_39_Fill = new LinearGradientBrush();
     e_39_Fill.StartPoint = new PointF(0F, 0F);
     e_39_Fill.EndPoint = new PointF(1F, 1F);
     e_39_Fill.SpreadMethod = GradientSpreadMethod.Pad;
     e_39_Fill.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0.5F));
     e_39_Fill.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0F));
     e_39.Fill = e_39_Fill;
     LinearGradientBrush e_39_Stroke = new LinearGradientBrush();
     e_39_Stroke.StartPoint = new PointF(0F, 0F);
     e_39_Stroke.EndPoint = new PointF(1F, 1F);
     e_39_Stroke.SpreadMethod = GradientSpreadMethod.Pad;
     e_39_Stroke.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0.5F));
     e_39_Stroke.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0F));
     e_39.Stroke = e_39_Stroke;
     e_39.StrokeThickness = 10F;
     Grid.SetColumn(e_39, 2);
     Grid.SetRow(e_39, 1);
     // e_40 element
     Line e_40 = new Line();
     e_33.Children.Add(e_40);
     e_40.Name = "e_40";
     e_40.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_40.StrokeThickness = 10F;
     e_40.X1 = 10F;
     e_40.X2 = 150F;
     e_40.Y1 = 10F;
     e_40.Y2 = 150F;
     Grid.SetRow(e_40, 2);
     // e_41 element
     Line e_41 = new Line();
     e_33.Children.Add(e_41);
     e_41.Name = "e_41";
     e_41.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_41.StrokeThickness = 10F;
     e_41.X1 = 100F;
     e_41.X2 = 100F;
     e_41.Y1 = 10F;
     e_41.Y2 = 100F;
     Grid.SetRow(e_41, 2);
     // e_42 element
     Line e_42 = new Line();
     e_33.Children.Add(e_42);
     e_42.Name = "e_42";
     e_42.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_42.StrokeThickness = 10F;
     e_42.X1 = 10F;
     e_42.X2 = 100F;
     e_42.Y1 = 100F;
     e_42.Y2 = 100F;
     Grid.SetRow(e_42, 2);
     // e_43 element
     Rectangle e_43 = new Rectangle();
     e_33.Children.Add(e_43);
     e_43.Name = "e_43";
     e_43.Height = 100F;
     e_43.Width = 200F;
     e_43.Margin = new Thickness(5F, 5F, 5F, 5F);
     ImageBrush e_43_Fill = new ImageBrush();
     BitmapImage e_43_Fill_bm = new BitmapImage();
     e_43_Fill_bm.TextureAsset = "Images/MonoGameLogo";
     e_43_Fill.ImageSource = e_43_Fill_bm;
     e_43_Fill.Stretch = Stretch.None;
     e_43.Fill = e_43_Fill;
     e_43.Stroke = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_43.StrokeThickness = 1F;
     e_43.RadiusX = 10F;
     e_43.RadiusY = 10F;
     Grid.SetColumn(e_43, 1);
     Grid.SetRow(e_43, 2);
     items.Add(e_32);
     // e_44 element
     TabItem e_44 = new TabItem();
     e_44.Name = "e_44";
     e_44.Header = "Animations";
     // e_45 element
     Grid e_45 = new Grid();
     e_44.Content = e_45;
     e_45.Name = "e_45";
     ColumnDefinition col_e_45_0 = new ColumnDefinition();
     e_45.ColumnDefinitions.Add(col_e_45_0);
     ColumnDefinition col_e_45_1 = new ColumnDefinition();
     e_45.ColumnDefinitions.Add(col_e_45_1);
     // e_46 element
     StackPanel e_46 = new StackPanel();
     e_45.Children.Add(e_46);
     e_46.Name = "e_46";
     // animButton1 element
     Button animButton1 = new Button();
     e_46.Children.Add(animButton1);
     animButton1.Name = "animButton1";
     animButton1.TabIndex = 1;
     animButton1.Content = "Mouse Over me!";
     animButton1.SetResourceReference(Button.StyleProperty, "buttonAnimStyle");
     // animButton2 element
     Button animButton2 = new Button();
     e_46.Children.Add(animButton2);
     animButton2.Name = "animButton2";
     animButton2.TabIndex = 2;
     animButton2.Content = "Mouse Over me!";
     animButton2.SetResourceReference(Button.StyleProperty, "buttonAnimStyle");
     // animButton3 element
     Button animButton3 = new Button();
     e_46.Children.Add(animButton3);
     animButton3.Name = "animButton3";
     animButton3.TabIndex = 3;
     animButton3.Content = "Mouse Over me!";
     animButton3.SetResourceReference(Button.StyleProperty, "buttonAnimStyle");
     // animButton4 element
     Button animButton4 = new Button();
     e_46.Children.Add(animButton4);
     animButton4.Name = "animButton4";
     animButton4.TabIndex = 4;
     animButton4.Content = "Mouse Over me!";
     animButton4.SetResourceReference(Button.StyleProperty, "buttonAnimStyle");
     // animBorder1 element
     Border animBorder1 = new Border();
     e_45.Children.Add(animBorder1);
     animBorder1.Name = "animBorder1";
     animBorder1.Height = 100F;
     animBorder1.Width = 200F;
     animBorder1.Margin = new Thickness(0F, 10F, 0F, 10F);
     animBorder1.VerticalAlignment = VerticalAlignment.Top;
     EventTrigger animBorder1_ET_0 = new EventTrigger(Border.LoadedEvent, animBorder1);
     animBorder1.Triggers.Add(animBorder1_ET_0);
     BeginStoryboard animBorder1_ET_0_AC_0 = new BeginStoryboard();
     animBorder1_ET_0_AC_0.Name = "animBorder1_ET_0_AC_0";
     animBorder1_ET_0.AddAction(animBorder1_ET_0_AC_0);
     Storyboard animBorder1_ET_0_AC_0_SB = new Storyboard();
     animBorder1_ET_0_AC_0.Storyboard = animBorder1_ET_0_AC_0_SB;
     animBorder1_ET_0_AC_0_SB.Name = "animBorder1_ET_0_AC_0_SB";
     SolidColorBrushAnimation animBorder1_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation();
     animBorder1_ET_0_AC_0_SB_TL_0.Name = "animBorder1_ET_0_AC_0_SB_TL_0";
     animBorder1_ET_0_AC_0_SB_TL_0.AutoReverse = true;
     animBorder1_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 5, 0));
     animBorder1_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever;
     animBorder1_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 255, 0, 255);
     animBorder1_ET_0_AC_0_SB_TL_0.To = new ColorW(0, 0, 255, 255);
     ExponentialEase animBorder1_ET_0_AC_0_SB_TL_0_EA = new ExponentialEase();
     animBorder1_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder1_ET_0_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetName(animBorder1_ET_0_AC_0_SB_TL_0, "animBorder1");
     Storyboard.SetTargetProperty(animBorder1_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty);
     animBorder1_ET_0_AC_0_SB.Children.Add(animBorder1_ET_0_AC_0_SB_TL_0);
     Grid.SetColumn(animBorder1, 1);
     // animBorder2 element
     Border animBorder2 = new Border();
     e_45.Children.Add(animBorder2);
     animBorder2.Name = "animBorder2";
     animBorder2.Height = 50F;
     animBorder2.Width = 100F;
     animBorder2.Margin = new Thickness(50F, 35F, 50F, 35F);
     animBorder2.VerticalAlignment = VerticalAlignment.Top;
     EventTrigger animBorder2_ET_0 = new EventTrigger(Border.LoadedEvent, animBorder2);
     animBorder2.Triggers.Add(animBorder2_ET_0);
     BeginStoryboard animBorder2_ET_0_AC_0 = new BeginStoryboard();
     animBorder2_ET_0_AC_0.Name = "animBorder2_ET_0_AC_0";
     animBorder2_ET_0.AddAction(animBorder2_ET_0_AC_0);
     Storyboard animBorder2_ET_0_AC_0_SB = new Storyboard();
     animBorder2_ET_0_AC_0.Storyboard = animBorder2_ET_0_AC_0_SB;
     animBorder2_ET_0_AC_0_SB.Name = "animBorder2_ET_0_AC_0_SB";
     SolidColorBrushAnimation animBorder2_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation();
     animBorder2_ET_0_AC_0_SB_TL_0.Name = "animBorder2_ET_0_AC_0_SB_TL_0";
     animBorder2_ET_0_AC_0_SB_TL_0.AutoReverse = true;
     animBorder2_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 3, 0));
     animBorder2_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever;
     animBorder2_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 0, 0, 255);
     animBorder2_ET_0_AC_0_SB_TL_0.To = new ColorW(255, 255, 255, 255);
     CubicEase animBorder2_ET_0_AC_0_SB_TL_0_EA = new CubicEase();
     animBorder2_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder2_ET_0_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_0, "animBorder2");
     Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty);
     animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_0);
     FloatAnimation animBorder2_ET_0_AC_0_SB_TL_1 = new FloatAnimation();
     animBorder2_ET_0_AC_0_SB_TL_1.Name = "animBorder2_ET_0_AC_0_SB_TL_1";
     animBorder2_ET_0_AC_0_SB_TL_1.AutoReverse = true;
     animBorder2_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 4, 0));
     animBorder2_ET_0_AC_0_SB_TL_1.RepeatBehavior = RepeatBehavior.Forever;
     animBorder2_ET_0_AC_0_SB_TL_1.From = 1F;
     animBorder2_ET_0_AC_0_SB_TL_1.To = 0F;
     Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_1, "animBorder2");
     Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_1, Border.OpacityProperty);
     animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_1);
     Grid.SetColumn(animBorder2, 1);
     items.Add(e_44);
     // e_47 element
     TabItem e_47 = new TabItem();
     e_47.Name = "e_47";
     e_47.Header = "Tetris";
     // e_48 element
     Border e_48 = new Border();
     e_47.Content = e_48;
     e_48.Name = "e_48";
     // e_49 element
     Grid e_49 = new Grid();
     e_48.Child = e_49;
     e_49.Name = "e_49";
     e_49.Margin = new Thickness(10F, 10F, 10F, 10F);
     RowDefinition row_e_49_0 = new RowDefinition();
     row_e_49_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_49.RowDefinitions.Add(row_e_49_0);
     RowDefinition row_e_49_1 = new RowDefinition();
     row_e_49_1.Height = new GridLength(420F, GridUnitType.Pixel);
     e_49.RowDefinitions.Add(row_e_49_1);
     ColumnDefinition col_e_49_0 = new ColumnDefinition();
     e_49.ColumnDefinitions.Add(col_e_49_0);
     ColumnDefinition col_e_49_1 = new ColumnDefinition();
     e_49.ColumnDefinitions.Add(col_e_49_1);
     ColumnDefinition col_e_49_2 = new ColumnDefinition();
     e_49.ColumnDefinitions.Add(col_e_49_2);
     // e_50 element
     StackPanel e_50 = new StackPanel();
     e_49.Children.Add(e_50);
     e_50.Name = "e_50";
     e_50.HorizontalAlignment = HorizontalAlignment.Right;
     e_50.Orientation = Orientation.Vertical;
     Grid.SetRow(e_50, 1);
     // e_51 element
     TextBlock e_51 = new TextBlock();
     e_50.Children.Add(e_51);
     e_51.Name = "e_51";
     e_51.Text = "Next";
     // e_52 element
     Border e_52 = new Border();
     e_50.Children.Add(e_52);
     e_52.Name = "e_52";
     e_52.Height = 81F;
     e_52.Width = 81F;
     e_52.BorderBrush = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_52.BorderThickness = new Thickness(0F, 0F, 1F, 1F);
     // tetrisNextContainer1 element
     Canvas tetrisNextContainer1 = new Canvas();
     e_52.Child = tetrisNextContainer1;
     tetrisNextContainer1.Name = "tetrisNextContainer1";
     tetrisNextContainer1.Height = 80F;
     tetrisNextContainer1.Width = 80F;
     // e_53 element
     Border e_53 = new Border();
     e_49.Children.Add(e_53);
     e_53.Name = "e_53";
     e_53.Height = 401F;
     e_53.Width = 201F;
     e_53.BorderBrush = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_53.BorderThickness = new Thickness(0F, 0F, 1F, 1F);
     Grid.SetColumn(e_53, 1);
     Grid.SetRow(e_53, 1);
     // tetrisContainer1 element
     Canvas tetrisContainer1 = new Canvas();
     e_53.Child = tetrisContainer1;
     tetrisContainer1.Name = "tetrisContainer1";
     tetrisContainer1.Height = 400F;
     tetrisContainer1.Width = 200F;
     tetrisContainer1.HorizontalAlignment = HorizontalAlignment.Left;
     tetrisContainer1.VerticalAlignment = VerticalAlignment.Top;
     // e_54 element
     Grid e_54 = new Grid();
     e_49.Children.Add(e_54);
     e_54.Name = "e_54";
     RowDefinition row_e_54_0 = new RowDefinition();
     row_e_54_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_54.RowDefinitions.Add(row_e_54_0);
     RowDefinition row_e_54_1 = new RowDefinition();
     row_e_54_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_54.RowDefinitions.Add(row_e_54_1);
     ColumnDefinition col_e_54_0 = new ColumnDefinition();
     col_e_54_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_54.ColumnDefinitions.Add(col_e_54_0);
     ColumnDefinition col_e_54_1 = new ColumnDefinition();
     col_e_54_1.Width = new GridLength(1F, GridUnitType.Star);
     e_54.ColumnDefinitions.Add(col_e_54_1);
     ColumnDefinition col_e_54_2 = new ColumnDefinition();
     col_e_54_2.Width = new GridLength(1F, GridUnitType.Auto);
     e_54.ColumnDefinitions.Add(col_e_54_2);
     Grid.SetColumnSpan(e_54, 3);
     Binding binding_e_54_DataContext = new Binding("Tetris");
     e_54.SetBinding(Grid.DataContextProperty, binding_e_54_DataContext);
     // e_55 element
     Button e_55 = new Button();
     e_54.Children.Add(e_55);
     e_55.Name = "e_55";
     e_55.Height = 30F;
     e_55.Content = "Start";
     Grid.SetColumnSpan(e_55, 3);
     Binding binding_e_55_Command = new Binding("StartCommand");
     e_55.SetBinding(Button.CommandProperty, binding_e_55_Command);
     // e_56 element
     Grid e_56 = new Grid();
     e_54.Children.Add(e_56);
     e_56.Name = "e_56";
     RowDefinition row_e_56_0 = new RowDefinition();
     row_e_56_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_56.RowDefinitions.Add(row_e_56_0);
     ColumnDefinition col_e_56_0 = new ColumnDefinition();
     e_56.ColumnDefinitions.Add(col_e_56_0);
     ColumnDefinition col_e_56_1 = new ColumnDefinition();
     col_e_56_1.Width = new GridLength(70F, GridUnitType.Pixel);
     e_56.ColumnDefinitions.Add(col_e_56_1);
     ColumnDefinition col_e_56_2 = new ColumnDefinition();
     e_56.ColumnDefinitions.Add(col_e_56_2);
     Grid.SetColumn(e_56, 1);
     Grid.SetRow(e_56, 1);
     // spPlayer1 element
     StackPanel spPlayer1 = new StackPanel();
     e_56.Children.Add(spPlayer1);
     spPlayer1.Name = "spPlayer1";
     spPlayer1.HorizontalAlignment = HorizontalAlignment.Right;
     spPlayer1.Orientation = Orientation.Vertical;
     // e_57 element
     TextBlock e_57 = new TextBlock();
     spPlayer1.Children.Add(e_57);
     e_57.Name = "e_57";
     Binding binding_e_57_Text = new Binding("Score");
     e_57.SetBinding(TextBlock.TextProperty, binding_e_57_Text);
     // e_58 element
     TextBlock e_58 = new TextBlock();
     spPlayer1.Children.Add(e_58);
     e_58.Name = "e_58";
     Binding binding_e_58_Text = new Binding("Lines");
     e_58.SetBinding(TextBlock.TextProperty, binding_e_58_Text);
     // e_59 element
     TextBlock e_59 = new TextBlock();
     spPlayer1.Children.Add(e_59);
     e_59.Name = "e_59";
     Binding binding_e_59_Text = new Binding("Level");
     e_59.SetBinding(TextBlock.TextProperty, binding_e_59_Text);
     // e_60 element
     StackPanel e_60 = new StackPanel();
     e_56.Children.Add(e_60);
     e_60.Name = "e_60";
     e_60.HorizontalAlignment = HorizontalAlignment.Center;
     e_60.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_60, 1);
     // e_61 element
     TextBlock e_61 = new TextBlock();
     e_60.Children.Add(e_61);
     e_61.Name = "e_61";
     e_61.Text = "SCORE";
     // e_62 element
     TextBlock e_62 = new TextBlock();
     e_60.Children.Add(e_62);
     e_62.Name = "e_62";
     e_62.Text = "LINES";
     // e_63 element
     TextBlock e_63 = new TextBlock();
     e_60.Children.Add(e_63);
     e_63.Name = "e_63";
     e_63.Text = "LEVEL";
     // e_64 element
     StackPanel e_64 = new StackPanel();
     e_56.Children.Add(e_64);
     e_64.Name = "e_64";
     e_64.HorizontalAlignment = HorizontalAlignment.Left;
     e_64.Orientation = Orientation.Horizontal;
     // e_65 element
     TextBlock e_65 = new TextBlock();
     e_64.Children.Add(e_65);
     e_65.Name = "e_65";
     e_65.Text = "Use A,S,D,W for left, down, right, rotate";
     items.Add(e_47);
     return items;
 }
 private static UIElement r_4_dtMethod(UIElement parent)
 {
     // e_7 element
     TextBlock e_7 = new TextBlock();
     e_7.Parent = parent;
     e_7.Name = "e_7";
     e_7.Margin = new Thickness(5F, 5F, 5F, 5F);
     Binding binding_e_7_Text = new Binding("Name");
     binding_e_7_Text.UseGeneratedBindings = true;
     e_7.SetBinding(TextBlock.TextProperty, binding_e_7_Text);
     return e_7;
 }
		/// <summary>
		/// When overridden in a derived class, gets a read-only element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding"/> property value.
		/// </summary>
		/// <param name="cell">The cell that will contain the generated element.</param>
		/// <param name="dataItem">The data item represented by the row that contains the intended cell.</param>
		/// <returns>
		/// A new, read-only element that is bound to the column's <see cref="P:System.Windows.Controls.DataGridBoundColumn.Binding"/> property value.
		/// </returns>
		protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
		{
			TextBlock block = new TextBlock
			{
				Margin = new Thickness(4.0),
				VerticalAlignment = VerticalAlignment.Center
			};
			if (!string.IsNullOrEmpty(Field))
			{
				converter.DateTimeFormat = this.DateTimeFormat;
				converter.DateTimeKind = this.DateTimeKind;

				Binding binding =
#if SILVERLIGHT
				new Binding(Field);
#else
				new Binding("Attributes["+Field+"]");			
#endif
				binding.Mode = BindingMode.OneWay;
				binding.Converter = converter;
				block.SetBinding(TextBlock.TextProperty, binding);
			}
			return block;
		}
Exemple #59
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_PlanetInfoTabs_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // tabInfo element
     TabItem tabInfo = new TabItem();
     tabInfo.Name = "tabInfo";
     tabInfo.Header = "Information";
     // e_94 element
     Grid e_94 = new Grid();
     tabInfo.Content = e_94;
     e_94.Name = "e_94";
     e_94.IsHitTestVisible = false;
     ColumnDefinition col_e_94_0 = new ColumnDefinition();
     col_e_94_0.Width = new GridLength(0.4F, GridUnitType.Star);
     e_94.ColumnDefinitions.Add(col_e_94_0);
     ColumnDefinition col_e_94_1 = new ColumnDefinition();
     col_e_94_1.Width = new GridLength(1F, GridUnitType.Star);
     e_94.ColumnDefinitions.Add(col_e_94_1);
     Binding binding_e_94_DataContext = new Binding("InfoTabData");
     e_94.SetBinding(Grid.DataContextProperty, binding_e_94_DataContext);
     // e_95 element
     StackPanel e_95 = new StackPanel();
     e_94.Children.Add(e_95);
     e_95.Name = "e_95";
     e_95.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_95, 0);
     // e_96 element
     TextBlock e_96 = new TextBlock();
     e_95.Children.Add(e_96);
     e_96.Name = "e_96";
     e_96.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_96_Text = new Binding("PNameText");
     e_96.SetBinding(TextBlock.TextProperty, binding_e_96_Text);
     // e_97 element
     TextBlock e_97 = new TextBlock();
     e_95.Children.Add(e_97);
     e_97.Name = "e_97";
     e_97.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_97_Text = new Binding("PTierText");
     e_97.SetBinding(TextBlock.TextProperty, binding_e_97_Text);
     // e_98 element
     TextBlock e_98 = new TextBlock();
     e_95.Children.Add(e_98);
     e_98.Name = "e_98";
     e_98.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_98_Text = new Binding("PSpeedText");
     e_98.SetBinding(TextBlock.TextProperty, binding_e_98_Text);
     // e_99 element
     TextBlock e_99 = new TextBlock();
     e_95.Children.Add(e_99);
     e_99.Name = "e_99";
     e_99.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_99_Text = new Binding("PDistanceText");
     e_99.SetBinding(TextBlock.TextProperty, binding_e_99_Text);
     // e_100 element
     TextBlock e_100 = new TextBlock();
     e_95.Children.Add(e_100);
     e_100.Name = "e_100";
     e_100.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_100_Text = new Binding("PHabitedText");
     e_100.SetBinding(TextBlock.TextProperty, binding_e_100_Text);
     // e_101 element
     TextBlock e_101 = new TextBlock();
     e_95.Children.Add(e_101);
     e_101.Name = "e_101";
     e_101.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_101_Text = new Binding("PPopulationText");
     e_101.SetBinding(TextBlock.TextProperty, binding_e_101_Text);
     // e_102 element
     TextBlock e_102 = new TextBlock();
     e_95.Children.Add(e_102);
     e_102.Name = "e_102";
     e_102.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_102_Text = new Binding("PPopIncRateText");
     e_102.SetBinding(TextBlock.TextProperty, binding_e_102_Text);
     // e_103 element
     TextBlock e_103 = new TextBlock();
     e_95.Children.Add(e_103);
     e_103.Name = "e_103";
     e_103.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_103_Text = new Binding("POwnerText");
     e_103.SetBinding(TextBlock.TextProperty, binding_e_103_Text);
     // e_104 element
     StackPanel e_104 = new StackPanel();
     e_94.Children.Add(e_104);
     e_104.Name = "e_104";
     e_104.HorizontalAlignment = HorizontalAlignment.Right;
     Grid.SetColumn(e_104, 1);
     // e_105 element
     TextBlock e_105 = new TextBlock();
     e_104.Children.Add(e_105);
     e_105.Name = "e_105";
     e_105.Text = "Map";
     // e_106 element
     Image e_106 = new Image();
     e_104.Children.Add(e_106);
     e_106.Name = "e_106";
     Binding binding_e_106_Source = new Binding("MapImage");
     e_106.SetBinding(Image.SourceProperty, binding_e_106_Source);
     items.Add(tabInfo);
     // tabAdmin element
     TabItem tabAdmin = new TabItem();
     tabAdmin.Name = "tabAdmin";
     tabAdmin.Header = "Administration";
     Binding binding_tabAdmin_IsEnabled = new Binding("IsDetailsEnabled");
     tabAdmin.SetBinding(TabItem.IsEnabledProperty, binding_tabAdmin_IsEnabled);
     // e_107 element
     Grid e_107 = new Grid();
     tabAdmin.Content = e_107;
     e_107.Name = "e_107";
     RowDefinition row_e_107_0 = new RowDefinition();
     row_e_107_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_107.RowDefinitions.Add(row_e_107_0);
     RowDefinition row_e_107_1 = new RowDefinition();
     row_e_107_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_107.RowDefinitions.Add(row_e_107_1);
     ColumnDefinition col_e_107_0 = new ColumnDefinition();
     col_e_107_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_107.ColumnDefinitions.Add(col_e_107_0);
     ColumnDefinition col_e_107_1 = new ColumnDefinition();
     col_e_107_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_107.ColumnDefinitions.Add(col_e_107_1);
     // e_108 element
     StackPanel e_108 = new StackPanel();
     e_107.Children.Add(e_108);
     e_108.Name = "e_108";
     e_108.Width = 200F;
     e_108.Margin = new Thickness(10F, 5F, 0F, 0F);
     e_108.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_108, 0);
     // txtAdminTitle element
     TextBlock txtAdminTitle = new TextBlock();
     e_108.Children.Add(txtAdminTitle);
     txtAdminTitle.Name = "txtAdminTitle";
     txtAdminTitle.Text = "ADMINISTRATION";
     // txtTaxHeader element
     TextBlock txtTaxHeader = new TextBlock();
     e_108.Children.Add(txtTaxHeader);
     txtTaxHeader.Name = "txtTaxHeader";
     txtTaxHeader.Text = "Tax Rate: ";
     // e_109 element
     Slider e_109 = new Slider();
     e_108.Children.Add(e_109);
     e_109.Name = "e_109";
     e_109.Margin = new Thickness(0F, 5F, 0F, 5F);
     e_109.HorizontalAlignment = HorizontalAlignment.Stretch;
     e_109.Minimum = 10F;
     e_109.Maximum = 80F;
     Binding binding_e_109_IsEnabled = new Binding("IsUIEnabled");
     e_109.SetBinding(Slider.IsEnabledProperty, binding_e_109_IsEnabled);
     Binding binding_e_109_Value = new Binding("SliderTaxRate");
     e_109.SetBinding(Slider.ValueProperty, binding_e_109_Value);
     // e_110 element
     Button e_110 = new Button();
     e_108.Children.Add(e_110);
     e_110.Name = "e_110";
     e_110.Height = 25F;
     e_110.Margin = new Thickness(0F, 0F, 5F, 0F);
     Binding binding_e_110_IsEnabled = new Binding("IsUIEnabled");
     e_110.SetBinding(Button.IsEnabledProperty, binding_e_110_IsEnabled);
     Binding binding_e_110_Command = new Binding("ChangeTaxRate");
     e_110.SetBinding(Button.CommandProperty, binding_e_110_Command);
     Binding binding_e_110_Content = new Binding("TaxRate");
     e_110.SetBinding(Button.ContentProperty, binding_e_110_Content);
     items.Add(tabAdmin);
     // tabInfra element
     TabItem tabInfra = new TabItem();
     tabInfra.Name = "tabInfra";
     tabInfra.Header = "Infrastructure";
     Binding binding_tabInfra_IsEnabled = new Binding("IsDetailsEnabled");
     tabInfra.SetBinding(TabItem.IsEnabledProperty, binding_tabInfra_IsEnabled);
     // e_111 element
     Grid e_111 = new Grid();
     tabInfra.Content = e_111;
     e_111.Name = "e_111";
     RowDefinition row_e_111_0 = new RowDefinition();
     row_e_111_0.Height = new GridLength(1.2F, GridUnitType.Star);
     e_111.RowDefinitions.Add(row_e_111_0);
     RowDefinition row_e_111_1 = new RowDefinition();
     e_111.RowDefinitions.Add(row_e_111_1);
     ColumnDefinition col_e_111_0 = new ColumnDefinition();
     col_e_111_0.Width = new GridLength(1.5F, GridUnitType.Star);
     e_111.ColumnDefinitions.Add(col_e_111_0);
     ColumnDefinition col_e_111_1 = new ColumnDefinition();
     e_111.ColumnDefinitions.Add(col_e_111_1);
     // e_112 element
     Border e_112 = new Border();
     e_111.Children.Add(e_112);
     e_112.Name = "e_112";
     e_112.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_112.BorderBrush = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_112.BorderThickness = new Thickness(1.5F, 1.5F, 1.5F, 1.5F);
     Grid.SetColumn(e_112, 0);
     Grid.SetRow(e_112, 0);
     // e_113 element
     StackPanel e_113 = new StackPanel();
     e_112.Child = e_113;
     e_113.Name = "e_113";
     e_113.Margin = new Thickness(0F, 5.5F, 0F, 0F);
     e_113.VerticalAlignment = VerticalAlignment.Top;
     e_113.Orientation = Orientation.Vertical;
     // txtBuildingTitle element
     TextBlock txtBuildingTitle = new TextBlock();
     e_113.Children.Add(txtBuildingTitle);
     txtBuildingTitle.Name = "txtBuildingTitle";
     txtBuildingTitle.Margin = new Thickness(25F, 0F, 0F, 10F);
     txtBuildingTitle.Text = "BUILDINGS";
     // e_114 element
     TabControl e_114 = new TabControl();
     e_113.Children.Add(e_114);
     e_114.Name = "e_114";
     e_114.Margin = new Thickness(5F, 0F, 0F, 0F);
     e_114.ItemsSource = Get_e_114_Items();
     Binding binding_e_114_SelectedIndex = new Binding("CurrentBuildingsTab");
     e_114.SetBinding(TabControl.SelectedIndexProperty, binding_e_114_SelectedIndex);
     // e_143 element
     Border e_143 = new Border();
     e_111.Children.Add(e_143);
     e_143.Name = "e_143";
     e_143.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_143.BorderBrush = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_143.BorderThickness = new Thickness(1.5F, 1.5F, 1.5F, 1.5F);
     Grid.SetRow(e_143, 1);
     // e_144 element
     Grid e_144 = new Grid();
     e_143.Child = e_144;
     e_144.Name = "e_144";
     e_144.Margin = new Thickness(5F, 20F, 0F, 0F);
     e_144.VerticalAlignment = VerticalAlignment.Center;
     RowDefinition row_e_144_0 = new RowDefinition();
     row_e_144_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_144.RowDefinitions.Add(row_e_144_0);
     RowDefinition row_e_144_1 = new RowDefinition();
     row_e_144_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_144.RowDefinitions.Add(row_e_144_1);
     RowDefinition row_e_144_2 = new RowDefinition();
     row_e_144_2.Height = new GridLength(1F, GridUnitType.Auto);
     e_144.RowDefinitions.Add(row_e_144_2);
     ColumnDefinition col_e_144_0 = new ColumnDefinition();
     e_144.ColumnDefinitions.Add(col_e_144_0);
     ColumnDefinition col_e_144_1 = new ColumnDefinition();
     e_144.ColumnDefinitions.Add(col_e_144_1);
     ColumnDefinition col_e_144_2 = new ColumnDefinition();
     e_144.ColumnDefinitions.Add(col_e_144_2);
     Grid.SetColumn(e_144, 0);
     Grid.SetRow(e_144, 1);
     Binding binding_e_144_DataContext = new Binding("PlanetBuildingsData");
     e_144.SetBinding(Grid.DataContextProperty, binding_e_144_DataContext);
     // e_145 element
     TextBlock e_145 = new TextBlock();
     e_144.Children.Add(e_145);
     e_145.Name = "e_145";
     e_145.Margin = new Thickness(5F, 5F, 5F, 5F);
     Grid.SetColumn(e_145, 0);
     Grid.SetRow(e_145, 0);
     Binding binding_e_145_Text = new Binding("CurrentBuilding");
     e_145.SetBinding(TextBlock.TextProperty, binding_e_145_Text);
     // e_146 element
     TextBlock e_146 = new TextBlock();
     e_144.Children.Add(e_146);
     e_146.Name = "e_146";
     e_146.Margin = new Thickness(5F, 5F, 5F, 5F);
     Grid.SetColumn(e_146, 1);
     Grid.SetRow(e_146, 0);
     Binding binding_e_146_Text = new Binding("BuildingProduction");
     e_146.SetBinding(TextBlock.TextProperty, binding_e_146_Text);
     // e_147 element
     Button e_147 = new Button();
     e_144.Children.Add(e_147);
     e_147.Name = "e_147";
     e_147.Margin = new Thickness(5F, 5F, 5F, 5F);
     Grid.SetColumn(e_147, 0);
     Grid.SetRow(e_147, 1);
     Binding binding_e_147_IsEnabled = new Binding("CanUpgrade");
     e_147.SetBinding(Button.IsEnabledProperty, binding_e_147_IsEnabled);
     Binding binding_e_147_Command = new Binding("UpgradeCommand");
     e_147.SetBinding(Button.CommandProperty, binding_e_147_Command);
     Binding binding_e_147_Content = new Binding("UpgradeText");
     e_147.SetBinding(Button.ContentProperty, binding_e_147_Content);
     // e_148 element
     Button e_148 = new Button();
     e_144.Children.Add(e_148);
     e_148.Name = "e_148";
     e_148.Margin = new Thickness(5F, 5F, 5F, 5F);
     Grid.SetColumn(e_148, 0);
     Grid.SetRow(e_148, 2);
     Binding binding_e_148_IsEnabled = new Binding("IsUIEnabled");
     e_148.SetBinding(Button.IsEnabledProperty, binding_e_148_IsEnabled);
     Binding binding_e_148_Command = new Binding("DismantleCommand");
     e_148.SetBinding(Button.CommandProperty, binding_e_148_Command);
     Binding binding_e_148_Content = new Binding("DismantleText");
     e_148.SetBinding(Button.ContentProperty, binding_e_148_Content);
     // e_149 element
     Border e_149 = new Border();
     e_111.Children.Add(e_149);
     e_149.Name = "e_149";
     e_149.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_149.BorderBrush = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_149.BorderThickness = new Thickness(1.5F, 1.5F, 1.5F, 1.5F);
     Grid.SetColumn(e_149, 1);
     Grid.SetRow(e_149, 0);
     // e_150 element
     StackPanel e_150 = new StackPanel();
     e_149.Child = e_150;
     e_150.Name = "e_150";
     e_150.Margin = new Thickness(10F, 5F, 0F, 0F);
     // txtConstTitle element
     TextBlock txtConstTitle = new TextBlock();
     e_150.Children.Add(txtConstTitle);
     txtConstTitle.Name = "txtConstTitle";
     txtConstTitle.Margin = new Thickness(0F, 0F, 0F, 10F);
     txtConstTitle.Text = "CONSTRUCTION";
     // e_151 element
     TabControl e_151 = new TabControl();
     e_150.Children.Add(e_151);
     e_151.Name = "e_151";
     e_151.HorizontalContentAlignment = HorizontalAlignment.Left;
     e_151.ItemsSource = Get_e_151_Items();
     Binding binding_e_151_SelectedIndex = new Binding("SelectedBuildingsToBuildTab");
     e_151.SetBinding(TabControl.SelectedIndexProperty, binding_e_151_SelectedIndex);
     // e_158 element
     Grid e_158 = new Grid();
     e_111.Children.Add(e_158);
     e_158.Name = "e_158";
     RowDefinition row_e_158_0 = new RowDefinition();
     row_e_158_0.Height = new GridLength(1.2F, GridUnitType.Star);
     e_158.RowDefinitions.Add(row_e_158_0);
     RowDefinition row_e_158_1 = new RowDefinition();
     row_e_158_1.Height = new GridLength(1F, GridUnitType.Star);
     e_158.RowDefinitions.Add(row_e_158_1);
     Grid.SetColumn(e_158, 1);
     Grid.SetRow(e_158, 1);
     // e_159 element
     Border e_159 = new Border();
     e_158.Children.Add(e_159);
     e_159.Name = "e_159";
     e_159.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_159.BorderBrush = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_159.BorderThickness = new Thickness(1.5F, 1.5F, 1.5F, 1.5F);
     Grid.SetRow(e_159, 0);
     // e_160 element
     Grid e_160 = new Grid();
     e_159.Child = e_160;
     e_160.Name = "e_160";
     RowDefinition row_e_160_0 = new RowDefinition();
     row_e_160_0.Height = new GridLength(0.5F, GridUnitType.Star);
     e_160.RowDefinitions.Add(row_e_160_0);
     RowDefinition row_e_160_1 = new RowDefinition();
     e_160.RowDefinitions.Add(row_e_160_1);
     RowDefinition row_e_160_2 = new RowDefinition();
     e_160.RowDefinitions.Add(row_e_160_2);
     ColumnDefinition col_e_160_0 = new ColumnDefinition();
     col_e_160_0.Width = new GridLength(1.5F, GridUnitType.Star);
     e_160.ColumnDefinitions.Add(col_e_160_0);
     ColumnDefinition col_e_160_1 = new ColumnDefinition();
     col_e_160_1.Width = new GridLength(1F, GridUnitType.Star);
     e_160.ColumnDefinitions.Add(col_e_160_1);
     Binding binding_e_160_DataContext = new Binding("PlanetBuildingsData");
     e_160.SetBinding(Grid.DataContextProperty, binding_e_160_DataContext);
     // e_161 element
     TextBlock e_161 = new TextBlock();
     e_160.Children.Add(e_161);
     e_161.Name = "e_161";
     e_161.Text = "Buidling options: ";
     e_161.FontStyle = FontStyle.Regular;
     Grid.SetRow(e_161, 0);
     // e_162 element
     StackPanel e_162 = new StackPanel();
     e_160.Children.Add(e_162);
     e_162.Name = "e_162";
     e_162.VerticalAlignment = VerticalAlignment.Top;
     e_162.Orientation = Orientation.Horizontal;
     Grid.SetColumn(e_162, 0);
     Grid.SetRow(e_162, 1);
     // e_163 element
     ComboBox e_163 = new ComboBox();
     e_162.Children.Add(e_163);
     e_163.Name = "e_163";
     e_163.Width = 200F;
     e_163.Margin = new Thickness(5F, 0F, 0F, 0F);
     e_163.VerticalAlignment = VerticalAlignment.Top;
     Binding binding_e_163_Visibility = new Binding("IsResourceExtractor");
     e_163.SetBinding(ComboBox.VisibilityProperty, binding_e_163_Visibility);
     Binding binding_e_163_ItemsSource = new Binding("AvailableResourceExtractors");
     e_163.SetBinding(ComboBox.ItemsSourceProperty, binding_e_163_ItemsSource);
     Binding binding_e_163_SelectedIndex = new Binding("SelectedExtractor");
     e_163.SetBinding(ComboBox.SelectedIndexProperty, binding_e_163_SelectedIndex);
     Binding binding_e_163_SelectedItem = new Binding("SelectedAvailableExtractorsItem");
     e_163.SetBinding(ComboBox.SelectedItemProperty, binding_e_163_SelectedItem);
     // e_164 element
     ComboBox e_164 = new ComboBox();
     e_162.Children.Add(e_164);
     e_164.Name = "e_164";
     e_164.Width = 200F;
     e_164.Margin = new Thickness(5F, 0F, 0F, 0F);
     e_164.VerticalAlignment = VerticalAlignment.Top;
     Binding binding_e_164_Visibility = new Binding("IsOtherBuilding");
     e_164.SetBinding(ComboBox.VisibilityProperty, binding_e_164_Visibility);
     Binding binding_e_164_ItemsSource = new Binding("AvailableBuildings");
     e_164.SetBinding(ComboBox.ItemsSourceProperty, binding_e_164_ItemsSource);
     Binding binding_e_164_SelectedIndex = new Binding("SelectedBuildingToBuild");
     e_164.SetBinding(ComboBox.SelectedIndexProperty, binding_e_164_SelectedIndex);
     Binding binding_e_164_SelectedItem = new Binding("SelectedAvailableBuildingsItem");
     e_164.SetBinding(ComboBox.SelectedItemProperty, binding_e_164_SelectedItem);
     // e_165 element
     StackPanel e_165 = new StackPanel();
     e_160.Children.Add(e_165);
     e_165.Name = "e_165";
     e_165.VerticalAlignment = VerticalAlignment.Top;
     e_165.Orientation = Orientation.Horizontal;
     Grid.SetColumn(e_165, 1);
     Grid.SetRow(e_165, 1);
     // e_166 element
     TextBlock e_166 = new TextBlock();
     e_165.Children.Add(e_166);
     e_166.Name = "e_166";
     e_166.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_166.VerticalAlignment = VerticalAlignment.Center;
     e_166.Text = "Level: ";
     e_166.TextAlignment = TextAlignment.Center;
     // e_167 element
     TextBox e_167 = new TextBox();
     e_165.Children.Add(e_167);
     e_167.Name = "e_167";
     e_167.Width = 30F;
     e_167.Margin = new Thickness(5F, 5F, 5F, 5F);
     Binding binding_e_167_Text = new Binding("BuildingToBuildLevel");
     e_167.SetBinding(TextBox.TextProperty, binding_e_167_Text);
     // e_168 element
     TextBlock e_168 = new TextBlock();
     e_165.Children.Add(e_168);
     e_168.Name = "e_168";
     e_168.Margin = new Thickness(0F, 5F, 5F, 5F);
     e_168.VerticalAlignment = VerticalAlignment.Center;
     e_168.Text = "(1-10)";
     e_168.TextAlignment = TextAlignment.Center;
     // e_169 element
     StackPanel e_169 = new StackPanel();
     e_160.Children.Add(e_169);
     e_169.Name = "e_169";
     e_169.VerticalAlignment = VerticalAlignment.Top;
     e_169.Orientation = Orientation.Horizontal;
     Grid.SetColumn(e_169, 0);
     Grid.SetRow(e_169, 2);
     // e_170 element
     Button e_170 = new Button();
     e_169.Children.Add(e_170);
     e_170.Name = "e_170";
     e_170.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_170.Content = "Change Building Layout";
     Binding binding_e_170_Command = new Binding("ChangeLayoutCommand");
     e_170.SetBinding(Button.CommandProperty, binding_e_170_Command);
     // e_171 element
     Border e_171 = new Border();
     e_158.Children.Add(e_171);
     e_171.Name = "e_171";
     e_171.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_171.BorderBrush = new SolidColorBrush(new ColorW(128, 128, 128, 255));
     e_171.BorderThickness = new Thickness(1.5F, 1.5F, 1.5F, 1.5F);
     Grid.SetRow(e_171, 1);
     // e_172 element
     Grid e_172 = new Grid();
     e_171.Child = e_172;
     e_172.Name = "e_172";
     RowDefinition row_e_172_0 = new RowDefinition();
     e_172.RowDefinitions.Add(row_e_172_0);
     RowDefinition row_e_172_1 = new RowDefinition();
     e_172.RowDefinitions.Add(row_e_172_1);
     ColumnDefinition col_e_172_0 = new ColumnDefinition();
     e_172.ColumnDefinitions.Add(col_e_172_0);
     Binding binding_e_172_DataContext = new Binding("PlanetBuildingsData");
     e_172.SetBinding(Grid.DataContextProperty, binding_e_172_DataContext);
     // e_173 element
     DockPanel e_173 = new DockPanel();
     e_172.Children.Add(e_173);
     e_173.Name = "e_173";
     e_173.VerticalAlignment = VerticalAlignment.Top;
     Grid.SetColumn(e_173, 0);
     Grid.SetRow(e_173, 0);
     // e_174 element
     TextBlock e_174 = new TextBlock();
     e_173.Children.Add(e_174);
     e_174.Name = "e_174";
     e_174.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_174.VerticalAlignment = VerticalAlignment.Center;
     e_174.TextAlignment = TextAlignment.Center;
     Binding binding_e_174_Text = new Binding("BuildingToBuildName");
     e_174.SetBinding(TextBlock.TextProperty, binding_e_174_Text);
     // e_175 element
     TextBlock e_175 = new TextBlock();
     e_173.Children.Add(e_175);
     e_175.Name = "e_175";
     e_175.Margin = new Thickness(5F, 5F, 5F, 5F);
     e_175.HorizontalAlignment = HorizontalAlignment.Right;
     e_175.VerticalAlignment = VerticalAlignment.Center;
     e_175.TextAlignment = TextAlignment.Center;
     Binding binding_e_175_Visibility = new Binding("IsResourceExtractor");
     e_175.SetBinding(TextBlock.VisibilityProperty, binding_e_175_Visibility);
     Binding binding_e_175_Text = new Binding("YieldText");
     e_175.SetBinding(TextBlock.TextProperty, binding_e_175_Text);
     // e_176 element
     StackPanel e_176 = new StackPanel();
     e_172.Children.Add(e_176);
     e_176.Name = "e_176";
     e_176.VerticalAlignment = VerticalAlignment.Top;
     e_176.Orientation = Orientation.Horizontal;
     Grid.SetColumn(e_176, 0);
     Grid.SetRow(e_176, 1);
     // e_177 element
     Button e_177 = new Button();
     e_176.Children.Add(e_177);
     e_177.Name = "e_177";
     e_177.Margin = new Thickness(5F, 5F, 5F, 5F);
     Binding binding_e_177_IsEnabled = new Binding("CanBuild");
     e_177.SetBinding(Button.IsEnabledProperty, binding_e_177_IsEnabled);
     Binding binding_e_177_Command = new Binding("BuildingBuildCommand");
     e_177.SetBinding(Button.CommandProperty, binding_e_177_Command);
     Binding binding_e_177_Content = new Binding("BuildingBuildText");
     e_177.SetBinding(Button.ContentProperty, binding_e_177_Content);
     items.Add(tabInfra);
     // tabRes element
     TabItem tabRes = new TabItem();
     tabRes.Name = "tabRes";
     tabRes.Header = "Resources";
     // e_178 element
     Grid e_178 = new Grid();
     tabRes.Content = e_178;
     e_178.Name = "e_178";
     e_178.HorizontalAlignment = HorizontalAlignment.Stretch;
     RowDefinition row_e_178_0 = new RowDefinition();
     row_e_178_0.Height = new GridLength(30F, GridUnitType.Pixel);
     e_178.RowDefinitions.Add(row_e_178_0);
     RowDefinition row_e_178_1 = new RowDefinition();
     row_e_178_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_178.RowDefinitions.Add(row_e_178_1);
     RowDefinition row_e_178_2 = new RowDefinition();
     row_e_178_2.Height = new GridLength(30F, GridUnitType.Pixel);
     e_178.RowDefinitions.Add(row_e_178_2);
     RowDefinition row_e_178_3 = new RowDefinition();
     row_e_178_3.Height = new GridLength(1F, GridUnitType.Auto);
     e_178.RowDefinitions.Add(row_e_178_3);
     ColumnDefinition col_e_178_0 = new ColumnDefinition();
     col_e_178_0.Width = new GridLength(1.05F, GridUnitType.Star);
     e_178.ColumnDefinitions.Add(col_e_178_0);
     ColumnDefinition col_e_178_1 = new ColumnDefinition();
     col_e_178_1.Width = new GridLength(0.95F, GridUnitType.Star);
     e_178.ColumnDefinitions.Add(col_e_178_1);
     ColumnDefinition col_e_178_2 = new ColumnDefinition();
     col_e_178_2.Width = new GridLength(1.05F, GridUnitType.Star);
     e_178.ColumnDefinitions.Add(col_e_178_2);
     Binding binding_e_178_DataContext = new Binding("PlanetResourcesData");
     e_178.SetBinding(Grid.DataContextProperty, binding_e_178_DataContext);
     // txtMetals element
     TextBlock txtMetals = new TextBlock();
     e_178.Children.Add(txtMetals);
     txtMetals.Name = "txtMetals";
     txtMetals.Height = 20F;
     txtMetals.Text = "METALS";
     Grid.SetColumn(txtMetals, 0);
     Grid.SetRow(txtMetals, 0);
     // e_179 element
     Grid e_179 = new Grid();
     e_178.Children.Add(e_179);
     e_179.Name = "e_179";
     RowDefinition row_e_179_0 = new RowDefinition();
     e_179.RowDefinitions.Add(row_e_179_0);
     ColumnDefinition col_e_179_0 = new ColumnDefinition();
     col_e_179_0.Width = new GridLength(50F, GridUnitType.Pixel);
     e_179.ColumnDefinitions.Add(col_e_179_0);
     ColumnDefinition col_e_179_1 = new ColumnDefinition();
     col_e_179_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_179.ColumnDefinitions.Add(col_e_179_1);
     ColumnDefinition col_e_179_2 = new ColumnDefinition();
     e_179.ColumnDefinitions.Add(col_e_179_2);
     Grid.SetColumn(e_179, 0);
     Grid.SetRow(e_179, 1);
     // e_180 element
     StackPanel e_180 = new StackPanel();
     e_179.Children.Add(e_180);
     e_180.Name = "e_180";
     Grid.SetColumn(e_180, 0);
     Grid.SetRow(e_180, 0);
     // aluminium element
     Image aluminium = new Image();
     e_180.Children.Add(aluminium);
     aluminium.Name = "aluminium";
     aluminium.Height = 30F;
     aluminium.Margin = new Thickness(0F, 15F, 0F, 0F);
     aluminium.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage aluminium_bm = new BitmapImage();
     aluminium_bm.TextureAsset = "ImagesUI\\aluminium_res";
     aluminium.Source = aluminium_bm;
     // copper element
     Image copper = new Image();
     e_180.Children.Add(copper);
     copper.Name = "copper";
     copper.Height = 30F;
     copper.Margin = new Thickness(0F, 0F, 0F, 0F);
     copper.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage copper_bm = new BitmapImage();
     copper_bm.TextureAsset = "ImagesUI\\copper_res";
     copper.Source = copper_bm;
     // iron element
     Image iron = new Image();
     e_180.Children.Add(iron);
     iron.Name = "iron";
     iron.Height = 30F;
     iron.Margin = new Thickness(0F, 0F, 0F, 0F);
     iron.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage iron_bm = new BitmapImage();
     iron_bm.TextureAsset = "ImagesUI\\iron_res";
     iron.Source = iron_bm;
     // lead element
     Image lead = new Image();
     e_180.Children.Add(lead);
     lead.Name = "lead";
     lead.Height = 30F;
     lead.Margin = new Thickness(0F, 0F, 0F, 0F);
     lead.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage lead_bm = new BitmapImage();
     lead_bm.TextureAsset = "ImagesUI\\lead_res";
     lead.Source = lead_bm;
     // magnesium element
     Image magnesium = new Image();
     e_180.Children.Add(magnesium);
     magnesium.Name = "magnesium";
     magnesium.Height = 30F;
     magnesium.Margin = new Thickness(0F, 0F, 0F, 0F);
     magnesium.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage magnesium_bm = new BitmapImage();
     magnesium_bm.TextureAsset = "ImagesUI\\magnesium_res";
     magnesium.Source = magnesium_bm;
     // titanium element
     Image titanium = new Image();
     e_180.Children.Add(titanium);
     titanium.Name = "titanium";
     titanium.Height = 30F;
     titanium.Margin = new Thickness(0F, 0F, 0F, 0F);
     titanium.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage titanium_bm = new BitmapImage();
     titanium_bm.TextureAsset = "ImagesUI\\titanium_res";
     titanium.Source = titanium_bm;
     // zinc element
     Image zinc = new Image();
     e_180.Children.Add(zinc);
     zinc.Name = "zinc";
     zinc.Height = 30F;
     zinc.Margin = new Thickness(0F, 0F, 0F, 0F);
     zinc.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage zinc_bm = new BitmapImage();
     zinc_bm.TextureAsset = "ImagesUI\\zinc_res";
     zinc.Source = zinc_bm;
     // e_181 element
     StackPanel e_181 = new StackPanel();
     e_179.Children.Add(e_181);
     e_181.Name = "e_181";
     e_181.Margin = new Thickness(5F, 0F, 0F, 0F);
     e_181.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_181, 1);
     Grid.SetRow(e_181, 0);
     // e_182 element
     TextBlock e_182 = new TextBlock();
     e_181.Children.Add(e_182);
     e_182.Name = "e_182";
     e_182.Margin = new Thickness(0F, 22F, 0F, 0F);
     e_182.Text = "Aluminium: ";
     // e_183 element
     TextBlock e_183 = new TextBlock();
     e_181.Children.Add(e_183);
     e_183.Name = "e_183";
     e_183.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_183.Text = "Copper: ";
     // e_184 element
     TextBlock e_184 = new TextBlock();
     e_181.Children.Add(e_184);
     e_184.Name = "e_184";
     e_184.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_184.Text = "Iron: ";
     // e_185 element
     TextBlock e_185 = new TextBlock();
     e_181.Children.Add(e_185);
     e_185.Name = "e_185";
     e_185.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_185.Text = "Lead: ";
     // e_186 element
     TextBlock e_186 = new TextBlock();
     e_181.Children.Add(e_186);
     e_186.Name = "e_186";
     e_186.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_186.Text = "Magnesium: ";
     // e_187 element
     TextBlock e_187 = new TextBlock();
     e_181.Children.Add(e_187);
     e_187.Name = "e_187";
     e_187.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_187.Text = "Titanium: ";
     // e_188 element
     TextBlock e_188 = new TextBlock();
     e_181.Children.Add(e_188);
     e_188.Name = "e_188";
     e_188.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_188.Text = "Zinc: ";
     // e_189 element
     StackPanel e_189 = new StackPanel();
     e_179.Children.Add(e_189);
     e_189.Name = "e_189";
     e_189.Margin = new Thickness(5F, 0F, 0F, 0F);
     e_189.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_189, 2);
     Grid.SetRow(e_189, 0);
     // e_190 element
     TextBlock e_190 = new TextBlock();
     e_189.Children.Add(e_190);
     e_190.Name = "e_190";
     e_190.Margin = new Thickness(0F, 22F, 0F, 0F);
     Binding binding_e_190_Text = new Binding("AluminiumResource");
     e_190.SetBinding(TextBlock.TextProperty, binding_e_190_Text);
     // e_191 element
     TextBlock e_191 = new TextBlock();
     e_189.Children.Add(e_191);
     e_191.Name = "e_191";
     e_191.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_191_Text = new Binding("CopperResource");
     e_191.SetBinding(TextBlock.TextProperty, binding_e_191_Text);
     // e_192 element
     TextBlock e_192 = new TextBlock();
     e_189.Children.Add(e_192);
     e_192.Name = "e_192";
     e_192.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_192_Text = new Binding("IronResource");
     e_192.SetBinding(TextBlock.TextProperty, binding_e_192_Text);
     // e_193 element
     TextBlock e_193 = new TextBlock();
     e_189.Children.Add(e_193);
     e_193.Name = "e_193";
     e_193.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_193_Text = new Binding("LeadResource");
     e_193.SetBinding(TextBlock.TextProperty, binding_e_193_Text);
     // e_194 element
     TextBlock e_194 = new TextBlock();
     e_189.Children.Add(e_194);
     e_194.Name = "e_194";
     e_194.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_194_Text = new Binding("MagnesiumResource");
     e_194.SetBinding(TextBlock.TextProperty, binding_e_194_Text);
     // e_195 element
     TextBlock e_195 = new TextBlock();
     e_189.Children.Add(e_195);
     e_195.Name = "e_195";
     e_195.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_195_Text = new Binding("TitaniumResource");
     e_195.SetBinding(TextBlock.TextProperty, binding_e_195_Text);
     // e_196 element
     TextBlock e_196 = new TextBlock();
     e_189.Children.Add(e_196);
     e_196.Name = "e_196";
     e_196.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_196_Text = new Binding("ZincResource");
     e_196.SetBinding(TextBlock.TextProperty, binding_e_196_Text);
     // txtPreciousMetals element
     TextBlock txtPreciousMetals = new TextBlock();
     e_178.Children.Add(txtPreciousMetals);
     txtPreciousMetals.Name = "txtPreciousMetals";
     txtPreciousMetals.Height = 20F;
     txtPreciousMetals.Text = "PRECIOUS METALS & GEMSTONES";
     Grid.SetColumn(txtPreciousMetals, 1);
     Grid.SetRow(txtPreciousMetals, 0);
     // e_197 element
     Grid e_197 = new Grid();
     e_178.Children.Add(e_197);
     e_197.Name = "e_197";
     RowDefinition row_e_197_0 = new RowDefinition();
     e_197.RowDefinitions.Add(row_e_197_0);
     RowDefinition row_e_197_1 = new RowDefinition();
     e_197.RowDefinitions.Add(row_e_197_1);
     ColumnDefinition col_e_197_0 = new ColumnDefinition();
     col_e_197_0.Width = new GridLength(50F, GridUnitType.Pixel);
     e_197.ColumnDefinitions.Add(col_e_197_0);
     ColumnDefinition col_e_197_1 = new ColumnDefinition();
     col_e_197_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_197.ColumnDefinitions.Add(col_e_197_1);
     ColumnDefinition col_e_197_2 = new ColumnDefinition();
     e_197.ColumnDefinitions.Add(col_e_197_2);
     Grid.SetColumn(e_197, 1);
     Grid.SetRow(e_197, 1);
     // e_198 element
     StackPanel e_198 = new StackPanel();
     e_197.Children.Add(e_198);
     e_198.Name = "e_198";
     e_198.Margin = new Thickness(5F, 0F, 0F, 0F);
     Grid.SetColumn(e_198, 0);
     Grid.SetRow(e_198, 0);
     // silver element
     Image silver = new Image();
     e_198.Children.Add(silver);
     silver.Name = "silver";
     silver.Height = 30F;
     silver.Margin = new Thickness(0F, 15F, 0F, 0F);
     silver.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage silver_bm = new BitmapImage();
     silver_bm.TextureAsset = "ImagesUI\\silver_res";
     silver.Source = silver_bm;
     // gold element
     Image gold = new Image();
     e_198.Children.Add(gold);
     gold.Name = "gold";
     gold.Height = 30F;
     gold.Margin = new Thickness(0F, 0F, 0F, 0F);
     gold.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage gold_bm = new BitmapImage();
     gold_bm.TextureAsset = "ImagesUI\\gold_res";
     gold.Source = gold_bm;
     // platinum element
     Image platinum = new Image();
     e_198.Children.Add(platinum);
     platinum.Name = "platinum";
     platinum.Height = 30F;
     platinum.Margin = new Thickness(0F, 0F, 0F, 0F);
     platinum.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage platinum_bm = new BitmapImage();
     platinum_bm.TextureAsset = "ImagesUI\\platinum_res";
     platinum.Source = platinum_bm;
     // diamond element
     Image diamond = new Image();
     e_198.Children.Add(diamond);
     diamond.Name = "diamond";
     diamond.Height = 30F;
     diamond.Margin = new Thickness(0F, 0F, 0F, 0F);
     diamond.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage diamond_bm = new BitmapImage();
     diamond_bm.TextureAsset = "ImagesUI\\diamond_res";
     diamond.Source = diamond_bm;
     // e_199 element
     StackPanel e_199 = new StackPanel();
     e_197.Children.Add(e_199);
     e_199.Name = "e_199";
     e_199.Margin = new Thickness(10F, 0F, 0F, 0F);
     e_199.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_199, 1);
     Grid.SetRow(e_199, 0);
     // e_200 element
     TextBlock e_200 = new TextBlock();
     e_199.Children.Add(e_200);
     e_200.Name = "e_200";
     e_200.Margin = new Thickness(0F, 22F, 0F, 0F);
     e_200.Text = "Silver: ";
     // e_201 element
     TextBlock e_201 = new TextBlock();
     e_199.Children.Add(e_201);
     e_201.Name = "e_201";
     e_201.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_201.Text = "Gold: ";
     // e_202 element
     TextBlock e_202 = new TextBlock();
     e_199.Children.Add(e_202);
     e_202.Name = "e_202";
     e_202.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_202.Text = "Platinum: ";
     // e_203 element
     TextBlock e_203 = new TextBlock();
     e_199.Children.Add(e_203);
     e_203.Name = "e_203";
     e_203.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_203.Text = "Diamond: ";
     // e_204 element
     StackPanel e_204 = new StackPanel();
     e_197.Children.Add(e_204);
     e_204.Name = "e_204";
     e_204.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_204, 2);
     Grid.SetRow(e_204, 0);
     // e_205 element
     TextBlock e_205 = new TextBlock();
     e_204.Children.Add(e_205);
     e_205.Name = "e_205";
     e_205.Margin = new Thickness(0F, 22F, 0F, 0F);
     Binding binding_e_205_Text = new Binding("SliverResource");
     e_205.SetBinding(TextBlock.TextProperty, binding_e_205_Text);
     // e_206 element
     TextBlock e_206 = new TextBlock();
     e_204.Children.Add(e_206);
     e_206.Name = "e_206";
     e_206.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_206_Text = new Binding("GoldResource");
     e_206.SetBinding(TextBlock.TextProperty, binding_e_206_Text);
     // e_207 element
     TextBlock e_207 = new TextBlock();
     e_204.Children.Add(e_207);
     e_207.Name = "e_207";
     e_207.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_207_Text = new Binding("PlatinumResource");
     e_207.SetBinding(TextBlock.TextProperty, binding_e_207_Text);
     // e_208 element
     TextBlock e_208 = new TextBlock();
     e_204.Children.Add(e_208);
     e_208.Name = "e_208";
     e_208.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_208_Text = new Binding("DiamondResource");
     e_208.SetBinding(TextBlock.TextProperty, binding_e_208_Text);
     // txtFuels element
     TextBlock txtFuels = new TextBlock();
     e_178.Children.Add(txtFuels);
     txtFuels.Name = "txtFuels";
     txtFuels.Height = 20F;
     txtFuels.Text = "FUELS";
     Grid.SetColumn(txtFuels, 2);
     Grid.SetRow(txtFuels, 0);
     // e_209 element
     Grid e_209 = new Grid();
     e_178.Children.Add(e_209);
     e_209.Name = "e_209";
     RowDefinition row_e_209_0 = new RowDefinition();
     e_209.RowDefinitions.Add(row_e_209_0);
     RowDefinition row_e_209_1 = new RowDefinition();
     e_209.RowDefinitions.Add(row_e_209_1);
     ColumnDefinition col_e_209_0 = new ColumnDefinition();
     col_e_209_0.Width = new GridLength(50F, GridUnitType.Pixel);
     e_209.ColumnDefinitions.Add(col_e_209_0);
     ColumnDefinition col_e_209_1 = new ColumnDefinition();
     col_e_209_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_209.ColumnDefinitions.Add(col_e_209_1);
     ColumnDefinition col_e_209_2 = new ColumnDefinition();
     e_209.ColumnDefinitions.Add(col_e_209_2);
     Grid.SetColumn(e_209, 2);
     Grid.SetRow(e_209, 1);
     // e_210 element
     StackPanel e_210 = new StackPanel();
     e_209.Children.Add(e_210);
     e_210.Name = "e_210";
     Grid.SetColumn(e_210, 0);
     Grid.SetRow(e_210, 0);
     // coal element
     Image coal = new Image();
     e_210.Children.Add(coal);
     coal.Name = "coal";
     coal.Height = 30F;
     coal.Margin = new Thickness(0F, 15F, 0F, 0F);
     coal.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage coal_bm = new BitmapImage();
     coal_bm.TextureAsset = "ImagesUI\\coal_res";
     coal.Source = coal_bm;
     // oil element
     Image oil = new Image();
     e_210.Children.Add(oil);
     oil.Name = "oil";
     oil.Height = 30F;
     oil.Margin = new Thickness(0F, 0F, 0F, 0F);
     oil.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage oil_bm = new BitmapImage();
     oil_bm.TextureAsset = "ImagesUI\\oil_res";
     oil.Source = oil_bm;
     // NaturalGas element
     Image NaturalGas = new Image();
     e_210.Children.Add(NaturalGas);
     NaturalGas.Name = "NaturalGas";
     NaturalGas.Height = 30F;
     NaturalGas.Margin = new Thickness(0F, 0F, 0F, 0F);
     NaturalGas.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage NaturalGas_bm = new BitmapImage();
     NaturalGas_bm.TextureAsset = "ImagesUI\\gas_res";
     NaturalGas.Source = NaturalGas_bm;
     // Uranium element
     Image Uranium = new Image();
     e_210.Children.Add(Uranium);
     Uranium.Name = "Uranium";
     Uranium.Height = 30F;
     Uranium.Margin = new Thickness(0F, 0F, 0F, 0F);
     Uranium.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage Uranium_bm = new BitmapImage();
     Uranium_bm.TextureAsset = "ImagesUI\\uranium_res";
     Uranium.Source = Uranium_bm;
     // Thorium element
     Image Thorium = new Image();
     e_210.Children.Add(Thorium);
     Thorium.Name = "Thorium";
     Thorium.Height = 30F;
     Thorium.Margin = new Thickness(0F, 0F, 0F, 0F);
     Thorium.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage Thorium_bm = new BitmapImage();
     Thorium_bm.TextureAsset = "ImagesUI\\thorium_res";
     Thorium.Source = Thorium_bm;
     // e_211 element
     StackPanel e_211 = new StackPanel();
     e_209.Children.Add(e_211);
     e_211.Name = "e_211";
     e_211.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_211, 1);
     Grid.SetRow(e_211, 0);
     // e_212 element
     TextBlock e_212 = new TextBlock();
     e_211.Children.Add(e_212);
     e_212.Name = "e_212";
     e_212.Margin = new Thickness(0F, 22F, 0F, 0F);
     e_212.Text = "Coal: ";
     // e_213 element
     TextBlock e_213 = new TextBlock();
     e_211.Children.Add(e_213);
     e_213.Name = "e_213";
     e_213.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_213.Text = "Oil: ";
     // e_214 element
     TextBlock e_214 = new TextBlock();
     e_211.Children.Add(e_214);
     e_214.Name = "e_214";
     e_214.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_214.Text = "Natural Gas: ";
     // e_215 element
     TextBlock e_215 = new TextBlock();
     e_211.Children.Add(e_215);
     e_215.Name = "e_215";
     e_215.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_215.Text = "Uranium: ";
     // e_216 element
     TextBlock e_216 = new TextBlock();
     e_211.Children.Add(e_216);
     e_216.Name = "e_216";
     e_216.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_216.Text = "Thorium: ";
     // e_217 element
     StackPanel e_217 = new StackPanel();
     e_209.Children.Add(e_217);
     e_217.Name = "e_217";
     e_217.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_217, 2);
     Grid.SetRow(e_217, 0);
     // e_218 element
     TextBlock e_218 = new TextBlock();
     e_217.Children.Add(e_218);
     e_218.Name = "e_218";
     e_218.Margin = new Thickness(0F, 22F, 0F, 0F);
     Binding binding_e_218_Text = new Binding("CoalResource");
     e_218.SetBinding(TextBlock.TextProperty, binding_e_218_Text);
     // e_219 element
     TextBlock e_219 = new TextBlock();
     e_217.Children.Add(e_219);
     e_219.Name = "e_219";
     e_219.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_219_Text = new Binding("OilResource");
     e_219.SetBinding(TextBlock.TextProperty, binding_e_219_Text);
     // e_220 element
     TextBlock e_220 = new TextBlock();
     e_217.Children.Add(e_220);
     e_220.Name = "e_220";
     e_220.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_220_Text = new Binding("NaturalGasResource");
     e_220.SetBinding(TextBlock.TextProperty, binding_e_220_Text);
     // e_221 element
     TextBlock e_221 = new TextBlock();
     e_217.Children.Add(e_221);
     e_221.Name = "e_221";
     e_221.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_221_Text = new Binding("UraniumResource");
     e_221.SetBinding(TextBlock.TextProperty, binding_e_221_Text);
     // e_222 element
     TextBlock e_222 = new TextBlock();
     e_217.Children.Add(e_222);
     e_222.Name = "e_222";
     e_222.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_222_Text = new Binding("ThoriumResource");
     e_222.SetBinding(TextBlock.TextProperty, binding_e_222_Text);
     // txtMisc element
     TextBlock txtMisc = new TextBlock();
     e_178.Children.Add(txtMisc);
     txtMisc.Name = "txtMisc";
     txtMisc.Height = 20F;
     txtMisc.Margin = new Thickness(0F, 10F, 0F, 0F);
     txtMisc.Text = "MISC";
     Grid.SetColumn(txtMisc, 0);
     Grid.SetRow(txtMisc, 2);
     // e_223 element
     Grid e_223 = new Grid();
     e_178.Children.Add(e_223);
     e_223.Name = "e_223";
     e_223.VerticalAlignment = VerticalAlignment.Stretch;
     RowDefinition row_e_223_0 = new RowDefinition();
     e_223.RowDefinitions.Add(row_e_223_0);
     RowDefinition row_e_223_1 = new RowDefinition();
     e_223.RowDefinitions.Add(row_e_223_1);
     ColumnDefinition col_e_223_0 = new ColumnDefinition();
     col_e_223_0.Width = new GridLength(50F, GridUnitType.Pixel);
     e_223.ColumnDefinitions.Add(col_e_223_0);
     ColumnDefinition col_e_223_1 = new ColumnDefinition();
     col_e_223_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_223.ColumnDefinitions.Add(col_e_223_1);
     ColumnDefinition col_e_223_2 = new ColumnDefinition();
     col_e_223_2.Width = new GridLength(1F, GridUnitType.Auto);
     e_223.ColumnDefinitions.Add(col_e_223_2);
     Grid.SetColumn(e_223, 0);
     Grid.SetRow(e_223, 3);
     // e_224 element
     StackPanel e_224 = new StackPanel();
     e_223.Children.Add(e_224);
     e_224.Name = "e_224";
     e_224.Margin = new Thickness(5F, 0F, 0F, 0F);
     Grid.SetColumn(e_224, 0);
     Grid.SetRow(e_224, 0);
     // Timber element
     Image Timber = new Image();
     e_224.Children.Add(Timber);
     Timber.Name = "Timber";
     Timber.Height = 30F;
     Timber.Margin = new Thickness(0F, 15F, 0F, 0F);
     Timber.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage Timber_bm = new BitmapImage();
     Timber_bm.TextureAsset = "ImagesUI\\timber_res";
     Timber.Source = Timber_bm;
     // Livestock element
     Image Livestock = new Image();
     e_224.Children.Add(Livestock);
     Livestock.Name = "Livestock";
     Livestock.Height = 30F;
     Livestock.Margin = new Thickness(0F, 0F, 0F, 0F);
     Livestock.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage Livestock_bm = new BitmapImage();
     Livestock_bm.TextureAsset = "ImagesUI\\livestock_res";
     Livestock.Source = Livestock_bm;
     // Crops element
     Image Crops = new Image();
     e_224.Children.Add(Crops);
     Crops.Name = "Crops";
     Crops.Height = 30F;
     Crops.Margin = new Thickness(0F, 0F, 0F, 0F);
     Crops.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage Crops_bm = new BitmapImage();
     Crops_bm.TextureAsset = "ImagesUI\\crops_res";
     Crops.Source = Crops_bm;
     // CleanWater element
     Image CleanWater = new Image();
     e_224.Children.Add(CleanWater);
     CleanWater.Name = "CleanWater";
     CleanWater.Height = 30F;
     CleanWater.Margin = new Thickness(0F, 0F, 0F, 0F);
     CleanWater.VerticalAlignment = VerticalAlignment.Top;
     BitmapImage CleanWater_bm = new BitmapImage();
     CleanWater_bm.TextureAsset = "ImagesUI\\water_res";
     CleanWater.Source = CleanWater_bm;
     // e_225 element
     StackPanel e_225 = new StackPanel();
     e_223.Children.Add(e_225);
     e_225.Name = "e_225";
     e_225.Margin = new Thickness(5F, 0F, 0F, 0F);
     e_225.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_225, 1);
     Grid.SetRow(e_225, 0);
     // e_226 element
     TextBlock e_226 = new TextBlock();
     e_225.Children.Add(e_226);
     e_226.Name = "e_226";
     e_226.Margin = new Thickness(0F, 22F, 0F, 0F);
     e_226.Text = "Timber: ";
     // e_227 element
     TextBlock e_227 = new TextBlock();
     e_225.Children.Add(e_227);
     e_227.Name = "e_227";
     e_227.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_227.Text = "Livestock: ";
     // e_228 element
     TextBlock e_228 = new TextBlock();
     e_225.Children.Add(e_228);
     e_228.Name = "e_228";
     e_228.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_228.Text = "Crops: ";
     // e_229 element
     TextBlock e_229 = new TextBlock();
     e_225.Children.Add(e_229);
     e_229.Name = "e_229";
     e_229.Margin = new Thickness(0F, 14F, 0F, 0F);
     e_229.Text = "Clean Water: ";
     // e_230 element
     StackPanel e_230 = new StackPanel();
     e_223.Children.Add(e_230);
     e_230.Name = "e_230";
     e_230.Margin = new Thickness(5F, 0F, 0F, 0F);
     e_230.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_230, 2);
     Grid.SetRow(e_230, 0);
     // e_231 element
     TextBlock e_231 = new TextBlock();
     e_230.Children.Add(e_231);
     e_231.Name = "e_231";
     e_231.Margin = new Thickness(0F, 22F, 0F, 0F);
     Binding binding_e_231_Text = new Binding("TimberResource");
     e_231.SetBinding(TextBlock.TextProperty, binding_e_231_Text);
     // e_232 element
     TextBlock e_232 = new TextBlock();
     e_230.Children.Add(e_232);
     e_232.Name = "e_232";
     e_232.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_232_Text = new Binding("LivestockResource");
     e_232.SetBinding(TextBlock.TextProperty, binding_e_232_Text);
     // e_233 element
     TextBlock e_233 = new TextBlock();
     e_230.Children.Add(e_233);
     e_233.Name = "e_233";
     e_233.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_233_Text = new Binding("CropsResource");
     e_233.SetBinding(TextBlock.TextProperty, binding_e_233_Text);
     // e_234 element
     TextBlock e_234 = new TextBlock();
     e_230.Children.Add(e_234);
     e_234.Name = "e_234";
     e_234.Margin = new Thickness(0F, 14F, 0F, 0F);
     Binding binding_e_234_Text = new Binding("CleanWaterResource");
     e_234.SetBinding(TextBlock.TextProperty, binding_e_234_Text);
     items.Add(tabRes);
     return items;
 }
Exemple #60
0
    protected void VersionsChanged(object sender, EventArgs e)
    {
        if (versions.Count == 0)
            return;
        for (int i = 0; i < _Versions.Count; i++)
        {
            ListViewItem item = _Versions[i];
            Mod mod = ((ModVersionViewModel)item.DataContext).mod;
            if (!versions.Values.Contains(mod))
            {
                _Versions.RemoveAt(i);
                i--;
            }
        }

        List<int> versionKeys = versions.Keys.ToList();
        versionKeys.Sort();
        versionKeys.Reverse();
        ListViewItem[] old = _Versions.ToArray();
        _Versions = new ObservableCollection<ListViewItem>();

        foreach (int n in versionKeys)
        {
            Mod mod = versions[n];
            bool add = true;
            /*foreach (ListViewItem item in _Versions)
            {
                if (item.DataContext == mod)
                {
                    add = false;
                    break;
                }
            }*/
            if (add)
            {
                ListViewItem newItem = new ListViewItem();
                StackPanel panel = new StackPanel();
                panel.Orientation = Orientation.Vertical;
                newItem.DataContext = new ModVersionViewModel(mod);

                TextBlock label = new TextBlock();
                label.SetBinding(TextBlock.TextProperty, "Version");

                StackPanel panel2 = new StackPanel();
                panel2.Orientation = Orientation.Horizontal;
                TextBlock compatibleLabel = new TextBlock();
                compatibleLabel.SetResourceReference(TextBlock.TextProperty, "Lang.Mods.Labels.Compatible");
                compatibleLabel.FontSize = 14;

                compatibleLabel.Margin = new Thickness(0, 0, 5, 0);
                TextBlock label2 = new TextBlock();
                label2.SetBinding(TextBlock.TextProperty, "Compatible");
                label2.FontSize = 14;

                panel2.Children.Add(compatibleLabel);
                panel2.Children.Add(label2);

                panel.Children.Add(label);
                panel.Children.Add(panel2);

                newItem.Content = panel;
                _Versions.Add(newItem);
            }
        }

        OnPropertyChanged("Versions");

        if (_Initialized)
        {
            DontSaveVersion = true;
                int versionToPrefer = Configuration.GetInt("Mods." + versions[versions.Keys.ToArray()[0]].Game.GameConfiguration.ID + "." + versions[versions.Keys.ToArray()[0]].ID + ".Version");
                bool found = false;
                foreach (ListViewItem item in _Versions)
                {
                    Mod mod = ((ModVersionViewModel)item.DataContext).mod;
                    int build = Mod.Header.ParseModVersion(mod.header.GetVersion());
                    if (build == versionToPrefer)
                    {
                        SelectedVersion = item;
                        found = true;
                    }
                }
                if (!found)
                {
                    if (_Versions.Count > 0)
                        SelectedVersion = _Versions[0];
                    else
                        SelectedVersion = null;
                }
                DontSaveVersion = false;
                OnPropertyChanged("SelectedVersion");
                OnPropertyChanged("Name");
                OnPropertyChanged("Description");
                OnPropertyChanged("Version");
            }
    }