Skip to content

Commit 1997eab

Browse files
author
Dmitry Korovin (DevExpress)
committed
add example content
1 parent 4918d70 commit 1997eab

37 files changed

+2844
-0
lines changed

CS/DXApplication5.sln

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DXApplication", "DXApplication5\DXApplication.csproj", "{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Debug|x86 = Debug|x86
10+
Release|Any CPU = Release|Any CPU
11+
Release|x86 = Release|x86
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}.Debug|x86.ActiveCfg = Debug|x86
17+
{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}.Debug|x86.Build.0 = Debug|x86
18+
{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}.Release|x86.ActiveCfg = Release|x86
21+
{B97B353C-E78A-414F-BBA9-1C9D0DB90D59}.Release|x86.Build.0 = Release|x86
22+
EndGlobalSection
23+
GlobalSection(SolutionProperties) = preSolution
24+
HideSolutionNode = FALSE
25+
EndGlobalSection
26+
EndGlobal

CS/DXApplication5/App.config

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
5+
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection" requirePermission="false" />
6+
</sectionGroup>
7+
</configSections>
8+
<connectionStrings>
9+
<add name="northwindConnectionString" connectionString="XpoProvider=MSSqlServer;data source=.\SQLEXPRESS;integrated security=SSPI;initial catalog=northwind" />
10+
</connectionStrings>
11+
<applicationSettings>
12+
<DevExpress.LookAndFeel.Design.AppSettings>
13+
<setting name="DefaultAppSkin" serializeAs="String">
14+
<value></value>
15+
</setting>
16+
<setting name="DefaultPalette" serializeAs="String">
17+
<value></value>
18+
</setting>
19+
<setting name="TouchUI" serializeAs="String">
20+
<value></value>
21+
</setting>
22+
<setting name="TouchScaleFactor" serializeAs="String">
23+
<value></value>
24+
</setting>
25+
<setting name="DirectX" serializeAs="String">
26+
<value></value>
27+
</setting>
28+
<setting name="RegisterUserSkins" serializeAs="String">
29+
<value>True</value>
30+
</setting>
31+
<setting name="FontBehavior" serializeAs="String">
32+
<value></value>
33+
</setting>
34+
<setting name="DefaultAppFont" serializeAs="String">
35+
<value></value>
36+
</setting>
37+
<setting name="DPIAwarenessMode" serializeAs="String">
38+
<value></value>
39+
</setting>
40+
<setting name="RegisterBonusSkins" serializeAs="String">
41+
<value></value>
42+
</setting>
43+
</DevExpress.LookAndFeel.Design.AppSettings>
44+
</applicationSettings>
45+
<!--<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
46+
<asmv3:application>
47+
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
48+
<dpiAware>true</dpiAware>
49+
</asmv3:windowsSettings>
50+
</asmv3:application>
51+
</assembly>-->
52+
</configuration>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using DevExpress.Data.Filtering;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace DXSample {
9+
class IsDaysInterval : ICustomFunctionDisplayAttributes {
10+
public const string FunctionName = "IsDaysInterval";
11+
static readonly IsDaysInterval instance = new IsDaysInterval();
12+
13+
public static void Register() {
14+
CriteriaOperator.RegisterCustomFunction(instance);
15+
}
16+
public static bool Unregister() {
17+
return CriteriaOperator.UnregisterCustomFunction(instance);
18+
}
19+
public FunctionCategory Category {
20+
get { return FunctionCategory.DateTime; }
21+
}
22+
public string Description {
23+
get { return "<description>"; }
24+
}
25+
public bool IsValidOperandCount(int count) {
26+
return count == 2;
27+
}
28+
public bool IsValidOperandType(int operandIndex, int operandCount, Type type) {
29+
return operandIndex == 0 && type == typeof(DateTime) || operandIndex == 1 && type == typeof(int);
30+
}
31+
public int MaxOperandCount {
32+
get { return 2; }
33+
}
34+
public int MinOperandCount {
35+
get { return 2; }
36+
}
37+
public object Evaluate(params object[] operands) {
38+
DateTime dt = Convert.ToDateTime(operands[0]);
39+
int days = Convert.ToInt32(operands[1]);
40+
DateTime start = DateTime.Today.AddDays(-days);
41+
DateTime end = DateTime.Today.AddDays(days);
42+
return dt >= start && dt <= end;
43+
}
44+
public string Name {
45+
get { return FunctionName; }
46+
}
47+
public string DisplayName {
48+
get { return "Is days interval"; }
49+
}
50+
public object Image {
51+
get { return "SwitchTimeScalesTo;Size16x16;Colored"; }
52+
}
53+
54+
public Type ResultType(params Type[] operands) {
55+
return typeof(bool);
56+
}
57+
}
58+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
using DevExpress.Data.Filtering;
2+
using DevExpress.Utils.Svg;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
10+
namespace DXSample {
11+
public class IsWeekendFunction : ICustomFunctionDisplayAttributes {
12+
public const string FunctionName = "IsWeekend";
13+
static readonly IsWeekendFunction instance = new IsWeekendFunction();
14+
15+
public static void Register() {
16+
CriteriaOperator.RegisterCustomFunction(instance);
17+
}
18+
public static bool Unregister() {
19+
return CriteriaOperator.UnregisterCustomFunction(instance);
20+
}
21+
public FunctionCategory Category {
22+
get { return FunctionCategory.DateTime; }
23+
}
24+
public string Description {
25+
get { return "TEST TEST>"; }
26+
}
27+
28+
public bool IsValidOperandCount(int count) {
29+
return count == 1;
30+
}
31+
public bool IsValidOperandType(int operandIndex, int operandCount, Type type) {
32+
return type == typeof(DateTime);
33+
}
34+
public int MaxOperandCount {
35+
get { return 1; }
36+
}
37+
public int MinOperandCount {
38+
get { return 1; }
39+
}
40+
public object Evaluate(params object[] operands) {
41+
DateTime dt = Convert.ToDateTime(operands[0]);
42+
return dt.DayOfWeek == DayOfWeek.Sunday || dt.DayOfWeek == DayOfWeek.Saturday;
43+
}
44+
public string Name {
45+
get { return FunctionName; }
46+
}
47+
public string DisplayName {
48+
get { return "Is weekend"; }
49+
}
50+
public object Image {
51+
get { return "DayView;Office2013"; }
52+
}
53+
public Type ResultType(params Type[] operands) {
54+
return typeof(bool);
55+
}
56+
}
57+
58+
public class IsWeekendFunction2 : ICustomFunctionDisplayAttributes
59+
{
60+
string ICustomFunctionDisplayAttributes.DisplayName => throw new NotImplementedException();
61+
62+
object ICustomFunctionDisplayAttributes.Image => throw new NotImplementedException();
63+
64+
int ICustomFunctionOperatorBrowsable.MinOperandCount => throw new NotImplementedException();
65+
66+
int ICustomFunctionOperatorBrowsable.MaxOperandCount => throw new NotImplementedException();
67+
68+
string ICustomFunctionOperatorBrowsable.Description => throw new NotImplementedException();
69+
70+
FunctionCategory ICustomFunctionOperatorBrowsable.Category => throw new NotImplementedException();
71+
72+
string ICustomFunctionOperator.Name => throw new NotImplementedException();
73+
74+
object ICustomFunctionOperator.Evaluate(params object[] operands)
75+
{
76+
throw new NotImplementedException();
77+
}
78+
79+
bool ICustomFunctionOperatorBrowsable.IsValidOperandCount(int count)
80+
{
81+
throw new NotImplementedException();
82+
}
83+
84+
bool ICustomFunctionOperatorBrowsable.IsValidOperandType(int operandIndex, int operandCount, Type type)
85+
{
86+
throw new NotImplementedException();
87+
}
88+
89+
Type ICustomFunctionOperator.ResultType(params Type[] operands)
90+
{
91+
throw new NotImplementedException();
92+
}
93+
}
94+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using DevExpress.Data.Filtering;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace DXSample.CustomFunctions {
9+
public class NotBeginsWithFunction : ICustomFunctionDisplayAttributes {
10+
public const string FunctionName = "NotBeginsWith";
11+
static readonly NotBeginsWithFunction instance = new NotBeginsWithFunction();
12+
public static void Register() {
13+
CriteriaOperator.RegisterCustomFunction(instance);
14+
}
15+
public static bool Unregister() {
16+
return CriteriaOperator.UnregisterCustomFunction(instance);
17+
}
18+
public FunctionCategory Category {
19+
get { return FunctionCategory.Text; }
20+
}
21+
public string Description {
22+
get { return "<description>"; }
23+
}
24+
public bool IsValidOperandCount(int count) {
25+
return count == 2;
26+
}
27+
public bool IsValidOperandType(int operandIndex, int operandCount, Type type) {
28+
return type == typeof(string);
29+
}
30+
public int MaxOperandCount {
31+
get { return 2; }
32+
}
33+
public int MinOperandCount {
34+
get { return 2; }
35+
}
36+
public object Evaluate(params object[] operands) {
37+
if(operands[0] != null && operands[1] != null) {
38+
string str1 = operands[0].ToString();
39+
string str2 = operands[1].ToString();
40+
return !str1.StartsWith(str2, StringComparison.InvariantCultureIgnoreCase);
41+
}
42+
return false;
43+
}
44+
public string Name {
45+
get { return FunctionName; }
46+
}
47+
public string DisplayName {
48+
get { return "Not begins with"; }
49+
}
50+
public object Image {
51+
get {return "FontSizeDecrease;Office2013"; }
52+
}
53+
public Type ResultType(params Type[] operands) {
54+
return typeof(bool);
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)