コード例 #1
0
        public void Test1()
        {
            var rule = new ConditionRule
            {
                Condition = new AllMatch
                {
                    Conditions =
                    {
                        new CustomerAge     {
                            From = 10
                        },
                        new False(),
                        new ProductQuantity {
                            To = 50
                        },
                        new OrderDate       {
                            From = DateTime.Today
                        }
                    }
                }
            };

            var xaml = SimpleXamlSerializer.ToXaml(rule);

            Debug.Print(XElement.Parse(xaml).ToString());
        }
コード例 #2
0
        public SampleRuleViewModel()
        {
            m_data = SimpleXamlSerializer.ToXaml(SampleRules.GetOrCreateSampleRule());

            CopyCommand           = new RelayCommand(() => Clipboard.SetText(Data), () => !string.IsNullOrEmpty(Data));
            PasteCommand          = new RelayCommand(() => Data = Clipboard.GetText(), Clipboard.ContainsText);
            LoadDefaultCommand    = new RelayCommand(() => LoadDefault());
            ToggleEditModeCommand = new RelayCommand(() => IsInEditMode = !IsInEditMode);
            SetEditModeCommand    = new RelayCommand <bool>(x => IsInEditMode = x);
            ApplyEditTextCommand  = new RelayCommand(() => ApplyEditText());
            ApplyGraphCommand     = new RelayCommand(() => ApplyGraph(), () => IsGraphChanged);
            RevertGraphCommand    = new RelayCommand(() => Designer = null, () => IsGraphChanged);
            SaveCommand           = new RelayCommand(() => Save(), () => IsModified);
        }
コード例 #3
0
        public void ApplyGraph(bool isAutoApply = false)
        {
            if (m_designer == null || !IsGraphChanged)
            {
                return;
            }

            m_isAutoApplyMode = isAutoApply;
            try
            {
                AsText = SimpleXamlSerializer.ToXaml(Designer.Model.Value);
            }
            finally
            {
                m_isAutoApplyMode = false;
            }

            IsInEditMode   = false;
            IsGraphChanged = false;
            Changed();
        }
コード例 #4
0
ファイル: RuleDesigner.cs プロジェクト: yuramag/DslOverXaml
        public RuleDesigner(string xaml)
        {
            var rule = string.IsNullOrEmpty(xaml) ? null : SimpleXamlSerializer.FromXaml <Rule>(xaml);

            m_model = RuleModelFactory.CreateModel(rule, m => Changed());
        }
コード例 #5
0
 private void LoadDefault()
 {
     Data = SimpleXamlSerializer.ToXaml(SampleRules.CreateSampleRule());
     LogInfo("Loaded default sample data.");
 }
コード例 #6
0
 public static Rule CreateRule(string xaml)
 {
     return(SimpleXamlSerializer.FromXaml <Rule>(xaml));
 }