Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public override FrameworkElement GenerateUiElement(string Key, ArmA_UI_Editor.UI.Snaps.EditingSnap window, PTypeDataTag tag)
        {
            var cb = new ComboBox();

            cb.Tag = tag;
            cb.Items.Add("false");
            cb.Items.Add("true");
            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);
            }
            cb.SetBinding(ComboBox.SelectedIndexProperty, binding);
            cb.SourceUpdated += Cb_SourceUpdated;
            cb.ToolTip        = App.Current.Resources["STR_CODE_Property_Boolean"] as String;
            return(cb);
        }
 public void LoadSnap()
 {
     (ArmA_UI_Editor.UI.MainWindow.TryGet()).Docker.OnSnapFocusChange += Docker_OnSnapFocusChange;
     var EditingSnaps = ArmA_UI_Editor.UI.MainWindow.TryGet().Docker.FindSnaps<EditingSnap>(true);
     if (EditingSnaps.Count > 0)
     {
         this.CurrentEditingSnap = EditingSnaps[0];
     }
 }
Пример #5
0
        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);
        }
Пример #6
0
 private void CurrentWindow_OnSelectedFocusChanged(object sender, EditingSnap.OnSelectedFocusChangedEventArgs e)
 {
     if(e.Tags.Length != 1)
     {
         this.PropertyStack.Children.Clear();
     }
     else
     {
         LoadProperties(e.Tags[0].file.Properties, e.Tags[0].Key);
     }
 }
Пример #7
0
 private void Docker_OnSnapFocusChange(object sender, SnapDocker.OnSnapFocusChangeEventArgs e)
 {
     if (e.SnapWindowNew != null && e.SnapWindowNew.Window is EditingSnap)
     {
         if (CurrentEditingSnap != null)
             CurrentEditingSnap.OnSelectedFocusChanged -= CurrentEditingSnap_OnSelectedFocusChanged;
         CurrentEditingSnap = e.SnapWindowNew.Window as EditingSnap;
         CurrentEditingSnap.OnSelectedFocusChanged += CurrentEditingSnap_OnSelectedFocusChanged;
     }
     else if (e.SnapWindowLast != null && e.SnapWindowLast.Window is EditingSnap)
     {
         if (CurrentEditingSnap != null)
             CurrentEditingSnap.OnSelectedFocusChanged -= CurrentEditingSnap_OnSelectedFocusChanged;
         CurrentEditingSnap = null;
     }
 }
Пример #8
0
 private void CurrentEditingSnap_OnSelectedFocusChanged(object sender, EditingSnap.OnSelectedFocusChangedEventArgs e)
 {
     if (e.Tags.Length != 1)
     {
         this.EventStackPanel.Children.Clear();
     }
     else
     {
         LoadEvents(e.Tags[0].file, e.Tags[0].Key);
     }
 }
 public DialogPropertiesSnap()
 {
     InitializeComponent();
     _CurrentEditingSnap = null;
 }
 private void Docker_OnSnapFocusChange(object sender, SnapDocker.OnSnapFocusChangeEventArgs e)
 {
     if(e.SnapWindowNew == null)
     {
         if(e.SnapWindowLast != null && e.SnapWindowLast.Window == this.CurrentEditingSnap)
         {
             this.CurrentEditingSnap = null;
         }
     }
     else if(e.SnapWindowNew.Window is EditingSnap)
     {
         this.CurrentEditingSnap = e.SnapWindowNew.Window as EditingSnap;
     }
 }
Пример #11
0
 public abstract FrameworkElement GenerateUiElement(string Key, ArmA_UI_Editor.UI.Snaps.EditingSnap window, PTypeDataTag tag);
Пример #12
0
 public UiConverter(EditingSnap creator, string key)
     : base(key)
 {
     this.EditingSnapWeak = new WeakReference<EditingSnap>(creator);
 }
Пример #13
0
 private void UnSubscribeEditingSnap(EditingSnap snap)
 {
     if (lbContent.Tag == null)
         return;
     TAG_lbContent tag = (TAG_lbContent)lbContent.Tag;
     if (snap != tag.EditingSnap)
         return;
     tag.EditingSnap.OnUiElementsChanged -= EditingSnap_OnUiElementsChanged;
     lbContent.ItemsSource = null;
     lbContent.Tag = null;
 }
Пример #14
0
 private void SubscribeEditingSnap(EditingSnap snap)
 {
     if (lbContent.Tag != null)
     {
         UnSubscribeEditingSnap(((TAG_lbContent)lbContent.Tag).EditingSnap);
     }
     var list = snap.GetUiElements();
     snap.OnUiElementsChanged += EditingSnap_OnUiElementsChanged;
     lbContent.Tag = new TAG_lbContent { EditingSnap = snap, Tuple = list };
     lbContent.ItemsSource = list;
 }