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()); }
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); }
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(); }
public RuleDesigner(string xaml) { var rule = string.IsNullOrEmpty(xaml) ? null : SimpleXamlSerializer.FromXaml <Rule>(xaml); m_model = RuleModelFactory.CreateModel(rule, m => Changed()); }
private void LoadDefault() { Data = SimpleXamlSerializer.ToXaml(SampleRules.CreateSampleRule()); LogInfo("Loaded default sample data."); }
public static Rule CreateRule(string xaml) { return(SimpleXamlSerializer.FromXaml <Rule>(xaml)); }