public Universal_ConditionEditor(Condition condition = null, bool viewLocalization = false)
        {
            InitializeComponent();
            double scale = AppConfig.Instance.scale;

            viewLocalizationField = viewLocalization;
            ClearParameters();
            Height          *= scale;
            Width           *= scale;
            baseHeight       = Height;
            heightDelta     *= scale;
            gridScale.ScaleX = scale;
            gridScale.ScaleY = scale;
            bool _chosen = false;
            int  _index  = 0;

            foreach (Type t in Condition.GetTypes())
            {
                ComboBoxItem cbi = new ComboBoxItem
                {
                    Content = LocalizationManager.Current.Condition[$"Type{Condition.GetLocalizationKey(t.Name)}"],
                    Tag     = t
                };
                typeBox.Items.Add(cbi);
                if (!_chosen && condition != null && condition.GetType() == t)
                {
                    typeBox.SelectedIndex = _index;
                    _chosen = true;
                    //var fieldControls = Util.FindVisualChildren<FrameworkElement>(variablesGrid).
                    //    Where(d => d.Tag != null && d.Tag.ToString().StartsWith("variable::"));
                    //foreach (var fControl in fieldControls)
                    //{
                    //    SetValueToControl(fControl, condition.GetType().GetField(fControl.Tag.ToString().Substring(10)).GetValue(condition));
                    //}
                }
                _index++;
            }
            if (condition != null)
            {
                variablesGrid.DataContext = condition;
            }

            saveButton.IsEnabled = condition != null;
        }
        public Universal_ConditionEditor(Condition condition = null)
        {
            InitializeComponent();
            double scale = AppConfig.Instance.scale;

            ClearParameters();
            Height          *= scale;
            Width           *= scale;
            baseHeight       = Height;
            heightDelta     *= scale;
            gridScale.ScaleX = scale;
            gridScale.ScaleY = scale;
            bool _chosen = false;
            int  _index  = 0;

            foreach (Type t in Condition.GetTypes())
            {
                ComboBoxItem cbi = new ComboBoxItem
                {
                    Content = LocalizationManager.Current.Condition[$"Type{Condition.GetLocalizationKey(t.Name)}"],
                    Tag     = t
                };
                typeBox.Items.Add(cbi);
                if (!_chosen && condition != null && condition.GetType() == t)
                {
                    typeBox.SelectedIndex = _index;
                    _chosen = true;
                }
                _index++;
            }
            if (condition != null)
            {
                variablesGrid.DataContext = condition;
            }

            saveButton.IsEnabled = condition != null;
        }