internal MemberMapping(MemberInfo member, MemberAttribute attribute, EntityMapping entity) { this.member = member; this.entity = entity; memberType = member.GetMemberType(); var isEnumerableType = memberType != Types.String && memberType != typeof(byte[]) && Types.IEnumerable.IsAssignableFrom(memberType); if (attribute == null) { InitializeConversionMapping(isEnumerableType); } else InitializeAttributeMapping(attribute, isEnumerableType); getter = member.GetGetter(); if (storageMember != null) setter = storageMember.GetSetter(); else setter = member.GetSetter(); if (columnName == null) columnName = member.Name; }
/// <summary> /// Initializes a new instance of the <see cref="SafeInvoker"/> class. /// </summary> /// <param name="del"> /// The float setter delegate. /// </param> /// <param name="o"> /// The responsible object. /// </param> public SafeInvoker(Setter del, object o = null) { this.underlyingDelegate = del; if (o != null) { this.SetObject(o); } }
public void Materializes_Template_Should_Be_NameScope() { var control = new Decorator(); var template = new FuncTemplate<Canvas>(() => new Canvas()); var style = Mock.Of<IStyle>(); var setter = new Setter(Decorator.ChildProperty, template); setter.Apply(style, control, null); Assert.NotNull(NameScope.GetNameScope((Control)control.Child)); }
public void Setter_Should_Materialize_Template_To_Property() { var control = new Decorator(); var template = new FuncTemplate<Canvas>(() => new Canvas()); var style = Mock.Of<IStyle>(); var setter = new Setter(Decorator.ChildProperty, template); setter.Apply(style, control, null); Assert.IsType<Canvas>(control.Child); }
public ComplexDynamicProperty( Getter getter, Setter setter, bool useInitialValue = false, object initialValue = null) { this.getter = getter; this.setter = setter; if (useInitialValue) { setter(initialValue); } }
public void Setter_Should_Apply_Binding_To_Property() { var control = new TextBlock(); var subject = new BehaviorSubject<object>("foo"); var binding = Mock.Of<IBinding>(x => x.CreateSubject(control, TextBlock.TextProperty) == subject); var style = Mock.Of<IStyle>(); var setter = new Setter(TextBlock.TextProperty, binding); setter.Apply(style, control, null); Assert.Equal("foo", control.Text); }
protected override void ConvertDBTypeToNativeType(IDbDataParameter p, DBType dbType) { if (SetSqlDbType == null) { SetSqlDbType = p.GetType().Module.GetType("System.Data.SqlServerCe.SqlCeParameter").GetProperty("SqlDbType", BindingFlags.Public | BindingFlags.Instance).GetSetter(); } if (SetSqlDbType != null) SetSqlDbType(p, (SqlDbType)(int)dbType); else base.ConvertDBTypeToNativeType(p, dbType); }
public Tween(Setter<float> setter, float start, float target, float duration, Ease ease = null, bool yoyo = false, Action onComplete = null) { Setter = setter; _start = start; _target = target; _duration = duration; _ease = ease ?? Linear.EaseNone; _change = target - start; _elapsedTime = 0; OnComplete = onComplete; _yoyo = yoyo; }
private void RecordPropertyChanged(EpicsRecord sender, RecordProperty prop, object val, Setter setter) { if (prop == this.property) { var toUpdate = true; if (val is short || val is int || val is float || val is double) { var v = Convert.ToDouble(val); var l = Convert.ToDouble(this.lastValue); if (Math.Abs(v - l) > sender.MDEL) { this.lastValue = val; } else { toUpdate = false; } } else if (val is string) { if ((string)val == (string)this.lastValue) { toUpdate = false; } else { this.lastValue = val; } } else { if (val.ToString() == this.lastValue.ToString()) { toUpdate = false; } else { this.lastValue = val; } } if (toUpdate) { this.channel.sendMonitorChange( this.subscriptionId, this.type, this.dataCount, EpicsTransitionStatus.ECA_NORMAL, NetworkByteConverter.objectToByte(val, this.type, this.record)); } } }
// ----- Конструктор ----- public Main() { InitializeComponent(); mutex = new Mutex(false); timer = new System.Threading.Timer(new TimerCallback(SendPacketToServer), null, Timeout.Infinite, 50); share = new List<Packet>(); working = new List<Packet>(); remover = new Remover(Deleter); setter = new Setter(SetterFunction); }
/// <summary> /// Use this constructor to create child nodes. /// </summary> /// <param name="type">The type of the field this node represets</param> /// <param name="name">The name of the field this node represets</param> /// <param name="setter">Helper delegate to set the value of the field.</param> /// <param name="getter">Helper delegate to get the value of the field.</param> public InspectorNode(InspectorNode parent, Type type, String name, Setter setter, Getter getter, bool hideCanWriteIcon) { Children = new ObservableCollection<InspectorNode>(); Methods = new ObservableCollection<InspectorNode>(); Name = name; Type = type; _setter = setter; _getter = getter; Parent = parent; Updating = true; _hideCantWriteIcon = hideCanWriteIcon; }
public void Setter_Should_Apply_Binding_To_Property() { var control = new TextBlock(); var subject = new BehaviorSubject<object>("foo"); var descriptor = new InstancedBinding(subject); var binding = Mock.Of<IBinding>(x => x.Initiate(control, TextBlock.TextProperty, null, false) == descriptor); var style = Mock.Of<IStyle>(); var setter = new Setter(TextBlock.TextProperty, binding); setter.Apply(style, control, null); Assert.Equal("foo", control.Text); }
public App() { // The root page of your application MainPage = new NavigationPage(new SearchPatient()); Current.Resources = new ResourceDictionary(); Current.Resources.Add("UlycesColor", Color.FromRgb(121, 248, 81)); var navigationStyle = new Style(typeof (NavigationPage)); var barTextColorSetter = new Setter {Property = NavigationPage.BarTextColorProperty, Value = Color.White}; var barBackgroundColorSetter= new Setter {Property = NavigationPage.BarBackgroundColorProperty, Value = Color.Red}; navigationStyle.Setters.Add(barTextColorSetter ); navigationStyle.Setters.Add(barBackgroundColorSetter); Current.Resources.Add(navigationStyle); }
public override void Set(object onObject, object attribute) { if (null == _setter) _setter = AccessorFactory.SetterFor(_field); try { _setter(onObject, attribute); } catch (FieldAccessException) { _setter = _field.SetValue; _setter(onObject, attribute); } catch (Exception e) { throw new Db4oException(e); } }
public void TestUsage() { var setter = new Setter<Person>(_connectionFactory); using (var con = _connectionFactory.Create()) { CreateTable(con); var res = con.Query<Person>("select * from #tmp").ToArray(); Assert.AreEqual(3, res.Length); Assert.AreEqual(1, res[0].Id); Assert.AreEqual("one", res[0].Name); Assert.AreEqual(1, res[0].Number); Assert.AreEqual(2, res[1].Id); Assert.AreEqual("two", res[1].Name); Assert.AreEqual(2, res[1].Number); Assert.AreEqual(3, res[2].Id); Assert.AreEqual("three", res[2].Name); Assert.AreEqual(2, res[2].Number); setter .Set(person => person.Id, 4) .Set(person => person.Name, "one_replaced") .Set(person => person.Number, (byte)10) .Where(person => person.Id, 1) .Update(con); res = con.Query<Person>("select * from #tmp").ToArray(); Assert.AreEqual(3, res.Length); Assert.AreEqual(4, res[0].Id); Assert.AreEqual("one_replaced", res[0].Name); Assert.AreEqual(10, res[0].Number); Assert.AreEqual(2, res[1].Id); Assert.AreEqual("two", res[1].Name); Assert.AreEqual(2, res[1].Number); Assert.AreEqual(3, res[2].Id); Assert.AreEqual("three", res[2].Name); Assert.AreEqual(2, res[2].Number); DropTable(con); } }
private void InitializeResources() { // Resource - [System.Windows.Controls.Button] Style var r_0_s_bo = this[typeof(Button)]; Style r_0_s = new Style(typeof(Button), r_0_s_bo as Style); Setter r_0_s_S_0 = new Setter(Button.FontFamilyProperty, new FontFamily("Kootenay")); r_0_s.Setters.Add(r_0_s_S_0); Setter r_0_s_S_1 = new Setter(Button.FontSizeProperty, 12F); r_0_s.Setters.Add(r_0_s_S_1); this.Add(typeof(Button), r_0_s); // Resource - [System.Windows.Controls.TextBlock] Style var r_1_s_bo = this[typeof(TextBlock)]; Style r_1_s = new Style(typeof(TextBlock), r_1_s_bo as Style); Setter r_1_s_S_0 = new Setter(TextBlock.FontFamilyProperty, new FontFamily("Kootenay")); r_1_s.Setters.Add(r_1_s_S_0); Setter r_1_s_S_1 = new Setter(TextBlock.FontSizeProperty, 12F); r_1_s.Setters.Add(r_1_s_S_1); this.Add(typeof(TextBlock), r_1_s); FontManager.Instance.AddFont("Kootenay", 12F, FontStyle.Regular, "Kootenay_9_Regular"); }
public object Execute(object instance, IContext context) { var setter = _setter; if (setter == null || setter.ConfigVersion != context.ConfigVersion) { var instanceType = instance.GetType(); var propertyType = instanceType.GetProperty(_propertyName).PropertyType; setter = new Setter { ConfigVersion = context.ConfigVersion, Get = _factory ?? Reflector.GetPropertyValueProvider(propertyType, context), Set = Reflector.GetPropertySetter(instanceType, _propertyName) }; _setter = setter; } setter.Set(instance, setter.Get(context)); return instance; }
public SwitchControl(object dataContext, double buttonSize /*double left, double top, int z*/) { #region Init FrameworkElement frameworkElement = new FrameworkElement(); this.DataContext = dataContext; //Canvas.SetLeft(this, left); //Canvas.SetTop(this, top); //Canvas.SetZIndex(this, z); this.Button = new Button(); this.ButtonCanvas = new Canvas(); this.Canvas1 = new Canvas(); this.Canvas2 = new Canvas(); this.Canvas3 = new Canvas(); this.ClosedPalette.Add((SolidColorBrush)frameworkElement.FindResource("SwitchColorClosed")); this.ClosedPalette.Add((SolidColorBrush)frameworkElement.FindResource("SwitchColorMouseOverClosed")); this.ClosedPalette.Add((SolidColorBrush)frameworkElement.FindResource("SwitchColorPressedClosed")); this.OpenedPalette.Add((SolidColorBrush)frameworkElement.FindResource("SwitchColorClosedDeenergized")); this.OpenedPalette.Add((SolidColorBrush)frameworkElement.FindResource("SwitchColorMouseOverClosedDeenergized")); this.OpenedPalette.Add((SolidColorBrush)frameworkElement.FindResource("SwitchColorPressedClosedDeenergized")); this.Palettes.Add(0, this.ClosedPalette); this.Palettes.Add(1, this.OpenedPalette); this.ActivePalette = this.Palettes[0]; ColumnDefinition canvas1Col = new ColumnDefinition(); canvas1Col.Width = new GridLength(buttonSize); ColumnDefinition space1Col = new ColumnDefinition(); space1Col.Width = new GridLength(2); ColumnDefinition buttonCol = new ColumnDefinition(); buttonCol.Width = new GridLength(buttonSize); ColumnDefinition space2Col = new ColumnDefinition(); space2Col.Width = new GridLength(2); ColumnDefinition canvas2Col = new ColumnDefinition(); canvas2Col.Width = new GridLength(buttonSize); ColumnDefinition space3Col = new ColumnDefinition(); space3Col.Width = new GridLength(2); ColumnDefinition canvas3Col = new ColumnDefinition(); canvas3Col.Width = new GridLength(buttonSize); this.ColumnDefinitions.Add(buttonCol); this.ColumnDefinitions.Add(space1Col); this.ColumnDefinitions.Add(canvas1Col); this.ColumnDefinitions.Add(space2Col); this.ColumnDefinitions.Add(canvas2Col); RowDefinition mainRow = new RowDefinition(); mainRow.Height = new GridLength(buttonSize); this.RowDefinitions.Add(mainRow); this.Children.Add(this.Canvas1); Grid.SetColumn(this.Canvas1, 0); this.Children.Add(this.ButtonCanvas); Grid.SetColumn(this.ButtonCanvas, 2); this.Children.Add(this.Canvas2); Grid.SetColumn(this.Canvas2, 4); //this.Children.Add(this.Canvas3); //Grid.SetColumn(this.Canvas3, 5); this.Canvas1.Background = new ImageBrush(new BitmapImage(new Uri(Directory.GetCurrentDirectory() + "/../../View/Resources/Images/incident.png"))); this.Canvas2.Background = new ImageBrush(new BitmapImage(new Uri(Directory.GetCurrentDirectory() + "/../../View/Resources/Images/crew.png"))); this.Canvas1.VerticalAlignment = VerticalAlignment.Center; this.Canvas1.HorizontalAlignment = HorizontalAlignment.Center; this.Canvas1.Height = buttonSize; this.Canvas1.Width = buttonSize; this.Canvas2.VerticalAlignment = VerticalAlignment.Center; this.Canvas2.HorizontalAlignment = HorizontalAlignment.Center; this.Canvas2.Height = buttonSize; this.Canvas2.Width = buttonSize; this.ButtonCanvas.Height = buttonSize; this.ButtonCanvas.Width = buttonSize; this.Button.Height = buttonSize; this.Button.Width = buttonSize; #endregion #region Style Style style = new Style(); style.TargetType = typeof(Button); Setter setter = new Setter(); setter.Property = Button.TemplateProperty; ControlTemplate template = new ControlTemplate(typeof(Button)); FrameworkElementFactory elemFactory = new FrameworkElementFactory(typeof(Border)); elemFactory.Name = "Border"; elemFactory.SetValue(Border.CornerRadiusProperty, new CornerRadius(buttonSize / 20)); elemFactory.SetValue(Border.BackgroundProperty, this.ActivePalette[0]); template.VisualTree = elemFactory; Trigger trigger1 = new Trigger(); trigger1.Property = Button.IsMouseOverProperty; trigger1.Value = true; Setter setter1 = new Setter(); setter1.Property = Border.BackgroundProperty; setter1.Value = this.ActivePalette[1]; setter1.TargetName = "Border"; trigger1.Setters.Add(setter1); template.Triggers.Add(trigger1); Trigger trigger2 = new Trigger(); trigger2.Property = Button.IsPressedProperty; trigger2.Value = true; Setter setter2 = new Setter(); setter2.Property = Border.BackgroundProperty; setter2.Value = this.ActivePalette[2]; setter2.TargetName = "Border"; trigger2.Setters.Add(setter2); template.Triggers.Add(trigger2); DataTrigger dataTrigger1 = new DataTrigger(); dataTrigger1.Binding = new Binding("IsEnergized"); dataTrigger1.Value = false; Setter dataSetter1 = new Setter(); dataSetter1.Property = Border.BackgroundProperty; dataSetter1.Value = (SolidColorBrush)frameworkElement.FindResource("SwitchColorClosedDeenergized"); dataSetter1.TargetName = "Border"; dataTrigger1.Setters.Add(dataSetter1); template.Triggers.Add(dataTrigger1); DataTrigger dataTriggerNoScada = new DataTrigger(); dataTriggerNoScada.Binding = new Binding("IsCandidate"); dataTriggerNoScada.Value = true; Setter dataSetterNoScada = new Setter(); dataSetterNoScada.Property = Border.BackgroundProperty; dataSetterNoScada.Value = (SolidColorBrush)frameworkElement.FindResource("SwitchColorClosedDeenergized"); dataSetterNoScada.TargetName = "Border"; dataTriggerNoScada.Setters.Add(dataSetterNoScada); template.Triggers.Add(dataTriggerNoScada); setter.Value = template; style.Triggers.Clear(); style.Setters.Add(setter); this.Button.Style = style; this.ButtonCanvas.Children.Add(Button); BreakerProperties breakerProperties = (BreakerProperties)dataContext; if (breakerProperties.IsUnderScada) { Canvas scadaCanvas = new Canvas(); Border scadaBorder = new Border() { Height = buttonSize / 2, Width = buttonSize / 2, Background = Brushes.DarkOrange, BorderBrush = Brushes.White, ToolTip = "Under SCADA" }; scadaBorder.CornerRadius = new CornerRadius(scadaBorder.Height / 2); scadaBorder.BorderThickness = new Thickness(scadaBorder.Height / 10); Canvas.SetLeft(scadaBorder, -(scadaBorder.Width / 2)); Canvas.SetTop(scadaBorder, -(scadaBorder.Height / 2)); scadaCanvas.Children.Add(scadaBorder); TextBlock scadaTextblock = new TextBlock() { Text = "S", Foreground = Brushes.White, ToolTip = "Under SCADA", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, FontSize = 4 * scadaBorder.Height / 5, Margin = new Thickness(0, 0, 0, scadaBorder.Height / 6) }; scadaBorder.Child = scadaTextblock; this.ButtonCanvas.Children.Add(scadaCanvas); } this.Canvas1.SetBinding(Canvas.VisibilityProperty, new Binding("Incident") { Converter = new BooleanToVisibilityConverter() }); this.Canvas2.SetBinding(Canvas.VisibilityProperty, new Binding("CrewSent") { Converter = new BooleanToVisibilityConverter() }); #endregion }
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; }
protected InspectorField CreateDrawer(Type variableType, string variableName, Getter getter, Setter setter, bool drawObjectsAsFields = true) { InspectorField variableDrawer = Inspector.CreateDrawerForType(variableType, drawArea, Depth + 1, drawObjectsAsFields); if (variableDrawer != null) { variableDrawer.BindTo(variableType, variableName, getter, setter); elements.Add(variableDrawer); } return(variableDrawer); }
internal ColorTweener(Getter getter, Setter setter, Color finalValue, float duration) : base(getter, setter, finalValue, duration) { }
public InspectorField CreateDrawer(Type variableType, string variableName, Getter getter, Setter setter, bool drawObjectsAsFields = true) { InspectorField variableDrawer = Inspector.CreateDrawerForType(variableType, drawArea, Depth + 1, drawObjectsAsFields); if (variableDrawer != null) { variableDrawer.BindTo(variableType, variableName == null ? null : string.Empty, getter, setter); if (variableName != null) { variableDrawer.NameRaw = variableName; } elements.Add(variableDrawer); } return(variableDrawer); }
public void Cannot_Assign_Control_To_Value() { var target = new Setter(); Assert.Throws <InvalidOperationException>(() => target.Value = new Border()); }
public void Cannot_Assign_Control_To_Value() { var target = new Setter(); Assert.Throws<ArgumentException>(() => target.Value = new Border()); }
public override GameObject GetGui(GameObject prefab) { var current = GameObject.Instantiate(prefab); current.name = Name; current.transform.Find("Title").GetComponent <Text>().text = Name; Slider redSlider = current.transform.Find("Colors/Red/RedSlider").GetComponent <Slider>(); Slider greenSlider = current.transform.Find("Colors/Green/GreenSlider").GetComponent <Slider>(); Slider blueSlider = current.transform.Find("Colors/Blue/BlueSlider").GetComponent <Slider>(); Text redValue = current.transform.Find("Colors/Red/RedValue").GetComponent <Text>(); Text greenValue = current.transform.Find("Colors/Green/GreenValue").GetComponent <Text>(); Text blueValue = current.transform.Find("Colors/Blue/BlueValue").GetComponent <Text>(); Image colorPreview = current.transform.Find("ColorPreview").GetComponent <Image>(); UnityAction <float> sliderUpdate = delegate { Color toSet = new Color(redSlider.value, greenSlider.value, blueSlider.value); Setter.Invoke(toSet); redValue.text = Mathf.FloorToInt(redSlider.value * 255).ToString(); greenValue.text = Mathf.FloorToInt(greenSlider.value * 255).ToString(); blueValue.text = Mathf.FloorToInt(blueSlider.value * 255).ToString(); colorPreview.color = toSet; }; redSlider.onValueChanged.AddListener(sliderUpdate); greenSlider.onValueChanged.AddListener(sliderUpdate); blueSlider.onValueChanged.AddListener(sliderUpdate); redSlider.value = Getter.Invoke().r; greenSlider.value = Getter.Invoke().g; blueSlider.value = Getter.Invoke().b; redValue.text = Mathf.FloorToInt(redSlider.value * 255).ToString(); greenValue.text = Mathf.FloorToInt(greenSlider.value * 255).ToString(); blueValue.text = Mathf.FloorToInt(blueSlider.value * 255).ToString(); colorPreview.color = Getter.Invoke(); Button resetButton = current.transform.Find("ResetButton").GetComponent <Button>(); resetButton.onClick.AddListener(delegate { redSlider.value = Default.r; greenSlider.value = Default.g; blueSlider.value = Default.b; redValue.text = Default.r.ToString(); greenValue.text = Default.g.ToString(); blueValue.text = Default.b.ToString(); colorPreview.color = Default; Setter.Invoke(Default); }); return(current); }
private void SetGridView(bool bUpdate = false) { //Set the grid name grdTableData.Title = "'" + mDSTableDetails.Name + "' Table Data"; grdTableData.ShowViewCombo = Visibility.Collapsed; mColumnNames = mDSTableDetails.DSC.GetColumnList(mDSTableDetails.Name); int iColIndex = mColumnNames.Count - 1; GridViewDef view = new GridViewDef(GridViewDef.DefaultViewName); view.GridColsView = new ObservableList <GridColView>(); foreach (string colName in mColumnNames) { string colHeader = colName.Replace("_", "__"); if (colName == "GINGER_ID") { view.GridColsView.Add(new GridColView() { Field = colName, Header = colHeader, Order = 0, WidthWeight = 10, BindingMode = BindingMode.OneWay }); } else if (colName == "GINGER_LAST_UPDATE_DATETIME" || colName == "GINGER_LAST_UPDATED_BY") { view.GridColsView.Add(new GridColView() { Field = colName, Header = colHeader, WidthWeight = 20, BindingMode = BindingMode.OneWay }); } else if (colName == "GINGER_USED") { view.GridColsView.Add(new GridColView() { Field = colName, Header = colHeader, WidthWeight = 20, StyleType = GridColView.eGridColStyleType.CheckBox }); } else { view.GridColsView.Add(new GridColView() { Field = colName, Header = colHeader, WidthWeight = 30 }); } } if (bUpdate == false) { grdTableData.SetAllColumnsDefaultView(view); grdTableData.InitViewItems(); } else { grdTableData.updateAndSelectCustomView(view); } foreach (DataGridColumn sCol in grdTableData.grdMain.Columns) { if (sCol.IsReadOnly == true) { sCol.CellStyle = new Style(typeof(DataGridCell)); mCellSetter = new Setter(DataGridCell.BackgroundProperty, new SolidColorBrush(Colors.LightGray)); sCol.CellStyle.Setters.Add(mCellSetter); } if (sCol.Header.ToString() == "GINGER__USED") { sCol.DisplayIndex = 1; } if (sCol.Header.ToString() == "GINGER__LAST__UPDATED__BY" || sCol.Header.ToString() == "GINGER__LAST__UPDATE__DATETIME") { if (sCol.DisplayIndex != -1) { sCol.DisplayIndex = iColIndex; iColIndex--; } else { sCol.DisplayIndex = iColIndex; iColIndex--; } } } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (_windowControl != null) { _windowControl.HeaderDragDelta -= (o, e) => this.OnHeaderDragDelta(e); _windowControl.HeaderIconDoubleClicked -= (o, e) => this.OnHeaderIconDoubleClick(e); _windowControl.CloseButtonClicked -= (o, e) => this.OnCloseButtonClicked(e); } _windowControl = this.GetTemplateChild(PART_WindowControl) as WindowControl; if (_windowControl != null) { _windowControl.HeaderDragDelta += (o, e) => this.OnHeaderDragDelta(e); _windowControl.HeaderIconDoubleClicked += (o, e) => this.OnHeaderIconDoubleClick(e); _windowControl.CloseButtonClicked += (o, e) => this.OnCloseButtonClicked(e); } this.UpdateBlockMouseInputsPanel(); _windowRoot = this.GetTemplateChild(PART_WindowRoot) as Grid; if (_windowRoot != null) { _windowRoot.RenderTransform = _moveTransform; } _hasWindowContainer = (VisualTreeHelper.GetParent(this) as WindowContainer) != null; if (!_hasWindowContainer) { _parentContainer = VisualTreeHelper.GetParent(this) as FrameworkElement; if (_parentContainer != null) { _parentContainer.LayoutUpdated += ParentContainer_LayoutUpdated; _parentContainer.SizeChanged += ParentContainer_SizeChanged; //this is for XBAP applications only. When inside an XBAP the parent container has no height or width until it has loaded. Therefore //we need to handle the loaded event and reposition the window. if (System.Windows.Interop.BrowserInteropHelper.IsBrowserHosted) { _parentContainer.Loaded += (o, e) => { ExecuteOpen(); }; } } this.Unloaded += new RoutedEventHandler(ChildWindow_Unloaded); //initialize our modal background width/height _modalLayer.Height = _parentContainer.ActualHeight; _modalLayer.Width = _parentContainer.ActualWidth; _root = this.GetTemplateChild(PART_Root) as Grid; #if VS2008 FocusVisualStyle = null; #else Style focusStyle = (_root != null) ? _root.Resources["FocusVisualStyle"] as Style : null; if (focusStyle != null) { Setter focusStyleDataContext = new Setter(Control.DataContextProperty, this); focusStyle.Setters.Add(focusStyleDataContext); FocusVisualStyle = focusStyle; } #endif if (_root != null) { _root.Children.Add(_modalLayerPanel); } } }
public void VerifyDefaultsAndBasicSetting() { NavigationView navView = null; Rectangle footer = null; TextBlock header = null; Setter styleSetter = null; Style hamburgerStyle = null; RunOnUIThread.Execute(() => { footer = new Rectangle(); footer.Height = 40; header = new TextBlock(); header.Text = "Header"; styleSetter = new Setter(); styleSetter.Property = FrameworkElement.MinHeightProperty; styleSetter.Value = "80"; hamburgerStyle = new Style(); navView = new NavigationView(); // Verify Defaults Verify.IsTrue(navView.IsPaneOpen); Verify.AreEqual(641, navView.CompactModeThresholdWidth); Verify.AreEqual(1008, navView.ExpandedModeThresholdWidth); Verify.IsNull(navView.PaneFooter); Verify.IsNull(navView.Header); Verify.IsTrue(navView.IsSettingsVisible); Verify.IsTrue(navView.IsPaneToggleButtonVisible); Verify.IsTrue(navView.AlwaysShowHeader); Verify.AreEqual(48, navView.CompactPaneLength); Verify.AreEqual(320, navView.OpenPaneLength); Verify.IsNull(navView.PaneToggleButtonStyle); Verify.AreEqual(0, navView.MenuItems.Count); Verify.AreEqual(NavigationViewDisplayMode.Minimal, navView.DisplayMode); Verify.AreEqual("", navView.PaneTitle); Verify.IsFalse(navView.IsBackEnabled); Verify.AreEqual(NavigationViewBackButtonVisible.Auto, navView.IsBackButtonVisible); // Verify basic setters navView.IsPaneOpen = true; navView.CompactModeThresholdWidth = 500; navView.ExpandedModeThresholdWidth = 1000; navView.PaneFooter = footer; navView.Header = header; navView.IsSettingsVisible = false; navView.IsPaneToggleButtonVisible = false; navView.AlwaysShowHeader = false; navView.CompactPaneLength = 40; navView.OpenPaneLength = 300; navView.PaneToggleButtonStyle = hamburgerStyle; navView.PaneTitle = "ChangedTitle"; navView.IsBackEnabled = true; navView.IsBackButtonVisible = NavigationViewBackButtonVisible.Visible; // TODO(test adding a MenuItem programmatically) }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { Verify.IsTrue(navView.IsPaneOpen); Verify.AreEqual(500, navView.CompactModeThresholdWidth); Verify.AreEqual(1000, navView.ExpandedModeThresholdWidth); Verify.AreEqual(footer, navView.PaneFooter); Verify.AreEqual(header, navView.Header); Verify.IsFalse(navView.IsSettingsVisible); Verify.IsFalse(navView.IsPaneToggleButtonVisible); Verify.IsFalse(navView.AlwaysShowHeader); Verify.AreEqual(40, navView.CompactPaneLength); Verify.AreEqual(300, navView.OpenPaneLength); Verify.AreEqual(hamburgerStyle, navView.PaneToggleButtonStyle); Verify.AreEqual("ChangedTitle", navView.PaneTitle); Verify.IsTrue(navView.IsBackEnabled); Verify.AreEqual(NavigationViewBackButtonVisible.Visible, navView.IsBackButtonVisible); // Verify nullable values navView.PaneFooter = null; navView.Header = null; navView.PaneToggleButtonStyle = null; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { Verify.IsNull(navView.PaneFooter); Verify.IsNull(navView.Header); Verify.IsNull(navView.PaneToggleButtonStyle); }); }
private void bwLoadData_DoWork(object sender, DoWorkEventArgs e) { outsoleMaterialList = OutsoleMaterialController.Select(); outsoleReleaseMaterialList = OutsoleReleaseMaterialController.SelectByOutsoleMaterial(); //lay ra nhung order co outsolematerial roi orderList = OrdersController.SelectByOutsoleMaterial(); outsoleSupplierList = OutsoleSuppliersController.Select(); outsoleRawMaterialList = OutsoleRawMaterialController.Select(); var outsoleCodeList = orderList.Select(o => o.OutsoleCode).Distinct().ToList(); // Group By ProductNo //var outsoleMaterialGroupBy_ProductNo = from p in outsoleMaterialList // group p.Quantity by p.ProductNo into g // select new { ProductNo = g.Key, Quantities = g.ToList() }; //var productNoList_Test = outsoleMaterialGroupBy_ProductNo.OrderBy(o => o.ProductNo).Select(s => s.ProductNo).ToList(); //// PO has Quantity > 0 //var productNoList = outsoleMaterialGroupBy_ProductNo.Where(w => w.Quantities.Sum() > 0).OrderBy(o => o.ProductNo).Select(s => s.ProductNo).Distinct().ToList(); //var outsoleCodeList = orderList.Where(w => productNoList.Contains(w.ProductNo)).Select(s => s.OutsoleCode).Distinct().ToList(); foreach (string outsoleCode in outsoleCodeList) { var productNoList = orderList.Where(w => w.OutsoleCode == outsoleCode).Select(s => s.ProductNo).Distinct().ToList(); var outsoleMaterialList_D1 = outsoleMaterialList.Where(o => productNoList.Contains(o.ProductNo)).ToList(); var supplierId_OutsoleCode = outsoleMaterialList_D1.Select(o => o.OutsoleSupplierId).Distinct().ToList(); supplierIdShowList.AddRange(supplierId_OutsoleCode); } supplierIdShowList = supplierIdShowList.Distinct().OrderBy(s => s).ToList(); var dt = new DataTable(); Dispatcher.Invoke(new Action(() => { dt.Columns.Add("OutsoleCode", typeof(String)); DataGridTextColumn column1 = new DataGridTextColumn(); column1.Header = "O/S Code"; column1.Binding = new Binding("OutsoleCode"); column1.FontWeight = FontWeights.Bold; dgInventory.Columns.Add(column1); Binding bindingWidth1 = new Binding(); bindingWidth1.Source = column1; bindingWidth1.Path = new PropertyPath("ActualWidth"); ColumnDefinition cd1 = new ColumnDefinition(); cd1.SetBinding(ColumnDefinition.WidthProperty, bindingWidth1); gridTotal.ColumnDefinitions.Add(cd1); dt.Columns.Add("Quantity", typeof(Int32)); DataGridTextColumn column2 = new DataGridTextColumn(); column2.Header = "Quantity"; column2.Binding = new Binding("Quantity"); dgInventory.Columns.Add(column2); Binding bindingWidth2 = new Binding(); bindingWidth2.Source = column2; bindingWidth2.Path = new PropertyPath("ActualWidth"); ColumnDefinition cd2 = new ColumnDefinition(); cd2.SetBinding(ColumnDefinition.WidthProperty, bindingWidth2); gridTotal.ColumnDefinitions.Add(cd2); dt.Columns.Add("Matching", typeof(Int32)); DataGridTextColumn column3 = new DataGridTextColumn(); column3.Header = "Matching"; column3.Binding = new Binding("Matching"); dgInventory.Columns.Add(column3); Binding bindingWidth3 = new Binding(); bindingWidth3.Source = column3; bindingWidth3.Path = new PropertyPath("ActualWidth"); ColumnDefinition cd3 = new ColumnDefinition(); cd3.SetBinding(ColumnDefinition.WidthProperty, bindingWidth3); gridTotal.ColumnDefinitions.Add(cd3); dt.Columns.Add("RejectMaximum", typeof(Int32)); DataGridTextColumn column4 = new DataGridTextColumn(); column4.Header = "Reject"; column4.Binding = new Binding("RejectMaximum"); dgInventory.Columns.Add(column4); Binding bindingWidth4 = new Binding(); bindingWidth4.Source = column4; bindingWidth4.Path = new PropertyPath("ActualWidth"); ColumnDefinition cd4 = new ColumnDefinition(); cd4.SetBinding(ColumnDefinition.WidthProperty, bindingWidth4); gridTotal.ColumnDefinitions.Add(cd4); dgInventory.FrozenColumnCount = 4; for (int i = 0; i < supplierIdShowList.Count; i++) { var outsoleSupplier = outsoleSupplierList.Where(w => w.OutsoleSupplierId == supplierIdShowList[i]).FirstOrDefault(); if (outsoleSupplier != null) { dt.Columns.Add(String.Format("Column{0}", supplierIdShowList[i]), typeof(String)); DataGridTextColumn column = new DataGridTextColumn(); column.Width = 30; column.Binding = new Binding(String.Format("Column{0}", supplierIdShowList[i])); column.FontWeight = FontWeights.Bold; Style style = new Style(typeof(DataGridCell)); style.Setters.Add(new Setter(TextBlock.TextAlignmentProperty, TextAlignment.Center)); Setter setterBackground = new Setter(); setterBackground.Property = DataGridCell.BackgroundProperty; setterBackground.Value = new Binding(String.Format("Column{0}Background", supplierIdShowList[i])); style.Setters.Add(setterBackground); Setter setterToolTip = new Setter(); setterToolTip.Property = DataGridCell.ToolTipProperty; setterToolTip.Value = new Binding(String.Format("Column{0}ToolTip", supplierIdShowList[i])); style.Setters.Add(setterToolTip); column.CellStyle = style; dgInventory.Columns.Add(column); Binding bindingWidth = new Binding(); bindingWidth.Source = column; bindingWidth.Path = new PropertyPath("ActualWidth"); ColumnDefinition cd = new ColumnDefinition(); cd.SetBinding(ColumnDefinition.WidthProperty, bindingWidth); gridTotal.ColumnDefinitions.Add(cd); DataColumn columnBackground = new DataColumn(String.Format("Column{0}Background", supplierIdShowList[i]), typeof(SolidColorBrush)); DataColumn columnToolTip = new DataColumn(String.Format("Column{0}ToolTip", supplierIdShowList[i]), typeof(String)); columnBackground.DefaultValue = Brushes.Transparent; dt.Columns.Add(columnBackground); dt.Columns.Add(columnToolTip); } } })); // Load Data foreach (string outsoleCode in outsoleCodeList) { var dr = dt.NewRow(); dr["OutsoleCode"] = outsoleCode; var productNoList_OutsoleCode = orderList.Where(o => o.OutsoleCode == outsoleCode).Select(o => o.ProductNo).Distinct().ToList(); var outsoleMaterialList_D1 = outsoleMaterialList.Where(o => productNoList_OutsoleCode.Contains(o.ProductNo)).ToList(); var outsoleReleaseMaterialList_D1 = outsoleReleaseMaterialList.Where(o => productNoList_OutsoleCode.Contains(o.ProductNo)).ToList(); var supplierIdList = outsoleMaterialList_D1.Select(o => o.OutsoleSupplierId).Distinct().ToList(); var qtyTotalList = new List <Int32>(); var qtyRejectList = new List <Int32>(); foreach (Int32 supplierId in supplierIdList) { var outsoleMaterialList_D2 = outsoleMaterialList_D1.Where(o => o.OutsoleSupplierId == supplierId).ToList(); int qtyTotal = 0; int qtyRejectTotal = 0; foreach (string productNo in productNoList_OutsoleCode) { var outsoleMaterialList_D3 = outsoleMaterialList_D2.Where(o => o.ProductNo == productNo).ToList(); var outsoleReleaseMaterialList_D3 = outsoleReleaseMaterialList_D1.Where(o => o.ProductNo == productNo).ToList(); var sizeNoList = outsoleMaterialList.Where(o => o.ProductNo == productNo).Select(o => o.SizeNo).Distinct().ToList(); foreach (string sizeNo in sizeNoList) { int qtyMax = outsoleMaterialList_D3.Where(o => o.SizeNo == sizeNo).Sum(o => o.Quantity - o.QuantityReject); int qtyRelease = outsoleReleaseMaterialList_D3.Where(o => o.SizeNo == sizeNo).Sum(o => o.Quantity); int qtyReject = outsoleMaterialList_D3.Where(o => o.SizeNo == sizeNo).Sum(s => s.QuantityReject); int qty = qtyMax - qtyRelease; if (qty < 0) { qty = 0; } qtyTotal += qty; qtyRejectTotal += qtyReject; } } dr[String.Format("Column{0}", supplierId)] = "x"; dr[String.Format("Column{0}Background", supplierId)] = Brushes.Green; var suppName = outsoleSupplierList.Where(w => w.OutsoleSupplierId == supplierId).Select(s => s.Name).FirstOrDefault(); if (suppName != null) { dr[String.Format("Column{0}ToolTip", supplierId)] = string.Format("{0}{1}", suppName, qtyRejectTotal > 0 ? String.Format("\nQtyReject: {0}", qtyRejectTotal.ToString()) : ""); //suppName + "/n" + "Qty Reject: " + qtyRejectTotal.ToString(); } qtyTotalList.Add(qtyTotal); qtyRejectList.Add(qtyRejectTotal); } int qtyMatchTotal = 0; foreach (string productNo in productNoList_OutsoleCode) { var outsoleMaterialList_D2 = outsoleMaterialList_D1.Where(o => o.ProductNo == productNo).ToList(); var outsoleReleaseMaterialList_D2 = outsoleReleaseMaterialList_D1.Where(o => o.ProductNo == productNo).ToList(); var sizeNoList = outsoleMaterialList.Where(o => o.ProductNo == productNo).Select(o => o.SizeNo).Distinct().ToList(); foreach (string sizeNo in sizeNoList) { int qtyMin = outsoleMaterialList_D2.Where(o => o.SizeNo == sizeNo).Select(o => o.Quantity - o.QuantityReject).Min(); int qtyRelease = outsoleReleaseMaterialList_D2.Where(o => o.SizeNo == sizeNo).Sum(o => o.Quantity); int qtyMatch = qtyMin - qtyRelease; if (qtyMatch < 0) { qtyMatch = 0; } qtyMatchTotal += qtyMatch; } } if (qtyTotalList.Sum() == 0 && qtyMatchTotal == 0 && qtyRejectList.Sum() == 0) { continue; } dr["RejectMaximum"] = qtyRejectList.Max(); dr["Quantity"] = qtyTotalList.Max(); dr["Matching"] = qtyMatchTotal; dt.Rows.Add(dr); } Dispatcher.Invoke(new Action(() => { dgInventory.ItemsSource = dt.AsDataView(); TextBlock lblTotal = new TextBlock(); lblTotal.Text = "TOTAL"; lblTotal.Margin = new Thickness(1, 0, 0, 0); lblTotal.FontWeight = FontWeights.Bold; Border bdrTotal = new Border(); Grid.SetColumn(bdrTotal, 1); Grid.SetColumnSpan(bdrTotal, 2); bdrTotal.BorderThickness = new Thickness(1, 0, 1, 1); bdrTotal.BorderBrush = Brushes.Black; bdrTotal.Child = lblTotal; gridTotal.Children.Add(bdrTotal); TextBlock lblQuantityTotal = new TextBlock(); lblQuantityTotal.Text = dt.Compute("Sum(Quantity)", "").ToString(); lblQuantityTotal.Margin = new Thickness(1, 0, 0, 0); lblQuantityTotal.FontWeight = FontWeights.Bold; Border bdrQuantityTotal = new Border(); Grid.SetColumn(bdrQuantityTotal, 3); bdrQuantityTotal.BorderThickness = new Thickness(0, 0, 1, 1); bdrQuantityTotal.BorderBrush = Brushes.Black; bdrQuantityTotal.Child = lblQuantityTotal; gridTotal.Children.Add(bdrQuantityTotal); dgInventory.ItemsSource = dt.AsDataView(); TextBlock lblMatchingTotal = new TextBlock(); lblMatchingTotal.Text = dt.Compute("Sum(Matching)", "").ToString(); lblMatchingTotal.Margin = new Thickness(1, 0, 0, 0); lblMatchingTotal.FontWeight = FontWeights.Bold; Border bdrMatchingTotal = new Border(); Grid.SetColumn(bdrMatchingTotal, 4); bdrMatchingTotal.BorderThickness = new Thickness(0, 0, 1, 1); bdrMatchingTotal.BorderBrush = Brushes.Black; bdrMatchingTotal.Child = lblMatchingTotal; gridTotal.Children.Add(bdrMatchingTotal); dgInventory.ItemsSource = dt.AsDataView(); TextBlock lblRejectMaximunTotal = new TextBlock(); lblRejectMaximunTotal.Text = dt.Compute("Sum(RejectMaximum)", "").ToString(); lblRejectMaximunTotal.Margin = new Thickness(1, 0, 0, 0); lblRejectMaximunTotal.FontWeight = FontWeights.Bold; Border bdrRejectMaximumTotal = new Border(); Grid.SetColumn(bdrRejectMaximumTotal, 5); bdrRejectMaximumTotal.BorderThickness = new Thickness(0, 0, 1, 1); bdrRejectMaximumTotal.BorderBrush = Brushes.Black; bdrRejectMaximumTotal.Child = lblRejectMaximunTotal; gridTotal.Children.Add(bdrRejectMaximumTotal); dgInventory.ItemsSource = dt.AsDataView(); })); }
private void InitializeResources() { // Resource - [HydrogenIcon] BitmapImage BitmapImage r_0_bm = new BitmapImage(); r_0_bm.TextureAsset = "ImagesUI/hydrogen_res"; this.Add("HydrogenIcon", r_0_bm); // Resource - [BiomassIcon] BitmapImage BitmapImage r_1_bm = new BitmapImage(); r_1_bm.TextureAsset = "ImagesUI/biomass_res"; this.Add("BiomassIcon", r_1_bm); // Resource - [CopperIcon] BitmapImage BitmapImage r_2_bm = new BitmapImage(); r_2_bm.TextureAsset = "ImagesUI/copper_res"; this.Add("CopperIcon", r_2_bm); // Resource - [LeadIcon] BitmapImage BitmapImage r_3_bm = new BitmapImage(); r_3_bm.TextureAsset = "ImagesUI/lead_res"; this.Add("LeadIcon", r_3_bm); // Resource - [AluminiumIcon] BitmapImage BitmapImage r_4_bm = new BitmapImage(); r_4_bm.TextureAsset = "ImagesUI/aluminium_res"; this.Add("AluminiumIcon", r_4_bm); // Resource - [NaturalGasIcon] BitmapImage BitmapImage r_5_bm = new BitmapImage(); r_5_bm.TextureAsset = "ImagesUI/gas_res"; this.Add("NaturalGasIcon", r_5_bm); // Resource - [PropaneIcon] BitmapImage BitmapImage r_6_bm = new BitmapImage(); r_6_bm.TextureAsset = "ImagesUI/propane_res"; this.Add("PropaneIcon", r_6_bm); // Resource - [DiamondIcon] BitmapImage BitmapImage r_7_bm = new BitmapImage(); r_7_bm.TextureAsset = "ImagesUI/diamond_res"; this.Add("DiamondIcon", r_7_bm); // Resource - [MonoGameLogo] BitmapImage BitmapImage r_8_bm = new BitmapImage(); r_8_bm.TextureAsset = "Images/MonogameLogo"; this.Add("MonoGameLogo", r_8_bm); // Resource - [MiningIcon] BitmapImage BitmapImage r_9_bm = new BitmapImage(); r_9_bm.TextureAsset = "ImagesUI/mine_build"; this.Add("MiningIcon", r_9_bm); // Resource - [TimberIcon] BitmapImage BitmapImage r_10_bm = new BitmapImage(); r_10_bm.TextureAsset = "ImagesUI/timber_res"; this.Add("TimberIcon", r_10_bm); // Resource - [TitaniumIcon] BitmapImage BitmapImage r_11_bm = new BitmapImage(); r_11_bm.TextureAsset = "ImagesUI/titanium_res"; this.Add("TitaniumIcon", r_11_bm); // Resource - [Building2] BitmapImage BitmapImage r_12_bm = new BitmapImage(); r_12_bm.TextureAsset = "ImagesUI/building2"; this.Add("Building2", r_12_bm); // Resource - [Building1] BitmapImage BitmapImage r_13_bm = new BitmapImage(); r_13_bm.TextureAsset = "ImagesUI/building1"; this.Add("Building1", r_13_bm); // Resource - [Sounds] SoundSourceCollection var r_14_sounds = new SoundSourceCollection(); r_14_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" }); SoundManager.Instance.AddSound("Click"); r_14_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" }); SoundManager.Instance.AddSound("KeyPress"); r_14_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" }); SoundManager.Instance.AddSound("Move"); r_14_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" }); SoundManager.Instance.AddSound("Select"); this.Add("Sounds", r_14_sounds); // Resource - [buttonAnimStyle] Style var r_15_s_bo = this[typeof(Button)]; Style r_15_s = new Style(typeof(Button), r_15_s_bo as Style); Setter r_15_s_S_0 = new Setter(Button.WidthProperty, 200F); r_15_s.Setters.Add(r_15_s_S_0); Setter r_15_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F)); r_15_s.Setters.Add(r_15_s_S_1); Setter r_15_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false); r_15_s.Setters.Add(r_15_s_S_2); EventTrigger r_15_s_ET_0 = new EventTrigger(Button.MouseEnterEvent); r_15_s.Triggers.Add(r_15_s_ET_0); BeginStoryboard r_15_s_ET_0_AC_0 = new BeginStoryboard(); r_15_s_ET_0_AC_0.Name = "r_15_s_ET_0_AC_0"; r_15_s_ET_0.AddAction(r_15_s_ET_0_AC_0); Storyboard r_15_s_ET_0_AC_0_SB = new Storyboard(); r_15_s_ET_0_AC_0.Storyboard = r_15_s_ET_0_AC_0_SB; r_15_s_ET_0_AC_0_SB.Name = "r_15_s_ET_0_AC_0_SB"; ThicknessAnimation r_15_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation(); r_15_s_ET_0_AC_0_SB_TL_0.Name = "r_15_s_ET_0_AC_0_SB_TL_0"; r_15_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_15_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F); r_15_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F); SineEase r_15_s_ET_0_AC_0_SB_TL_0_EA = new SineEase(); r_15_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_15_s_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_15_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty); r_15_s_ET_0_AC_0_SB.Children.Add(r_15_s_ET_0_AC_0_SB_TL_0); FloatAnimation r_15_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); r_15_s_ET_0_AC_0_SB_TL_1.Name = "r_15_s_ET_0_AC_0_SB_TL_1"; r_15_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_15_s_ET_0_AC_0_SB_TL_1.To = 220F; SineEase r_15_s_ET_0_AC_0_SB_TL_1_EA = new SineEase(); r_15_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_15_s_ET_0_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_15_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty); r_15_s_ET_0_AC_0_SB.Children.Add(r_15_s_ET_0_AC_0_SB_TL_1); EventTrigger r_15_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent); r_15_s.Triggers.Add(r_15_s_ET_1); BeginStoryboard r_15_s_ET_1_AC_0 = new BeginStoryboard(); r_15_s_ET_1_AC_0.Name = "r_15_s_ET_1_AC_0"; r_15_s_ET_1.AddAction(r_15_s_ET_1_AC_0); Storyboard r_15_s_ET_1_AC_0_SB = new Storyboard(); r_15_s_ET_1_AC_0.Storyboard = r_15_s_ET_1_AC_0_SB; r_15_s_ET_1_AC_0_SB.Name = "r_15_s_ET_1_AC_0_SB"; ThicknessAnimation r_15_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation(); r_15_s_ET_1_AC_0_SB_TL_0.Name = "r_15_s_ET_1_AC_0_SB_TL_0"; r_15_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_15_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F); r_15_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F); SineEase r_15_s_ET_1_AC_0_SB_TL_0_EA = new SineEase(); r_15_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_15_s_ET_1_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_15_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty); r_15_s_ET_1_AC_0_SB.Children.Add(r_15_s_ET_1_AC_0_SB_TL_0); FloatAnimation r_15_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation(); r_15_s_ET_1_AC_0_SB_TL_1.Name = "r_15_s_ET_1_AC_0_SB_TL_1"; r_15_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_15_s_ET_1_AC_0_SB_TL_1.To = 200F; SineEase r_15_s_ET_1_AC_0_SB_TL_1_EA = new SineEase(); r_15_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_15_s_ET_1_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_15_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty); r_15_s_ET_1_AC_0_SB.Children.Add(r_15_s_ET_1_AC_0_SB_TL_1); this.Add("buttonAnimStyle", r_15_s); // Resource - [ZincIcon] BitmapImage BitmapImage r_16_bm = new BitmapImage(); r_16_bm.TextureAsset = "ImagesUI/zinc_res"; this.Add("ZincIcon", r_16_bm); // Resource - [SunBurnLogo] BitmapImage BitmapImage r_17_bm = new BitmapImage(); r_17_bm.TextureAsset = "Images/SunBurn"; this.Add("SunBurnLogo", r_17_bm); // Resource - [buttonStyle] Style var r_18_s_bo = this[typeof(Button)]; Style r_18_s = new Style(typeof(Button), r_18_s_bo as Style); Setter r_18_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255))); r_18_s.Setters.Add(r_18_s_S_0); this.Add("buttonStyle", r_18_s); // Resource - [GoldIcon] BitmapImage BitmapImage r_19_bm = new BitmapImage(); r_19_bm.TextureAsset = "ImagesUI/gold_res"; this.Add("GoldIcon", r_19_bm); // Resource - [IronIcon] BitmapImage BitmapImage r_20_bm = new BitmapImage(); r_20_bm.TextureAsset = "ImagesUI/iron_res"; this.Add("IronIcon", r_20_bm); // Resource - [CoalIcon] BitmapImage BitmapImage r_21_bm = new BitmapImage(); r_21_bm.TextureAsset = "ImagesUI/coal_res"; this.Add("CoalIcon", r_21_bm); // Resource - [OilIcon] BitmapImage BitmapImage r_22_bm = new BitmapImage(); r_22_bm.TextureAsset = "ImagesUI/oil_res"; this.Add("OilIcon", r_22_bm); // Resource - [ThoriumIcon] BitmapImage BitmapImage r_23_bm = new BitmapImage(); r_23_bm.TextureAsset = "ImagesUI/thorium_res"; this.Add("ThoriumIcon", r_23_bm); // Resource - [UraniumIcon] BitmapImage BitmapImage r_24_bm = new BitmapImage(); r_24_bm.TextureAsset = "ImagesUI/uranium_res"; this.Add("UraniumIcon", r_24_bm); // Resource - [SilverIcon] BitmapImage BitmapImage r_25_bm = new BitmapImage(); r_25_bm.TextureAsset = "ImagesUI/silver_res"; this.Add("SilverIcon", r_25_bm); // Resource - [MagnesiumIcon] BitmapImage BitmapImage r_26_bm = new BitmapImage(); r_26_bm.TextureAsset = "ImagesUI/magnesium_res"; this.Add("MagnesiumIcon", r_26_bm); // Resource - [LivestockIcon] BitmapImage BitmapImage r_27_bm = new BitmapImage(); r_27_bm.TextureAsset = "ImagesUI/livestock_res"; this.Add("LivestockIcon", r_27_bm); // Resource - [WaterIcon] BitmapImage BitmapImage r_28_bm = new BitmapImage(); r_28_bm.TextureAsset = "ImagesUI/water_res"; this.Add("WaterIcon", r_28_bm); // Resource - [PlatinumIcon] BitmapImage BitmapImage r_29_bm = new BitmapImage(); r_29_bm.TextureAsset = "ImagesUI/platinum_res"; this.Add("PlatinumIcon", r_29_bm); ImageManager.Instance.AddImage("ImagesUI/hydrogen_res"); ImageManager.Instance.AddImage("ImagesUI/biomass_res"); ImageManager.Instance.AddImage("ImagesUI/copper_res"); ImageManager.Instance.AddImage("ImagesUI/lead_res"); ImageManager.Instance.AddImage("ImagesUI/aluminium_res"); ImageManager.Instance.AddImage("ImagesUI/gas_res"); ImageManager.Instance.AddImage("ImagesUI/propane_res"); ImageManager.Instance.AddImage("ImagesUI/diamond_res"); ImageManager.Instance.AddImage("Images/MonogameLogo"); ImageManager.Instance.AddImage("ImagesUI/mine_build"); ImageManager.Instance.AddImage("ImagesUI/timber_res"); ImageManager.Instance.AddImage("ImagesUI/titanium_res"); ImageManager.Instance.AddImage("ImagesUI/building2"); ImageManager.Instance.AddImage("ImagesUI/building1"); ImageManager.Instance.AddImage("ImagesUI/zinc_res"); ImageManager.Instance.AddImage("Images/SunBurn"); ImageManager.Instance.AddImage("ImagesUI/gold_res"); ImageManager.Instance.AddImage("ImagesUI/iron_res"); ImageManager.Instance.AddImage("ImagesUI/coal_res"); ImageManager.Instance.AddImage("ImagesUI/oil_res"); ImageManager.Instance.AddImage("ImagesUI/thorium_res"); ImageManager.Instance.AddImage("ImagesUI/uranium_res"); ImageManager.Instance.AddImage("ImagesUI/silver_res"); ImageManager.Instance.AddImage("ImagesUI/magnesium_res"); ImageManager.Instance.AddImage("ImagesUI/livestock_res"); ImageManager.Instance.AddImage("ImagesUI/water_res"); ImageManager.Instance.AddImage("ImagesUI/platinum_res"); }
private void InitializeResources() { // Resource - [ToolTipText] String this.Add("ToolTipText", "Click to open message box"); // Resource - [TitleResource] String this.Add("TitleResource", "Basic UI Example"); // Resource - [logoSunburn] BitmapImage BitmapImage r_2_bm = new BitmapImage(); r_2_bm.TextureAsset = "Images/SunBurn"; this.Add("logoSunburn", r_2_bm); // Resource - [buttonStyle] Style var r_3_s_bo = this[typeof(Button)]; Style r_3_s = new Style(typeof(Button), r_3_s_bo as Style); Setter r_3_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255))); r_3_s.Setters.Add(r_3_s_S_0); Setter r_3_s_S_1 = new Setter(Button.WidthProperty, 200F); r_3_s.Setters.Add(r_3_s_S_1); Setter r_3_s_S_2 = new Setter(Button.PaddingProperty, new Thickness(2F)); r_3_s.Setters.Add(r_3_s_S_2); this.Add("buttonStyle", r_3_s); // Resource - [logoEmptyKeys] BitmapImage BitmapImage r_4_bm = new BitmapImage(); r_4_bm.TextureAsset = "Images/EmptyKeysLogoTextSmall"; this.Add("logoEmptyKeys", r_4_bm); // Resource - [buttonAnimStyle] Style var r_5_s_bo = this[typeof(Button)]; Style r_5_s = new Style(typeof(Button), r_5_s_bo as Style); Setter r_5_s_S_0 = new Setter(Button.WidthProperty, 200F); r_5_s.Setters.Add(r_5_s_S_0); Setter r_5_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F)); r_5_s.Setters.Add(r_5_s_S_1); Setter r_5_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false); r_5_s.Setters.Add(r_5_s_S_2); EventTrigger r_5_s_ET_0 = new EventTrigger(Button.MouseEnterEvent); r_5_s.Triggers.Add(r_5_s_ET_0); BeginStoryboard r_5_s_ET_0_AC_0 = new BeginStoryboard(); r_5_s_ET_0_AC_0.Name = "r_5_s_ET_0_AC_0"; r_5_s_ET_0.AddAction(r_5_s_ET_0_AC_0); Storyboard r_5_s_ET_0_AC_0_SB = new Storyboard(); r_5_s_ET_0_AC_0.Storyboard = r_5_s_ET_0_AC_0_SB; r_5_s_ET_0_AC_0_SB.Name = "r_5_s_ET_0_AC_0_SB"; ThicknessAnimation r_5_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation(); r_5_s_ET_0_AC_0_SB_TL_0.Name = "r_5_s_ET_0_AC_0_SB_TL_0"; r_5_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_5_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F); r_5_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F); SineEase r_5_s_ET_0_AC_0_SB_TL_0_EA = new SineEase(); r_5_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_5_s_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_5_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty); r_5_s_ET_0_AC_0_SB.Children.Add(r_5_s_ET_0_AC_0_SB_TL_0); FloatAnimation r_5_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); r_5_s_ET_0_AC_0_SB_TL_1.Name = "r_5_s_ET_0_AC_0_SB_TL_1"; r_5_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_5_s_ET_0_AC_0_SB_TL_1.To = 220F; SineEase r_5_s_ET_0_AC_0_SB_TL_1_EA = new SineEase(); r_5_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_5_s_ET_0_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_5_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty); r_5_s_ET_0_AC_0_SB.Children.Add(r_5_s_ET_0_AC_0_SB_TL_1); EventTrigger r_5_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent); r_5_s.Triggers.Add(r_5_s_ET_1); BeginStoryboard r_5_s_ET_1_AC_0 = new BeginStoryboard(); r_5_s_ET_1_AC_0.Name = "r_5_s_ET_1_AC_0"; r_5_s_ET_1.AddAction(r_5_s_ET_1_AC_0); Storyboard r_5_s_ET_1_AC_0_SB = new Storyboard(); r_5_s_ET_1_AC_0.Storyboard = r_5_s_ET_1_AC_0_SB; r_5_s_ET_1_AC_0_SB.Name = "r_5_s_ET_1_AC_0_SB"; ThicknessAnimation r_5_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation(); r_5_s_ET_1_AC_0_SB_TL_0.Name = "r_5_s_ET_1_AC_0_SB_TL_0"; r_5_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_5_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F); r_5_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F); SineEase r_5_s_ET_1_AC_0_SB_TL_0_EA = new SineEase(); r_5_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_5_s_ET_1_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_5_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty); r_5_s_ET_1_AC_0_SB.Children.Add(r_5_s_ET_1_AC_0_SB_TL_0); FloatAnimation r_5_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation(); r_5_s_ET_1_AC_0_SB_TL_1.Name = "r_5_s_ET_1_AC_0_SB_TL_1"; r_5_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_5_s_ET_1_AC_0_SB_TL_1.To = 200F; SineEase r_5_s_ET_1_AC_0_SB_TL_1_EA = new SineEase(); r_5_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_5_s_ET_1_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_5_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty); r_5_s_ET_1_AC_0_SB.Children.Add(r_5_s_ET_1_AC_0_SB_TL_1); this.Add("buttonAnimStyle", r_5_s); // Resource - [MessageBoxButtonYes] String this.Add("MessageBoxButtonYes", "Yes!"); // Resource - [Sounds] SoundSourceCollection var r_7_sounds = new SoundSourceCollection(); r_7_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" }); SoundManager.Instance.AddSound("Click"); r_7_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" }); SoundManager.Instance.AddSound("KeyPress"); r_7_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" }); SoundManager.Instance.AddSound("Move"); r_7_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" }); SoundManager.Instance.AddSound("Select"); this.Add("Sounds", r_7_sounds); ImageManager.Instance.AddImage("Images/SunBurn"); ImageManager.Instance.AddImage("Images/EmptyKeysLogoTextSmall"); FontManager.Instance.AddFont("Segoe UI", 13.33333F, FontStyle.Regular, "Segoe_UI_10_Regular"); FontManager.Instance.AddFont("Segoe UI", 20F, FontStyle.Bold, "Segoe_UI_15_Bold"); FontManager.Instance.AddFont("Segoe UI", 12F, FontStyle.Regular, "Segoe_UI_9_Regular"); }
internal FloatTweener(Getter getter, Setter setter, float finalValue, float duration) : base(getter, setter, finalValue, duration) { }
static void AttachVisualChild_Private(UIElement child, UIElement parent) { // // THIS IS WHAT THE FINAL STRUCTURE IN THE DOM TREE WILL LOOK LIKE: // // domElementWhereToPlaceChildStuff // --- [wrapperForChild] // --- --- [innerDivOfWrapperForChild] // --- --- --- [additionalOutsideDivForMargins, aka BoxSizing] // --- --- --- --- outerDomElement // //-------------------------------------------------------- // APPLY IMPLICIT AND DEFAULT STYLES: //-------------------------------------------------------- #if PERFSTAT var t = Performance.now(); #endif //See if the child has a Style, if not, try to find an implicitStyle for its Type. FrameworkElement childAsFrameworkElement = child as FrameworkElement; if (childAsFrameworkElement != null) { if (childAsFrameworkElement.Style == null) { //----------------------------- // APPLY IMPLICIT STYLE IF ANY: //----------------------------- Style style = null; //Note if anyone wonders: if type B inherits from type A, an Implicit Style defined for type A is ignored by elements of type B (tested in an SL project). if (UpdateElementInheritedImplicitStyles(childAsFrameworkElement, (FrameworkElement)parent)) { Type childType = child.GetType(); foreach (ResourceDictionary resourceDictionary in childAsFrameworkElement.INTERNAL_InheritedImplicitStyles) // Note: "INTERNAL_InheritedImplicitStyles" is not null because the method above returned True. { if (resourceDictionary.ContainsKey(childType)) { style = resourceDictionary[childType] as Style; break; } } } if (style != null) { childAsFrameworkElement.Style = style; childAsFrameworkElement.INTERNAL_IsImplicitStyle = true; //Note: it is important that we do this AFTER setting the Style property to the ImplicitStyle because the setter of the Style Property sets it to false to avoid removing styles that are not implicit. } } //Add the effect of the setters of the default Style on the child: Style childDefaultStyle = childAsFrameworkElement.INTERNAL_defaultStyle; if (childDefaultStyle != null) { //---------------------------- // APPLY DEFAULT STYLE IF ANY: //---------------------------- //get the list of setters of the currently applied style on the element and of the default style: Dictionary <DependencyProperty, Setter> normalStyleDictionary = null; bool childHasStyle = childAsFrameworkElement.Style != null; if (childHasStyle) { normalStyleDictionary = childAsFrameworkElement.Style.GetDictionaryOfSettersFromStyle(); } Dictionary <DependencyProperty, Setter> defaultStyleDictionary = childDefaultStyle.GetDictionaryOfSettersFromStyle(); //for all the setters the default style has, that are not on properties already affected by the normal style, we apply them like a normal style (we basically do the same as what we do on each setter in FrameworkElement.Style_Changed): foreach (DependencyProperty prop in #if BRIDGE INTERNAL_BridgeWorkarounds.GetDictionaryKeys_SimulatorCompatible(defaultStyleDictionary) #else defaultStyleDictionary.Keys #endif ) { if (!childHasStyle || !normalStyleDictionary.ContainsKey(prop)) { Setter setter = defaultStyleDictionary[prop]; childDefaultStyle.SetterValueChanged -= childAsFrameworkElement.StyleSetterValueChanged; childDefaultStyle.SetterValueChanged += childAsFrameworkElement.StyleSetterValueChanged; INTERNAL_PropertyStorage storage = INTERNAL_PropertyStore.GetStorageOrCreateNewIfNotExists(childAsFrameworkElement, setter.Property); INTERNAL_PropertyStore.SetLocalStyleValue(storage, setter.Value); } } } } #if PERFSTAT Performance.Counter("VisualTreeManager: Apply implicit and default styles", t); #endif //-------------------------------------------------------- // PREPARE THE PARENT: //-------------------------------------------------------- #if PERFSTAT var t0 = Performance.now(); #endif // Prepare the parent DOM structure so that it is ready to contain the child (for example, in case of a grid, we need to (re)create the rows and columns where to place the elements). //parent.INTERNAL_UpdateDomStructureIfNecessary(); object domElementWhereToPlaceChildStuff = (parent.GetDomElementWhereToPlaceChild(child) ?? parent.INTERNAL_InnerDomElement); // A "wrapper for child" is sometimes needed between the child and the parent (for example in case of a grid). It is usually one or more DIVs that fit in-between the child and the parent, and that are used to position the child within the parent. object innerDivOfWrapperForChild; object wrapperForChild = parent.CreateDomChildWrapper(domElementWhereToPlaceChildStuff, out innerDivOfWrapperForChild); bool comparison1 = (wrapperForChild == null); // Note: we need due to a bug of JSIL where translation fails if we do not use this temp variable. bool comparison2 = (innerDivOfWrapperForChild == null); // Note: we need due to a bug of JSIL where translation fails if we do not use this temp variable. bool doesParentRequireToCreateAWrapperForEachChild = (!comparison1 && !comparison2); // Note: The result is "True" for complex structures such as tables, false otherwise (cf. documentation in "INTERNAL_VisualChildInformation" class). #if PERFSTAT Performance.Counter("VisualTreeManager: Prepare the parent", t0); #endif //-------------------------------------------------------- // CONTINUE WITH THE OTHER STEPS (OR DEFER TO WHEN THE ELEMENT IS VISIBLE, IF THE OPTIMIZATION TO NOT LOAD COLLAPSED CONTROLS IS ENABLED): //-------------------------------------------------------- if (!EnableOptimizationWhereCollapsedControlsAreNotLoaded || child.Visibility != Visibility.Collapsed) { AttachVisualChild_Private_FinalStepsOnlyIfControlIsVisible( child, parent, doesParentRequireToCreateAWrapperForEachChild, innerDivOfWrapperForChild, domElementWhereToPlaceChildStuff, wrapperForChild); } else { child.INTERNAL_DeferredLoadingWhenControlBecomesVisible = () => { AttachVisualChild_Private_FinalStepsOnlyIfControlIsVisible( child, parent, doesParentRequireToCreateAWrapperForEachChild, innerDivOfWrapperForChild, domElementWhereToPlaceChildStuff, wrapperForChild); }; } }
public SetterWrappedServiceVariable(Setter setter, Instance instance, Frame creator, ServiceDeclaration declaration = ServiceDeclaration.ImplementationType) : base(instance, creator, declaration) { _setter = setter; }
public void Setter(Setter setter) { Items.Add(setter.Description); }
/// <summary> /// 程序开始直接调用画出原始图像 /// </summary> /// <param name="yLabel">要画的图的名称</param> /// <returns></returns> private bool Plot(string yLabel) { Paint paint = new Paint(); List <List <Point> > formerList = new List <List <Point> >(); foreach (var item in dictionary) { formerList.Add(item.Value); } if (yLabel.Equals("时域波形"))//这个if为将序列坐标变换后,生成visual对象,并添加显示,同时设定标志位,以保存本次所绘曲线的类型 { flag = 0; pointsList = CoordinateTransformError(formerList); for (int i = 0; i < pointsList.Count; i++) { InitialVisualList.Add(paint.DrawVisual(pointsList[i], true, false, LineType.Line, new Pen(color.colors[i], 1.3))); } graphicContext.YLabel = yLabel; graphicContext.XLabel = "时间(ns)"; } else if (yLabel.Equals("功率谱密度")) { flag = 1; pointsList = CoordinateTransformDb(formerList); for (int i = 0; i < pointsList.Count; i++) { InitialVisualList.Add(paint.DrawVisual(pointsList[i], true, false, LineType.Bezier, new Pen(color.colors[i], 1.3))); } graphicContext.YLabel = yLabel + "(dB)"; graphicContext.XLabel = "频率(MHz)"; } else if (yLabel.Equals("自相关函数")) { flag = 2; pointsList = CoordinateTransformRs(formerList); for (int i = 0; i < pointsList.Count; i++) { InitialVisualList.Add(paint.DrawVisual(pointsList[i], true, false, LineType.Bezier, new Pen(color.colors[i], 1.3))); } graphicContext.YLabel = yLabel; graphicContext.XLabel = "时延(microseconds)"; } else if (yLabel.Equals("s曲线")) { flag = 3; pointsList = CoordinateTransformError(formerList); for (int i = 0; i < pointsList.Count; i++) { InitialVisualList.Add(paint.DrawVisual(pointsList[i], true, false, LineType.Bezier, new Pen(color.colors[i], 1.3))); } graphicContext.YLabel = yLabel; graphicContext.XLabel = "时延(microseconds)"; } else if (yLabel.Equals("码跟踪精度(时延)")) { flag = 4; pointsList = CoordinateTransformRs(formerList); for (int i = 0; i < pointsList.Count; i++) { InitialVisualList.Add(paint.DrawVisual(pointsList[i], true, false, LineType.Bezier, new Pen(color.colors[i], 1.3))); } graphicContext.YLabel = yLabel; graphicContext.XLabel = "时延(microseconds)"; } else if (yLabel.Equals("码跟踪精度(信噪比)")) { flag = 5; pointsList = CoordinateTransformRs(formerList); for (int i = 0; i < pointsList.Count; i++) { InitialVisualList.Add(paint.DrawVisual(pointsList[i], true, false, LineType.Bezier, new Pen(color.colors[i], 1.3))); } graphicContext.YLabel = yLabel; graphicContext.XLabel = "信噪比(dB)"; } else if (yLabel.Equals("镜像多径引起的偏移误差")) { flag = 6; pointsList = CoordinateTransformError(formerList); for (int i = 0; i < pointsList.Count; i++) { InitialVisualList.Add(paint.DrawVisual(pointsList[i], true, false, LineType.Bezier, new Pen(color.colors[i / 2], 1.3))); } graphicContext.YLabel = yLabel; graphicContext.XLabel = "多径时延(ns)"; } //重画图像 drawingCanvas.RemoveAll(); foreach (var visual in InitialVisualList) { drawingCanvas.AddVisual(visual); } RuntimeVisualList = InitialVisualList; //设定命中判断所用的visual集合 for (int i = 0; i < dictionary.Count; i++) //添加listBox的项,以创建图例 { ListBoxItem listBoxItem = new ListBoxItem(); listBoxItem.Content = dictionary.ElementAt(i).Key; if (flag != 6) { listBoxItem.Foreground = color.colors[i]; } else { listBoxItem.Foreground = color.colors[i / 2]; } Setter setter = new Setter(FontSizeProperty, 7, "listBoxItem"); listBox.Items.Add(listBoxItem); } //设定x坐标 graphicContext.LabelX_0 = xMin.ToString("f");; graphicContext.LabelX_1 = (xMin + gapX).ToString("f"); graphicContext.LabelX_2 = (xMin + 2 * gapX).ToString("f"); graphicContext.LabelX_3 = (xMin + 3 * gapX).ToString("f"); graphicContext.LabelX_4 = (xMin + 4 * gapX).ToString("f"); graphicContext.LabelX_5 = (xMin + 5 * gapX).ToString("f"); graphicContext.LabelX_6 = (xMin + 6 * gapX).ToString("f"); return(true); }
public ExposedMethodField CreateExposedMethodButton(ExposedMethod method, Getter getter, Setter setter) { ExposedMethodField methodDrawer = (ExposedMethodField)Inspector.CreateDrawerForType(typeof(ExposedMethod), drawArea, Depth + 1, false); if (methodDrawer != null) { methodDrawer.BindTo(typeof(ExposedMethod), string.Empty, getter, setter); methodDrawer.SetBoundMethod(method); exposedMethods.Add(methodDrawer); } return(methodDrawer); }
public DoubleProp(Getter getter, Setter setter) { _getter = getter; _setter = setter; }
/// <summary> /// Called when the category setting is toggled. Adds or removes a series from the chart /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CategoryToggle_Toggled(object sender, RoutedEventArgs e) { // Get the name of the catefory from the toggle switch string CategoryName = ((sender as ToggleSwitch).OnContent as string); // Check to see if it was toggled on or off if ((sender as ToggleSwitch).IsOn) { List <Expense> TempItems; List <DateValueItem> TempChartData = new List <DateValueItem>(); LineSeries CategorySeries = new LineSeries(); Binding CategorySeriesIVBinding = new Binding(); Binding CategorySeriesDVBinding = new Binding(); Style CategoryYAxisStyle = new Style(typeof(NumericAxisLabel)); Style CategoryXAxisStyle = new Style(typeof(DateTimeAxisLabel)); Setter Hide = new Setter(VisibilityProperty, Visibility.Collapsed); // Set the axis stule for the series CategoryYAxisStyle.Setters.Add(Hide); CategoryXAxisStyle.Setters.Add(Hide); // Set the path bindings for the X and Y axis data. CategorySeriesIVBinding.Path = new PropertyPath("Date"); CategorySeriesDVBinding.Path = new PropertyPath("Value"); // Find all the expenses for the category if (CategoryName == "Total Expenses") { TempItems = Expenses; } else { TempItems = Expenses.FindAll(a => a.Category == CategoryName); } // Add all the expenses to a list for displaying foreach (Expense i in TempItems) { TempChartData.Add(new DateValueItem { Date = (i.Date + i.Time.TimeOfDay), Value = (int)i.Price, Id = i.Id }); } // Setup the series CategorySeries.Name = CategoryName + "Series"; CategorySeries.Title = CategoryName; CategorySeries.ItemsSource = TempChartData; CategorySeries.IndependentValueBinding = CategorySeriesIVBinding; CategorySeries.DependentValueBinding = CategorySeriesDVBinding; CategorySeries.IsSelectionEnabled = true; CategorySeries.SelectionChanged += DataPointTapped; CategorySeries.IndependentAxis = ((ExpenseChart.Series[0] as LineSeries).IndependentAxis as DateTimeAxis); CategorySeries.DependentRangeAxis = ((ExpenseChart.Series[0] as LineSeries).DependentRangeAxis as LinearAxis); CategorySeries.DataPointStyle = StyleService.LargeDataPoint(StyleService.Colours[ExpenseChart.Series.Count]); // Get the rectangle for the category to colour to match the series colour foreach (StackPanel i in ChartSettings.Items) { if ((i.Children[0] as ToggleSwitch) == (sender as ToggleSwitch)) { (i.Children[1] as Rectangle).Fill = new SolidColorBrush(StyleService.Colours[ExpenseChart.Series.Count]); } } // Add the series to the chart ExpenseChart.Series.Add(CategorySeries); CategorySeries.Refresh(); } // If the switch is turned off, remove the series else { // Find the series for the toggle by category name and remove it foreach (LineSeries i in ExpenseChart.Series) { if ((string)i.Title == CategoryName) { ExpenseChart.Series.Remove(i); break; } } // Find the ractangle for the category and colour it gray foreach (StackPanel i in ChartSettings.Items) { if ((i.Children[0] as ToggleSwitch) == (sender as ToggleSwitch)) { (i.Children[1] as Rectangle).Fill = new SolidColorBrush(Colors.Gray); break; } } // Recolour all the remaining line series to be the colour for they're position in the series list foreach (LineSeries i in ExpenseChart.Series) { i.DataPointStyle = StyleService.LargeDataPoint(StyleService.Colours[ExpenseChart.Series.IndexOf(i)]); foreach (StackPanel j in ChartSettings.Items) { if (ChartSettings.Items.IndexOf(j) > 0) { if (((j.Children[0] as ToggleSwitch).OnContent as string) == (i.Title as string)) { (j.Children[1] as Rectangle).Fill = new SolidColorBrush(StyleService.Colours[ExpenseChart.Series.IndexOf(i)]); } } } } } }
private static void SaveOriginalPropertyValues(object obj, Setter setter) { Type objType = obj.GetType(); // There's no point in saving the property value of an object that is a value type, // because each boxed instance of a value type is unique. if (objType.IsValueType) return; try { // Save off the old property value. The desired type (Setter.ValueInfo.Type) is // allowed to be a derived type of obj's type, so the setter's PropertyName may // not exist on 'obj'. PropertyInfo propertyInfo = objType.GetProperty(setter.PropertyName, PropertyLookupType); if (propertyInfo != null) { var tuple = new Tuple<WeakKey<object>, PropertyInfo>( new WeakKey<object>(obj), propertyInfo); if (!s_originalPropertyValues.ContainsKey(tuple)) { object propertyValue = propertyInfo.GetValue(obj, null); // 'null' is a valid property value in some cases. if (propertyValue != null && typeof(ICloneable).IsAssignableFrom(propertyInfo.PropertyType)) { propertyValue = ((ICloneable)propertyValue).Clone(); } s_originalPropertyValues.Add(tuple, propertyValue); if (setter.ValueInfo != null) { foreach (Setter childSetter in setter.ValueInfo.Setters) SaveOriginalPropertyValues(propertyValue, childSetter); } } } else { Outputs.WriteLine(OutputMessageType.Warning, "The skin " + ActiveSkin.SkinFile + " attempted to set a property on an object of type " + objType + ", but this property, " + setter.PropertyName + ", doesn't exist."); } } catch (Exception) { // we don't want to error out } }
internal Variables(Getter <T> getter, Setter <T> setter, Predicate <string> contains) { this.getter = getter; this.setter = setter; this.contains = contains; }
private void InitializeResources() { // Resource - [buttonStyle] Style var r_0_s_bo = this[typeof(Button)]; Style r_0_s = new Style(typeof(Button), r_0_s_bo as Style); Setter r_0_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255))); r_0_s.Setters.Add(r_0_s_S_0); this.Add("buttonStyle", r_0_s); // Resource - [Image] BitmapImage BitmapImage r_1_bm = new BitmapImage(); r_1_bm.TextureAsset = "Images/MonoGameLogo"; this.Add("Image", r_1_bm); // Resource - [TetrisWindowBackground] SolidColorBrush this.Add("TetrisWindowBackground", new SolidColorBrush(new ColorW(0, 0, 0, 255))); // Resource - [TetrisForeground] SolidColorBrush this.Add("TetrisForeground", new SolidColorBrush(new ColorW(255, 255, 255, 255))); // Resource - [TitleResource] String this.Add("TitleResource", "Basic UI Example"); // Resource - [TetrisBorderStyle] Style Style r_5_s = new Style(typeof(Border)); Setter r_5_s_S_0 = new Setter(Border.SnapsToDevicePixelsProperty, true); r_5_s.Setters.Add(r_5_s_S_0); Setter r_5_s_S_1 = new Setter(Border.BackgroundProperty, new ResourceReferenceExpression("TetrisWindowBackground")); r_5_s.Setters.Add(r_5_s_S_1); Setter r_5_s_S_2 = new Setter(Border.BorderBrushProperty, new ResourceReferenceExpression("TetrisBorderBrush")); r_5_s.Setters.Add(r_5_s_S_2); Setter r_5_s_S_3 = new Setter(Border.BorderThicknessProperty, new Thickness(1F)); r_5_s.Setters.Add(r_5_s_S_3); Setter r_5_s_S_4 = new Setter(Border.OpacityProperty, 0.9F); r_5_s.Setters.Add(r_5_s_S_4); this.Add("TetrisBorderStyle", r_5_s); // Resource - [DataTemplateKey(GameData.TestTreeDataItem)] DataTemplate Func<UIElement, UIElement> r_6_dtFunc = r_6_dtMethod; this.Add(typeof(GameData.TestTreeDataItem), new DataTemplate(typeof(GameData.TestTreeDataItem), r_6_dtFunc)); // Resource - [CustomWindowTemplate] ControlTemplate Func<UIElement, UIElement> r_7_ctFunc = r_7_ctMethod; ControlTemplate r_7_ct = new ControlTemplate(r_7_ctFunc); this.Add("CustomWindowTemplate", r_7_ct); // Resource - [buttonAnimStyle] Style var r_8_s_bo = this[typeof(Button)]; Style r_8_s = new Style(typeof(Button), r_8_s_bo as Style); Setter r_8_s_S_0 = new Setter(Button.WidthProperty, 200F); r_8_s.Setters.Add(r_8_s_S_0); Setter r_8_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F)); r_8_s.Setters.Add(r_8_s_S_1); Setter r_8_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false); r_8_s.Setters.Add(r_8_s_S_2); EventTrigger r_8_s_ET_0 = new EventTrigger(Button.MouseEnterEvent); r_8_s.Triggers.Add(r_8_s_ET_0); BeginStoryboard r_8_s_ET_0_AC_0 = new BeginStoryboard(); r_8_s_ET_0_AC_0.Name = "r_8_s_ET_0_AC_0"; r_8_s_ET_0.AddAction(r_8_s_ET_0_AC_0); Storyboard r_8_s_ET_0_AC_0_SB = new Storyboard(); r_8_s_ET_0_AC_0.Storyboard = r_8_s_ET_0_AC_0_SB; r_8_s_ET_0_AC_0_SB.Name = "r_8_s_ET_0_AC_0_SB"; ThicknessAnimation r_8_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation(); r_8_s_ET_0_AC_0_SB_TL_0.Name = "r_8_s_ET_0_AC_0_SB_TL_0"; r_8_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_8_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F); r_8_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F); SineEase r_8_s_ET_0_AC_0_SB_TL_0_EA = new SineEase(); r_8_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_8_s_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_8_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty); r_8_s_ET_0_AC_0_SB.Children.Add(r_8_s_ET_0_AC_0_SB_TL_0); FloatAnimation r_8_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); r_8_s_ET_0_AC_0_SB_TL_1.Name = "r_8_s_ET_0_AC_0_SB_TL_1"; r_8_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_8_s_ET_0_AC_0_SB_TL_1.To = 220F; SineEase r_8_s_ET_0_AC_0_SB_TL_1_EA = new SineEase(); r_8_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_8_s_ET_0_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_8_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty); r_8_s_ET_0_AC_0_SB.Children.Add(r_8_s_ET_0_AC_0_SB_TL_1); EventTrigger r_8_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent); r_8_s.Triggers.Add(r_8_s_ET_1); BeginStoryboard r_8_s_ET_1_AC_0 = new BeginStoryboard(); r_8_s_ET_1_AC_0.Name = "r_8_s_ET_1_AC_0"; r_8_s_ET_1.AddAction(r_8_s_ET_1_AC_0); Storyboard r_8_s_ET_1_AC_0_SB = new Storyboard(); r_8_s_ET_1_AC_0.Storyboard = r_8_s_ET_1_AC_0_SB; r_8_s_ET_1_AC_0_SB.Name = "r_8_s_ET_1_AC_0_SB"; ThicknessAnimation r_8_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation(); r_8_s_ET_1_AC_0_SB_TL_0.Name = "r_8_s_ET_1_AC_0_SB_TL_0"; r_8_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_8_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F); r_8_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F); SineEase r_8_s_ET_1_AC_0_SB_TL_0_EA = new SineEase(); r_8_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_8_s_ET_1_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_8_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty); r_8_s_ET_1_AC_0_SB.Children.Add(r_8_s_ET_1_AC_0_SB_TL_0); FloatAnimation r_8_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation(); r_8_s_ET_1_AC_0_SB_TL_1.Name = "r_8_s_ET_1_AC_0_SB_TL_1"; r_8_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_8_s_ET_1_AC_0_SB_TL_1.To = 200F; SineEase r_8_s_ET_1_AC_0_SB_TL_1_EA = new SineEase(); r_8_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_8_s_ET_1_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_8_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty); r_8_s_ET_1_AC_0_SB.Children.Add(r_8_s_ET_1_AC_0_SB_TL_1); this.Add("buttonAnimStyle", r_8_s); // Resource - [Sounds] SoundSourceCollection var r_9_sounds = new SoundSourceCollection(); r_9_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" }); SoundManager.Instance.AddSound("Click"); r_9_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" }); SoundManager.Instance.AddSound("KeyPress"); r_9_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" }); SoundManager.Instance.AddSound("Move"); r_9_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" }); SoundManager.Instance.AddSound("Select"); this.Add("Sounds", r_9_sounds); // Resource - [TetrisBorderBrush] SolidColorBrush this.Add("TetrisBorderBrush", new SolidColorBrush(new ColorW(114, 176, 218, 255))); // Resource - [DataTemplateKey(GameData.CustomWindow)] DataTemplate Func<UIElement, UIElement> r_11_dtFunc = r_11_dtMethod; this.Add(typeof(GameData.CustomWindow), new DataTemplate(typeof(GameData.CustomWindow), r_11_dtFunc)); ImageManager.Instance.AddImage("Images/MonoGameLogo"); FontManager.Instance.AddFont("Segoe UI", 12F, FontStyle.Regular, "Segoe_UI_9_Regular"); FontManager.Instance.AddFont("Segoe UI", 20F, FontStyle.Bold, "Segoe_UI_15_Bold"); }
public override string ToString() => "Setter: " + Setter.ToString() + " | Value: " + NewValue.ToString();
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; }
public CustomProperty(Getter getter, Setter setter) { _getter = getter; _setter = setter; }
/// <summary> /// 设置当前属性。 /// </summary> /// <param name="instance">当前对象实例。</param> /// <param name="value">属性值。</param> public void Set(object instance, object value) { Setter.SetClrValue(instance, value); }
/// <summary> /// Initializes a new instance of the <see cref="Adic.Cache.SetterInfo"/> class. /// </summary> /// <param name="type">Setter type.</param> /// <param name="identifier">Resolution identifier.</param> /// <param name="setter">Setter method.</param> public SetterInfo(Type type, object identifier, Setter setter) : base(type, identifier) { this.setter = setter; }
private void InitializeResources() { // Resource - [ErrorTextColor] SolidColorBrush this.Add("ErrorTextColor", new SolidColorBrush(new ColorW(255, 0, 0, 255))); // Resource - [MenuContent] Style Style r_1_s = new Style(typeof(TextBlock)); Setter r_1_s_S_0 = new Setter(TextBlock.ForegroundProperty, new ResourceReferenceExpression("MenuPageContentTextColor")); r_1_s.Setters.Add(r_1_s_S_0); Setter r_1_s_S_1 = new Setter(TextBlock.FontSizeProperty, 16F); r_1_s.Setters.Add(r_1_s_S_1); this.Add("MenuContent", r_1_s); // Resource - [MenuHeader] Style Style r_2_s = new Style(typeof(TextBlock)); Setter r_2_s_S_0 = new Setter(TextBlock.ForegroundProperty, new ResourceReferenceExpression("MenuPageHeaderTextColor")); r_2_s.Setters.Add(r_2_s_S_0); Setter r_2_s_S_1 = new Setter(TextBlock.FontSizeProperty, 48F); r_2_s.Setters.Add(r_2_s_S_1); this.Add("MenuHeader", r_2_s); // Resource - [MenuPageBGBrush] SolidColorBrush this.Add("MenuPageBGBrush", new SolidColorBrush(new ColorW(20, 20, 20, 255))); // Resource - [MenuPageContentTextColor] SolidColorBrush this.Add("MenuPageContentTextColor", new SolidColorBrush(new ColorW(255, 255, 255, 255))); // Resource - [MenuPageHeaderTextColor] SolidColorBrush this.Add("MenuPageHeaderTextColor", new SolidColorBrush(new ColorW(255, 240, 150, 255))); // Resource - [MenuPageSubHeaderTextColor] SolidColorBrush this.Add("MenuPageSubHeaderTextColor", new SolidColorBrush(new ColorW(255, 230, 100, 255))); // Resource - [MenuSubHeader] Style Style r_7_s = new Style(typeof(TextBlock)); Setter r_7_s_S_0 = new Setter(TextBlock.ForegroundProperty, new ResourceReferenceExpression("MenuPageSubHeaderTextColor")); r_7_s.Setters.Add(r_7_s_S_0); Setter r_7_s_S_1 = new Setter(TextBlock.FontSizeProperty, 30F); r_7_s.Setters.Add(r_7_s_S_1); this.Add("MenuSubHeader", r_7_s); // Resource - [PrimaryButton] Style Style r_8_s = new Style(typeof(Button)); Setter r_8_s_S_0 = new Setter(Button.FontSizeProperty, 24F); r_8_s.Setters.Add(r_8_s_S_0); this.Add("PrimaryButton", r_8_s); // Resource - [SecondaryButton] Style Style r_9_s = new Style(typeof(Button)); this.Add("SecondaryButton", r_9_s); // Resource - [SuccessTextColor] SolidColorBrush this.Add("SuccessTextColor", new SolidColorBrush(new ColorW(79, 138, 16, 255))); // Resource - [WarningTextColor] SolidColorBrush this.Add("WarningTextColor", new SolidColorBrush(new ColorW(200, 200, 40, 255))); FontManager.Instance.AddFont("JHUF", 36F, FontStyle.Regular, "JHUF_27_Regular"); FontManager.Instance.AddFont("JHUF", 18F, FontStyle.Regular, "JHUF_13.5_Regular"); FontManager.Instance.AddFont("JHUF", 24F, FontStyle.Regular, "JHUF_18_Regular"); FontManager.Instance.AddFont("JHUF", 72F, FontStyle.Regular, "JHUF_54_Regular"); FontManager.Instance.AddFont("JHUF", 96F, FontStyle.Regular, "JHUF_72_Regular"); FontManager.Instance.AddFont("JHUF", 48F, FontStyle.Regular, "JHUF_36_Regular"); FontManager.Instance.AddFont("JHUF", 20F, FontStyle.Regular, "JHUF_15_Regular"); }
private void MyCanvas_PointerMoved(object sender, PointerRoutedEventArgs e) { if (!previewselected) { if (penselected || triangleselected || rectangleselected || polygonselected || lineselected || imageselected || tablelayoutinserted) { if (e.Pointer.PointerId == _penID) { TranslateTransform posTransform = new TranslateTransform(); posTransform.X = -400; posTransform.Y = -400; MainRadialMenu.RenderTransform = posTransform; PointerPoint pt = e.GetCurrentPoint(MyCanvas); // Render a red line on the canvas as the pointer moves. // Distance() is an application-defined function that tests // whether the pointer has moved far enough to justify // drawing a new line. #region 펜 그리기 if (penselected) { currentContactPt = pt.Position; x1 = _previousContactPt.X; y1 = _previousContactPt.Y; x2 = currentContactPt.X; y2 = currentContactPt.Y; //if (Distance(x1, y1, x2, y2) > 2.0) // We need to developp this method now //{ Line line = new Line() { X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, StrokeThickness = 4.0, Stroke = new SolidColorBrush(pencolor) }; _previousContactPt = currentContactPt; // Draw the line on the canvas by adding the Line object as // a child of the Canvas object. MyCanvas.Children.Add(line); // Pass the pointer information to the InkManager. _inkKhaled.ProcessPointerUpdate(pt); //} } #endregion #region 삼각형 그리기 else if (triangleselected) { if (Distance(x1, y1, x2, y2) > 2.0) // We need to developp this method now { Line line = new Line() { X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, StrokeThickness = 4.0, Stroke = new SolidColorBrush(Colors.Green) }; _previousContactPt = currentContactPt; // Draw the line on the canvas by adding the Line object as // a child of the Canvas object. MyCanvas.Children.Add(line); // Pass the pointer information to the InkManager. _inkKhaled.ProcessPointerUpdate(pt); } } #endregion #region 사각형 그리기 else if (rectangleselected) { int area1 = 0, area2 = 0, area3 = 0, area4 = 0; currentContactPt = pt.Position; x1 = _previousContactPt.X; y1 = _previousContactPt.Y; x2 = currentContactPt.X; y2 = currentContactPt.Y; Rectangle rectangle = new Rectangle(); if (x1 < x2) { rectangle.Width = x2 - x1; area1 = 1; area4 = 1; } else { rectangle.Width = x1 - x2; area2 = 1; area3 = 1; } if (y1 < y2) { rectangle.Height = y2 - y1; area3 = 0; area4 = 0; } else { rectangle.Height = y1 - y2; area1 = 0; area2 = 0; } rectangle.StrokeThickness = 4.0; rectangle.Stroke = new SolidColorBrush(Colors.Green); if (area1 == 1) { Canvas.SetLeft(rectangle, x1); Canvas.SetTop(rectangle, y1); } else if (area2 == 1) { Canvas.SetLeft(rectangle, x2); Canvas.SetTop(rectangle, y1); } else if (area3 == 1) { Canvas.SetLeft(rectangle, x2); Canvas.SetTop(rectangle, y2); } else { Canvas.SetLeft(rectangle, x1); Canvas.SetTop(rectangle, y2); } // Draw the line on the canvas by adding the Line object as // a child of the Canvas object. if (rec_prevcount != -1) MyCanvas.Children.RemoveAt(rec_prevcount); MyCanvas.Children.Add(rectangle); rec_prevcount = MyCanvas.Children.IndexOf(rectangle); // Pass the pointer information to the InkManager. _inkKhaled.ProcessPointerUpdate(pt); } #endregion #region 다각형 그리기 else if (polygonselected && (poly_previtem == 0)) { if ((Distance(pt.Position.X, pt.Position.Y, poly_startPoint.X, poly_startPoint.Y) < 7.0) && (poly_edgecount > 1)) { currentContactPt = poly_startPoint; poly_startget = true; } else { currentContactPt = pt.Position; poly_startget = false; } x1 = _previousContactPt.X; y1 = _previousContactPt.Y; x2 = currentContactPt.X; y2 = currentContactPt.Y; Line line = new Line() { X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, StrokeThickness = 4.0, Stroke = new SolidColorBrush(Colors.Black) }; // Draw the line on the canvas by adding the Line object as // a child of the Canvas object. if (poly_prevcount != -1) MyCanvas.Children.RemoveAt(poly_prevcount); MyCanvas.Children.Add(line); poly_prevcount = MyCanvas.Children.IndexOf(line); // Pass the pointer information to the InkManager. _inkKhaled.ProcessPointerUpdate(pt); } #endregion #region 선 그리기 else if (lineselected) { currentContactPt = pt.Position; x1 = _previousContactPt.X; y1 = _previousContactPt.Y; x2 = currentContactPt.X; y2 = currentContactPt.Y; Line line = new Line() { X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, StrokeThickness = 4.0, Stroke = new SolidColorBrush(Colors.Black) }; // Draw the line on the canvas by adding the Line object as // a child of the Canvas object. if (line_prevcount != -1) MyCanvas.Children.RemoveAt(line_prevcount); MyCanvas.Children.Add(line); line_prevcount = MyCanvas.Children.IndexOf(line); // Pass the pointer information to the InkManager. _inkKhaled.ProcessPointerUpdate(pt); } #endregion #region 이미지 그리기 else if (imageselected) { currentContactPt = pt.Position; Image temp_img = new Image(); temp_img = (Image)MyCanvas.Children.Last(); var location = temp_img.TransformToVisual(Window.Current.Content); Point location_img = location.TransformPoint(new Point(0, 0)); double change_x = currentContactPt.X - _previousContactPt.X; double change_y = currentContactPt.Y - _previousContactPt.Y; temp_img.Stretch = Stretch.Fill; if (img_move) { temp_img.Width = temp_img.ActualWidth; temp_img.Height = temp_img.ActualHeight; Canvas.SetLeft(temp_img, location_img.X + change_x); Canvas.SetTop(temp_img, location_img.Y + change_y); MyCanvas.Children.RemoveAt(MyCanvas.Children.Count - 1); MyCanvas.Children.Add(temp_img); _previousContactPt = currentContactPt; _inkKhaled.ProcessPointerUpdate(pt); } else if (img_left || img_right || img_top || img_bottom) { if (img_left) { if (img_prev_left == 0) img_prev_left = temp_img.ActualWidth + location_img.X; temp_img.Width = img_prev_left - currentContactPt.X; Canvas.SetLeft(temp_img, currentContactPt.X); } else if (img_right) { temp_img.Width = currentContactPt.X - location_img.X; Canvas.SetLeft(temp_img, location_img.X); } else { temp_img.Width = temp_img.ActualWidth; Canvas.SetLeft(temp_img, location_img.X); } if (img_top) { if (img_prev_top == 0) img_prev_top = temp_img.ActualHeight + location_img.Y; temp_img.Height = img_prev_top - currentContactPt.Y; Canvas.SetTop(temp_img, currentContactPt.Y); } else if (img_bottom) { temp_img.Height = currentContactPt.Y - location_img.Y; Canvas.SetTop(temp_img, location_img.Y); } else { temp_img.Height = temp_img.ActualHeight; Canvas.SetTop(temp_img, location_img.Y); } MyCanvas.Children.RemoveAt(MyCanvas.Children.Count - 1); MyCanvas.Children.Add(temp_img); //_previousContactPt = currentContactPt; _inkKhaled.ProcessPointerUpdate(pt); } } #endregion #region 표 그리기 else if (tablelayoutinserted) { int area1 = 0, area2 = 0, area3 = 0, area4 = 0; currentContactPt = pt.Position; x1 = _previousContactPt.X; y1 = _previousContactPt.Y; x2 = currentContactPt.X; y2 = currentContactPt.Y; Grid newGrid = new Grid() { Background = new SolidColorBrush(Colors.Wheat) }; ///////////////////// int row_count = 0, column_count = 0; while (row_count < table_row) { RowDefinition row_new = new RowDefinition(); newGrid.RowDefinitions.Add(row_new); row_count++; } while (column_count < table_column) { ColumnDefinition column_new = new ColumnDefinition(); newGrid.ColumnDefinitions.Add(column_new); column_count++; } Style style_temp1 = new Style(typeof(Border)); Setter BorderBrushProp = new Setter() { Property = BorderBrushProperty, Value = new SolidColorBrush(Colors.Black) }; Setter BorderThicknessProp = new Setter() { Property = BorderThicknessProperty, Value = 2 }; Setter BackgroundProp = new Setter() { Property = BackgroundProperty, Value = new SolidColorBrush(Colors.White) }; Setter PaddingProp = new Setter() { Property = PaddingProperty, Value = 5 }; style_temp1.Setters.Add(BorderBrushProp); style_temp1.Setters.Add(BorderThicknessProp); style_temp1.Setters.Add(BackgroundProp); style_temp1.Setters.Add(PaddingProp); Style style_temp2 = new Style(typeof(TextBlock)); Setter ForegroundProp = new Setter() { Property = ForegroundProperty, Value = new SolidColorBrush(Colors.Black) }; style_temp2.Setters.Add(ForegroundProp); double current_width, current_height; if(currentContactPt.X > _previousContactPt.X) current_width = currentContactPt.X - _previousContactPt.X; else current_width = _previousContactPt.X - currentContactPt.X; if (currentContactPt.Y > _previousContactPt.Y) current_height = currentContactPt.Y - _previousContactPt.Y; else current_height = _previousContactPt.Y - currentContactPt.Y; int table_entry_x = 0, table_entry_y=0; while (table_entry_x*table_entry_y != table_row * table_column) { TextBox textbox_new = new TextBox() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, TextAlignment = TextAlignment.Center, BorderBrush = new SolidColorBrush(Colors.Black), Background = new SolidColorBrush(Colors.LightGray), TextWrapping = TextWrapping.Wrap, FontStyle = Windows.UI.Text.FontStyle.Normal, Width = current_width / table_column, Height = current_height / table_row }; /* double width1_result = textbox_new.Width / 7; if (textbox_new.Height / width1_result < 2.8) textbox_new.FontSize = width1_result * 2.4 / (textbox_new.Height / width1_result); else textbox_new.FontSize = width1_result * 1.2;*/ Grid.SetRow(textbox_new, table_entry_x); Grid.SetColumn(textbox_new, table_entry_y); if (table_entry_y == table_column - 1) { table_entry_y = 0; table_entry_x++; } else table_entry_y++; newGrid.Children.Add(textbox_new); } //////////////// if (x1 < x2) { newGrid.Width = x2 - x1; area1 = 1; area4 = 1; } else { newGrid.Width = x1 - x2; area2 = 1; area3 = 1; } if (y1 < y2) { newGrid.Height = y2 - y1; area3 = 0; area4 = 0; } else { newGrid.Height = y1 - y2; area1 = 0; area2 = 0; } if (area1 == 1) { Canvas.SetLeft(newGrid, x1); Canvas.SetTop(newGrid, y1); } else if (area2 == 1) { Canvas.SetLeft(newGrid, x2); Canvas.SetTop(newGrid, y1); } else if (area3 == 1) { Canvas.SetLeft(newGrid, x2); Canvas.SetTop(newGrid, y2); } else { Canvas.SetLeft(newGrid, x1); Canvas.SetTop(newGrid, y2); } // Draw the line on the canvas by adding the Line object as // a child of the Canvas object. if (table_prevcount != -1) MyCanvas.Children.RemoveAt(table_prevcount); MyCanvas.Children.Add(newGrid); table_prevcount = MyCanvas.Children.IndexOf(newGrid); // Pass the pointer information to the InkManager. _inkKhaled.ProcessPointerUpdate(pt); tableselected = true; } #endregion } if (imageselected) { currentContactPt = e.GetCurrentPoint(MyCanvas).Position; Image temp_img = (Image)MyCanvas.Children.Last(); var location = temp_img.TransformToVisual(Window.Current.Content); Point location_img = location.TransformPoint(new Point(0, 0)); double left = location_img.X, right = location_img.X + temp_img.ActualWidth, top = location_img.Y, bottom = location_img.Y + temp_img.ActualHeight; if (Math.Abs(currentContactPt.X - left) < 3) { if (Math.Abs(currentContactPt.Y - top) < 3) Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNorthwestSoutheast, 1); else if (Math.Abs(currentContactPt.Y - bottom) < 3) Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNortheastSouthwest, 1); else Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeWestEast, 1); } else if (Math.Abs(currentContactPt.X - right) < 3) { if (Math.Abs(currentContactPt.Y - top) < 3) Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNortheastSouthwest, 1); else if (Math.Abs(currentContactPt.Y - bottom) < 3) Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNorthwestSoutheast, 1); else Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeWestEast, 1); } else if ((Math.Abs(currentContactPt.Y - top) < 3) || (Math.Abs(currentContactPt.Y - bottom) < 3)) Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeNorthSouth, 1); else if (((currentContactPt.X - left >= 3) && (right - currentContactPt.X >= 3)) && ((currentContactPt.Y - top >= 3) && (bottom - currentContactPt.Y >= 3))) Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeAll, 1); else Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1); } else Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1); } int i = textbox_list.Count; /*while (i != 0) { if (textbox_list.ElementAt(i - 1).Focus(Windows.UI.Xaml.FocusState.Pointer)) textbox_list.ElementAt(i - 1).Background = new SolidColorBrush(Colors.Green); else textbox_list.ElementAt(i - 1).Background = new SolidColorBrush(Colors.LightGray); i--; }*/ if ((textbox_list.Count != 0) && textboxselected && (textbox_list.Last().Text != null)) textbox_list.Last().Focus(Windows.UI.Xaml.FocusState.Pointer); } }
public StylesExample() { // Create a name scope for the page. NameScope.SetNameScope(this, new NameScope()); this.WindowTitle = "Storyboard in Styles Example"; this.Background = Brushes.White; // // Define a Button style // Style myStyle = new Style(); Setter mySetter = new Setter(); // mySetter.Property = EventTrigger myEventTrigger = new EventTrigger(); myEventTrigger.RoutedEvent = Button.MouseEnterEvent; BeginStoryboard myBeginStoryboard = new BeginStoryboard(); Storyboard myStoryboard = new Storyboard(); myBeginStoryboard.Storyboard = myStoryboard; DoubleAnimation myDoubleAnimation = new DoubleAnimation(); Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Button.OpacityProperty)); myDoubleAnimation.From = 1.0; myDoubleAnimation.To = 0.5; myDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(500)); myDoubleAnimation.AutoReverse = true; myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever; myStoryboard.Children.Add(myDoubleAnimation); myEventTrigger.Actions.Add(myBeginStoryboard); // // Returns the button's opacity to 1 when the mouse leaves. // myEventTrigger = new EventTrigger(); myEventTrigger.RoutedEvent = Button.MouseLeaveEvent; myBeginStoryboard = new BeginStoryboard(); myStoryboard = new Storyboard(); myBeginStoryboard.Storyboard = myStoryboard; myDoubleAnimation = new DoubleAnimation(); Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Button.OpacityProperty)); myDoubleAnimation.From = 1.0; myDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(100)); myStoryboard.Children.Add(myDoubleAnimation); myEventTrigger.Actions.Add(myBeginStoryboard); // // Changes the button's color when clicked. Notice that the animation can't target the SolidColorBrush used // to paint the button's background directly. The brush must be accessed through the button's Background property. // myEventTrigger = new EventTrigger(); myEventTrigger.RoutedEvent = Button.ClickEvent; myBeginStoryboard = new BeginStoryboard(); myStoryboard = new Storyboard(); myBeginStoryboard.Storyboard = myStoryboard; ColorAnimation myColorAnimation = new ColorAnimation(); //Storyboard.SetTargetProperty(myColorAnimation, new PropertyPath("(0).(1)",new DependencyProperty[] { (Button.Background).(SolidColorBrush.Color) })) myColorAnimation.From = Color.FromArgb(255, 255, 165, 0); myColorAnimation.To = Color.FromArgb(255, 255, 255, 255); myColorAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(100)); myColorAnimation.AutoReverse = true; myStoryboard.Children.Add(myColorAnimation); myEventTrigger.Actions.Add(myBeginStoryboard); }
public Updater(Getter getter, Setter setter) { m_Getter = getter; m_Setter = setter; }
/// <summary> /// Creates a new serializable property. /// </summary> /// <param name="type">Type of data the property contains.</param> /// <param name="internalType">Type of data the property contains, as C# type.</param> /// <param name="getter">Method that allows you to retrieve contents of the property.</param> /// <param name="setter">Method that allows you to set contents of the property</param> public SerializableProperty(FieldType type, Type internalType, Getter getter, Setter setter) { this.type = type; this.internalType = internalType; this.getter = getter; this.setter = setter; Internal_CreateInstance(this, internalType); }
private void Table_MessageBox(double X, double Y) { Style style = new Style(typeof(Border)); style.BasedOn = new Style(typeof(Border)); Setter BorderBrushProp = new Setter() { Property = BorderBrushProperty, Value = new SolidColorBrush(Colors.Black) }; Setter BorderThicknessProp = new Setter() { Property = BorderThicknessProperty, Value = 2 }; Setter BackgroundProp = new Setter() { Property = BackgroundProperty, Value = new SolidColorBrush(Colors.White) }; Setter PaddingProp = new Setter() { Property = PaddingProperty, Value = 5 }; style.Setters.Add(BorderBrushProp); style.Setters.Add(BorderThicknessProp); style.Setters.Add(BackgroundProp); style.Setters.Add(PaddingProp); Grid table_input = new Grid() { Width = 150, Height = 140 }; GridLength length_40 = new GridLength(40); GridLength length_10 = new GridLength(10); GridLength length_70 = new GridLength(70); RowDefinition row1 = new RowDefinition(); row1.Height = length_40; RowDefinition row2 = new RowDefinition(); row2.Height = length_10; RowDefinition row3 = new RowDefinition(); row3.Height = length_40; RowDefinition row4 = new RowDefinition(); row4.Height = length_10; RowDefinition row5 = new RowDefinition(); row5.Height = length_40; ColumnDefinition col1 = new ColumnDefinition(); col1.Width = length_70; ColumnDefinition col2 = new ColumnDefinition(); col2.Width = length_10; ColumnDefinition col3 = new ColumnDefinition(); col3.Width = length_70; ColumnDefinition temp1 = new ColumnDefinition(); ColumnDefinition temp2 = new ColumnDefinition(); table_input.RowDefinitions.Add(row1); table_input.RowDefinitions.Add(row2); table_input.RowDefinitions.Add(row3); table_input.RowDefinitions.Add(row4); table_input.RowDefinitions.Add(row5); table_input.ColumnDefinitions.Add(temp1); table_input.ColumnDefinitions.Add(col1); table_input.ColumnDefinitions.Add(col2); table_input.ColumnDefinitions.Add(col3); table_input.ColumnDefinitions.Add(temp2); TextBox row = new TextBox() { VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, Width = 70, Height = 38, Text = "행 : ", FontSize = 20, TextAlignment = TextAlignment.Center }; Grid.SetRow(row, 0); Grid.SetColumn(row, 1); TextBox row_input = new TextBox() { VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, Width = 70, Height = 38, Background = new SolidColorBrush(Colors.LightGray), FontSize = 20, TextAlignment = TextAlignment.Center }; Grid.SetRow(row_input, 0); Grid.SetColumn(row_input, 3); TextBox col = new TextBox() { VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, Width = 70, Height = 38, Text = "열 : ", FontSize = 20, TextAlignment = TextAlignment.Center }; Grid.SetRow(col, 2); Grid.SetColumn(col, 1); TextBox column_input = new TextBox() { VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, Width = 70, Height = 38, Background = new SolidColorBrush(Colors.LightGray), FontSize = 20, TextAlignment = TextAlignment.Center }; Grid.SetRow(column_input, 2); Grid.SetColumn(column_input, 3); Button Ok = new Button() { VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, Width = 70, Height = 38, BorderBrush = new SolidColorBrush(Colors.Black), Background = new SolidColorBrush(Colors.LightGray), Content = "확인", FontSize = 15 }; Grid.SetRow(Ok, 4); Grid.SetColumn(Ok, 1); Button Cancel = new Button() { VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, Width = 70, Height = 38, BorderBrush = new SolidColorBrush(Colors.Black), Background = new SolidColorBrush(Colors.LightGray), Content = "취소", FontSize = 15, }; Grid.SetRow(Cancel, 4); Grid.SetColumn(Cancel, 3); table_input.Children.Add(row); table_input.Children.Add(row_input); table_input.Children.Add(col); table_input.Children.Add(column_input); table_input.Children.Add(Ok); table_input.Children.Add(Cancel); Ok.Click += Ok_Click; Cancel.Click += Cancel_Click; Canvas.SetLeft(table_input, X - 100); Canvas.SetTop(table_input, Y - 50); MyCanvas.Children.Add(table_input); //table_input.Style = style; havetobeclosed = true; }
/// <summary> /// Initializes the datagrid columns and sets the ItemsSource to the default collection. /// </summary> private void InitializeDataGrid() { List <string> cultures = DataModel.CultureNames; /// Create some setters and triggers for the /// styles of the read-only columns. /// Trigger iIsSelectedTrigger = new Trigger() { Property = DataGridTextColumn.IsReadOnlyProperty, Value = true }; var foregroundSetter = new Setter(DataGridCell.ForegroundProperty, new SolidColorBrush(Colors.Black)); iIsSelectedTrigger.Setters.Add(foregroundSetter); var backgroundSetter = new Setter(DataGridCell.BackgroundProperty, new SolidColorBrush(Colors.LightGray)); /// The first column is for the metadata container object. /// var objectColumnStyle = new Style(typeof(DataGridCell)); objectColumnStyle.Setters.Add(backgroundSetter); objectColumnStyle.Setters.Add(foregroundSetter); objectColumnStyle.Triggers.Add(iIsSelectedTrigger); dataGrid.Columns.Add(new DataGridTextColumn { Header = FindResource("TabularObjectColumnHeader").ToString(), Binding = new Binding(DataModel.ContainerColumnHeader), IsReadOnly = true, CellStyle = objectColumnStyle }); /// The second column is for the default culture of the data model, /// which is always the first language in the list of data model cultures. /// var defaultLangColumnStyle = new Style(typeof(DataGridCell)); defaultLangColumnStyle.Setters.Add(foregroundSetter); defaultLangColumnStyle.Triggers.Add(iIsSelectedTrigger); /// Add a tooltip to flag that the default culture is readonly. /// var objectHeaderStyle = new Style(typeof(DataGridColumnHeader)); objectHeaderStyle.Setters.Add(new Setter(ToolTipService.ToolTipProperty, FindResource("DefaultCultureColumnHeaderToolTip").ToString())); Language defaultLang = DataModel.GetLanguageByLcid(cultures[0]); dataGrid.Columns.Add(new DataGridTextColumn { Header = $"{defaultLang.DisplayName}*", HeaderStyle = objectHeaderStyle, Binding = new Binding(cultures[0]), IsReadOnly = true, CellStyle = defaultLangColumnStyle }); DataModel.SetLanguageFlags(cultures[0], true, true); /// Add the remaining languages that already exist in the data model /// and mark them as selected in the list of supported languages. /// for (int i = 1; i < cultures.Count; i++) { AddColumn(cultures[i]); } /// And set Captions as the default content of the datagrid. dataGrid.ItemsSource = DataModel.Captions; }
public virtual void Generate(GenerationInfo gen_info, string indent) { if (Ignored || Hidden) { return; } CheckGlue(); if ((getterName != null || setterName != null || getOffsetName != null) && gen_info.GlueWriter == null) { LogWriter log = new LogWriter(container_type.QualifiedName); log.Member = Name; log.Warn("needs glue for field access. Specify --glue-filename"); return; } GenerateImports(gen_info, indent); SymbolTable table = SymbolTable.Table; StreamWriter sw = gen_info.Writer; string modifiers = elem.HasAttribute("new_flag") ? "new " : ""; bool is_struct = table.IsStruct(CType) || table.IsBoxed(CType); sw.WriteLine(indent + "public " + modifiers + CSType + " " + Name + " {"); if (Getter != null) { sw.Write(indent + "\tget "); Getter.GenerateBody(gen_info, container_type, "\t"); sw.WriteLine(""); } else if (getterName != null) { sw.WriteLine(indent + "\tget {"); container_type.Prepare(sw, indent + "\t\t"); sw.WriteLine(indent + "\t\t" + CSType + " result = " + table.FromNative(ctype, getterName + " (" + container_type.CallByName() + ")") + ";"); container_type.Finish(sw, indent + "\t\t"); sw.WriteLine(indent + "\t\treturn result;"); sw.WriteLine(indent + "\t}"); } else if (Readable && offsetName != null) { sw.WriteLine(indent + "\tget {"); sw.WriteLine(indent + "\t\tunsafe {"); if (is_struct) { sw.WriteLine(indent + "\t\t\t" + CSType + "* raw_ptr = (" + CSType + "*)(((byte*)" + container_type.CallByName() + ") + " + offsetName + ");"); sw.WriteLine(indent + "\t\t\treturn *raw_ptr;"); } else { sw.WriteLine(indent + "\t\t\t" + table.GetMarshalType(CType) + "* raw_ptr = (" + table.GetMarshalType(CType) + "*)(((byte*)" + container_type.CallByName() + ") + " + offsetName + ");"); sw.WriteLine(indent + "\t\t\treturn " + table.FromNative(ctype, "(*raw_ptr)") + ";"); } sw.WriteLine(indent + "\t\t}"); sw.WriteLine(indent + "\t}"); } IGeneratable gen = table [CType]; string to_native = (gen is IManualMarshaler) ? (gen as IManualMarshaler).AllocNative("value") : gen.CallByName("value"); if (Setter != null) { sw.Write(indent + "\tset "); Setter.GenerateBody(gen_info, container_type, "\t"); sw.WriteLine(""); } else if (setterName != null) { sw.WriteLine(indent + "\tset {"); container_type.Prepare(sw, indent + "\t\t"); sw.WriteLine(indent + "\t\t" + setterName + " (" + container_type.CallByName() + ", " + to_native + ");"); container_type.Finish(sw, indent + "\t\t"); sw.WriteLine(indent + "\t}"); } else if (Writable && offsetName != null) { sw.WriteLine(indent + "\tset {"); sw.WriteLine(indent + "\t\tunsafe {"); if (is_struct) { sw.WriteLine(indent + "\t\t\t" + CSType + "* raw_ptr = (" + CSType + "*)(((byte*)" + container_type.CallByName() + ") + " + offsetName + ");"); sw.WriteLine(indent + "\t\t\t*raw_ptr = value;"); } else { sw.WriteLine(indent + "\t\t\t" + table.GetMarshalType(CType) + "* raw_ptr = (" + table.GetMarshalType(CType) + "*)(((byte*)" + container_type.CallByName() + ") + " + offsetName + ");"); sw.WriteLine(indent + "\t\t\t*raw_ptr = " + to_native + ";"); } sw.WriteLine(indent + "\t\t}"); sw.WriteLine(indent + "\t}"); } sw.WriteLine(indent + "}"); sw.WriteLine(""); if (getterName != null || setterName != null || getOffsetName != null) { GenerateGlue(gen_info); } }
public ResourceDictionary GetResourceDictionary() { var uri = GetThemePath(Settings.Theme); var dict = new ResourceDictionary { Source = new Uri(uri, UriKind.Absolute) }; Style queryBoxStyle = dict["QueryBoxStyle"] as Style; if (queryBoxStyle != null) { queryBoxStyle.Setters.Add(new Setter(TextBox.FontFamilyProperty, new FontFamily(Settings.QueryBoxFont))); queryBoxStyle.Setters.Add(new Setter(TextBox.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.QueryBoxFontStyle))); queryBoxStyle.Setters.Add(new Setter(TextBox.FontWeightProperty, FontHelper.GetFontWeightFromInvariantStringOrNormal(Settings.QueryBoxFontWeight))); queryBoxStyle.Setters.Add(new Setter(TextBox.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.QueryBoxFontStretch))); var caretBrushPropertyValue = queryBoxStyle.Setters.OfType <Setter>().Any(x => x.Property == TextBox.CaretBrushProperty); var foregroundPropertyValue = queryBoxStyle.Setters.OfType <Setter>().FirstOrDefault(x => x.Property == TextBox.ForegroundProperty)?.Value; if (!caretBrushPropertyValue && foregroundPropertyValue != null) { queryBoxStyle.Setters.Add(new Setter(TextBox.CaretBrushProperty, foregroundPropertyValue)); } } var queryTextSuggestionBoxStyle = new Style(typeof(TextBox), queryBoxStyle); bool hasSuggestion = false; if (dict.Contains("QueryTextSuggestionBoxStyle")) { queryTextSuggestionBoxStyle = dict["QueryTextSuggestionBoxStyle"] as Style; hasSuggestion = true; } dict["QueryTextSuggestionBoxStyle"] = queryTextSuggestionBoxStyle; if (queryTextSuggestionBoxStyle != null) { queryTextSuggestionBoxStyle.Setters.Add(new Setter(TextBox.FontFamilyProperty, new FontFamily(Settings.QueryBoxFont))); queryTextSuggestionBoxStyle.Setters.Add(new Setter(TextBox.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.QueryBoxFontStyle))); queryTextSuggestionBoxStyle.Setters.Add(new Setter(TextBox.FontWeightProperty, FontHelper.GetFontWeightFromInvariantStringOrNormal(Settings.QueryBoxFontWeight))); queryTextSuggestionBoxStyle.Setters.Add(new Setter(TextBox.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.QueryBoxFontStretch))); } var queryBoxStyleSetters = queryBoxStyle.Setters.OfType <Setter>().ToList(); var queryTextSuggestionBoxStyleSetters = queryTextSuggestionBoxStyle.Setters.OfType <Setter>().ToList(); foreach (Setter setter in queryBoxStyleSetters) { if (setter.Property == TextBox.BackgroundProperty) { continue; } if (setter.Property == TextBox.ForegroundProperty) { continue; } if (queryTextSuggestionBoxStyleSetters.All(x => x.Property != setter.Property)) { queryTextSuggestionBoxStyle.Setters.Add(setter); } } if (!hasSuggestion) { var backgroundBrush = queryBoxStyle.Setters.OfType <Setter>().FirstOrDefault(x => x.Property == TextBox.BackgroundProperty)?.Value ?? (dict["BaseQuerySuggestionBoxStyle"] as Style).Setters.OfType <Setter>().FirstOrDefault(x => x.Property == TextBox.BackgroundProperty).Value; queryBoxStyle.Setters.OfType <Setter>().FirstOrDefault(x => x.Property == TextBox.BackgroundProperty).Value = Brushes.Transparent; if (queryTextSuggestionBoxStyle.Setters.OfType <Setter>().Any(x => x.Property == TextBox.BackgroundProperty)) { queryTextSuggestionBoxStyle.Setters.OfType <Setter>().First(x => x.Property == TextBox.BackgroundProperty).Value = backgroundBrush; } else { queryTextSuggestionBoxStyle.Setters.Add(new Setter(TextBox.BackgroundProperty, backgroundBrush)); } } Style resultItemStyle = dict["ItemTitleStyle"] as Style; Style resultSubItemStyle = dict["ItemSubTitleStyle"] as Style; Style resultItemSelectedStyle = dict["ItemTitleSelectedStyle"] as Style; Style resultSubItemSelectedStyle = dict["ItemSubTitleSelectedStyle"] as Style; if (resultItemStyle != null && resultSubItemStyle != null && resultSubItemSelectedStyle != null && resultItemSelectedStyle != null) { Setter fontFamily = new Setter(TextBlock.FontFamilyProperty, new FontFamily(Settings.ResultFont)); Setter fontStyle = new Setter(TextBlock.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.ResultFontStyle)); Setter fontWeight = new Setter(TextBlock.FontWeightProperty, FontHelper.GetFontWeightFromInvariantStringOrNormal(Settings.ResultFontWeight)); Setter fontStretch = new Setter(TextBlock.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.ResultFontStretch)); Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch }; Array.ForEach(new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); } return(dict); }
public sealed override MethodInfo GetSetMethod(bool nonPublic) => Setter?.FilterAccessor(nonPublic);
public abstract void Draw(Rect rect, GUIContent label, object value, Type valueType, FieldInfo fieldInfo, Setter setter);
public static void ApplyStyle( IPlotGroupStyleCollection externalGroups, IPlotGroupStyleCollection localGroups, Setter setter) { ColorGroupStyle grpStyle = null; IPlotGroupStyleCollection grpColl = null; if (externalGroups.ContainsType(typeof(ColorGroupStyle))) grpColl = externalGroups; else if (localGroups != null && localGroups.ContainsType(typeof(ColorGroupStyle))) grpColl = localGroups; if (null != grpColl) { grpStyle = (ColorGroupStyle)grpColl.GetPlotGroupStyle(typeof(ColorGroupStyle)); grpColl.OnBeforeApplication(typeof(ColorGroupStyle)); setter(grpStyle.Color); } }
public static Coroutine To(Color from, Color to, float duration, EaseType ease, Setter <Color> setter) { return(CreateInterpolater(duration, ease, t => setter(Color.LerpUnclamped(from, to, t)))); }