Currently, Ckrule's IDE and business management system are developed by WinForm, and the Rules editor only provides WinForm versions, so many friends have commented on the WPF version. WPF's interface is more convenient to set up and manage.
In fact, you can use the Ckrule rule Editor in WPF, using the following methods:
1, introduce the WindowsForm integrated related DLLs in the WPF project. Contains 2 DLLs, System.Windows.Forms.dll and WindowsFormsIntegration.dll, respectively
2, introducing the WindowsFormsHost controlTo make it easier to control the deployment of the interface, you can add WindowsForm panel to the control. <window x:class= "Ruleeditorwpfapplication1.mainwindow"
Xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"
XMLNS:WFI = "Clr-namespace:system.windows.forms.integration;assembly=windowsformsintegration"
XMLNS:WF = "Clr-namespace:system.windows.forms;assembly=system.windows.forms"
Title= "MainWindow" height= "width=" 525 "loaded=" window_loaded ">
<Grid>
<windowsformshost height= "horizontalalignment=" "left" margin= "5,5,0,0" name= "WindowsFormsHost1" Verticalalignment= "Top" width= "486" >
<wf:panel x:name= "Pnlmain" dock= "Fill" width= "486" height= "a"/>
</WindowsFormsHost>
</Grid>
</Window>
3, loading the Ckrule Rule Editor Control Place the rule file in the Ckruleadmin directory and call it explicitly in the program. Public partial class mainwindow:window { Public const string Rulei Nstname = "Human-wage calculation-colloquial formula"; Ruleeditorfacade _editorfacade = new Ruleeditorfacade (); public MainWindow () { Init Ializecomponent (); } private void window_loaded (object sender , RoutedEventArgs e) { var _curpackage = new Rulefacad E (). Getpkginst (ruleinstname); if (_curpackage = = null) &NB Sp { MessageBox.Show ("Load Rule package failed"); &NB Sp return; } &NBSP var _ctrl = _editorfacade.geteditor (_curpackage); _ctrl. Dock = system.windows.forms.dockstyle.fill; PNLMAIN.CONTROLS.ADD (_ctrl); var _propset = new Custunstructpropdef (); &NBS P _propset. Codestyle = codestyledef.ifelsestyle; _editorfacade.loaddata (_propset); } }
4, Interface demoYou can see that the WPF interface displays the rule editor.
OverviewCkrule are written using WinForm technology, many friends of the interface system has put forward valuable advice, Ckrule technical team also know the importance of interface optimization, but now more focus on internal logic processing and upgrading, We have always believed that the internal logic of the processing of the rule engine is the most serious, but also deeply accept the user's pointing criticism. Currently, we recommend that the technical Administrator or implementation personnel maintain the rules, and really want to provide directly to the customer when using, on the purchase of Business Management System (BRMS) system, on some systems to optimize and adjust the interface, after all, ckrule in the focus on rule processing, and customization of the various customer interface, not our work focus.
Source code DownloadHttp://pan.baidu.com/s/1qWofwYS Ckrule Example of the rule editor using the example. zip
The use of the Ckrule rule Editor in WPF