public void LoadEvents(ArmA_UI_Editor.Code.AddInUtil.UIElement element, string key) { this.EventStackPanel.Children.Clear(); this.CurrentKey = key; foreach (var e in element.Events) { var el = new Property(); this.EventStackPanel.Children.Add(el); el.Header = e.Name; var tb = new TextBox(); el.Children.Add(tb); var field = AddInManager.Instance.MainFile.GetKey(string.Join("/", this.CurrentKey, e.Field), ConfigField.KeyMode.NullOnNotFound); if (field != null && field.IsString) { if(string.IsNullOrWhiteSpace(e.StartingAt)) { tb.Text = field.String; } else { var index = field.String.IndexOf(e.StartingAt); if (index >= 0) tb.Text = field.String.Substring(index + e.StartingAt.Length); else tb.Text = ""; } } tb.PreviewTextInput += Tb_PreviewTextInput; tb.Tag = e; } }
public override FrameworkElement GenerateUiElement(string Key, ArmA_UI_Editor.UI.Snaps.EditingSnap window, PTypeDataTag tag) { var cb = new ComboBox(); cb.Tag = tag; cb.DisplayMemberPath = "Name"; cb.SelectedValuePath = "Value"; cb.ItemsSource = this.Items; var binding = new Binding("Value"); binding.Source = AddInManager.Instance.MainFile; binding.NotifyOnSourceUpdated = true; if (tag.PropertyObject is SqfProperty) { binding.Converter = new SqfPropertyConverter(Key, tag, this.Items); binding.ConverterParameter = tag; } else { binding.Converter = new NormalPropertyConverter(Key, this.Items); } cb.SetBinding(ComboBox.SelectedIndexProperty, binding); cb.SourceUpdated += Cb_SourceUpdated; cb.ToolTip = App.Current.Resources["STR_CODE_Property_ValueList"] as String; return cb; }
public override FrameworkElement GenerateUiElement(string Key, ArmA_UI_Editor.UI.Snaps.EditingSnap window, PTypeDataTag tag) { var tb = new TextBox(); tb.Tag = tag; var binding = new Binding("Value"); binding.Source = AddInManager.Instance.MainFile; binding.NotifyOnSourceUpdated = true; if (tag.PropertyObject is SqfProperty) { binding.Converter = new SqfPropertyConverter(Key, tag); } else { binding.Converter = new NormalPropertyConverter(Key); } binding.ConverterParameter = new ConverterPropertyData { Conversion = this.Conversion.ToUpper(), Window = window }; tb.SetBinding(TextBox.TextProperty, binding); tb.SourceUpdated += Tb_SourceUpdated; tb.PreviewTextInput += Tb_PreviewTextInput; tb.ToolTip = App.Current.Resources["STR_CODE_Property_Number"] as String; return tb; }
public override FrameworkElement GenerateUiElement(string Key, ArmA_UI_Editor.UI.Snaps.EditingSnap window, PTypeDataTag tag) { var tb = new TextBox(); tb.Tag = tag; StringBuilder builder = new StringBuilder(); var binding = new Binding("Value"); binding.Source = AddInManager.Instance.MainFile; binding.NotifyOnSourceUpdated = true; if (tag.PropertyObject is SqfProperty) { throw new NotImplementedException(); } else { binding.Converter = new NormalPropertyConverter(Key); } binding.ConverterParameter = this.Count; tb.SetBinding(TextBox.TextProperty, binding); tb.PreviewKeyDown += Tb_PreviewKeyDown; tb.SourceUpdated += Tb_SourceUpdated; switch (Type.ToUpper()) { case "NUMBER": tb.ToolTip = string.Format(System.Globalization.CultureInfo.InvariantCulture, App.Current.Resources["STR_CODE_Property_Array"] as String, App.Current.Resources["STR_CODE_Property_Number"] as String, this.Count); break; case "STRING": tb.ToolTip = string.Format(System.Globalization.CultureInfo.InvariantCulture, App.Current.Resources["STR_CODE_Property_Array"] as String, App.Current.Resources["STR_CODE_Property_String"] as String, this.Count); break; case "BOOLEAN": tb.ToolTip = string.Format(System.Globalization.CultureInfo.InvariantCulture, App.Current.Resources["STR_CODE_Property_Array"] as String, App.Current.Resources["STR_CODE_Property_Boolean"] as String, this.Count); break; default: throw new Exception(); } return tb; }
public override FrameworkElement GenerateUiElement(string Key, ArmA_UI_Editor.UI.Snaps.EditingSnap window, PTypeDataTag tag) { var tb = new TextBox(); tb.Tag = tag; var curVal = AddInManager.Instance.MainFile.GetKey(Key, SQF.ClassParser.ConfigField.KeyMode.EmptyReferenceOnNotFound); var binding = new Binding("Value"); binding.Source = AddInManager.Instance.MainFile; binding.NotifyOnSourceUpdated = true; if (tag.PropertyObject is SqfProperty) { binding.Converter = new SqfPropertyConverter(Key, tag); } else { binding.Converter = new NormalPropertyConverter(Key); } tb.SetBinding(TextBox.TextProperty, binding); tb.SourceUpdated += Tb_SourceUpdated; tb.PreviewKeyDown += Tb_PreviewKeyDown; tb.ToolTip = App.Current.Resources["STR_CODE_Property_String"] as String; return tb; }
public abstract FrameworkElement GenerateUiElement(string Key, ArmA_UI_Editor.UI.Snaps.EditingSnap window, PTypeDataTag tag);