CodeResourceControl.cs
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeLibrary
{
public class CodeResourceControl
{
public delegate string GetStrDelegate(string id, string defaultStr);
public static event GetStrDelegate GetStrEvent;
public delegate string GetStringDelegate(string id, string defaultStr, params object[] param);
public static event GetStringDelegate GetStringEvent;
//public delegate string GetIdStrDelegate(string className, string controlName );
//public static event GetIdStrDelegate GetIdStrEvent;
//public delegate string GetProStrDelegate(string className);
//public static event GetProStrDelegate GetProStrEvent;
public delegate string GetLanguageDelegate();
public static event GetLanguageDelegate GetLanguageEvent;
public static string GetLanguage()
{
string result = GetLanguageEvent?.Invoke();
if (result == null)
{
return "";
}
return result;
}
public static string GetString(string id, string defaultStr)
{
string result = GetStrEvent?.Invoke(id, defaultStr);
if (result == null)
{
return defaultStr;
}
return result;
}
public static string GetString(string id, string defaultStr, params object[] param)
{
string result = GetStringEvent?.Invoke(id, defaultStr, param);
if (result == null)
{
return defaultStr;
}
return result;
}
private static string spiltStr = "_";
private static string Text = "Text";
public static string GetTextIdStr(string className, string controlName)
{
return className + spiltStr + controlName + spiltStr + Text;
}
public static string GetTextIdStr(string className)
{
return className + spiltStr + Text;
}
}
}