本文整理汇总了C#中Interface类的典型用法代码示例。如果您正苦于以下问题:C# Interface类的具体用法?C# Interface怎么用?C# Interface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Interface类属于命名空间,在下文中一共展示了Interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoControl
public override Model.Cache DoControl(Interface.IView view, Interface.IController controller)
{
if (controller.Cache.getCrudModeInCache() != Model.Cache.crudMode.Stateless)
{
// CRUD FUNCTIONALITY HERE
switch (controller.Cache.getCrudModeInCache())
{
case Model.Cache.crudMode.Create:
menuSwitcher(view, controller);
Model.Member member = new Model.Member
(
view.getResponse("Firstname"),
view.getResponse("Lastname"),
view.getResponse("Personal Number")
);
Console.WriteLine(member);
return null;
default:
throw new NotImplementedException();
}
}
else
{
menuSwitcher(view, controller);
ClientResponse = view.getResponse();
SelectedInMenuBoat = (Model.Cache.menuBoat)int.Parse(ClientResponse);
return prepareNewCacheFromMenuBoat();
}
}
示例2: InterfacesArray
public Interface[] InterfacesArray()
{
System.Collections.ArrayList arrList = new System.Collections.ArrayList();
int i = 0;
while (true)
{
IntPtr cIf;
Interface iface;
cIf = UnmanagedGetInterfaceN(cNode, i);
if (cIf == IntPtr.Zero)
{
//Debug.WriteLine("UnmanagedAttribute zero pointer");
break;
}
iface = new Interface(cIf);
i++;
arrList.Add(iface);
}
Interface[] array = (Interface[])arrList.ToArray(typeof(Interface));
Debug.WriteLine("NodeList with " + i + " nodes");
return array;
}
示例3: Add
// v=v+cv2;
public void Add(Interface.IVector v2, double c)
{
for (int i = 0; i < v2.Size; i++)
{
v[i] += v2[i]*c;
}
}
示例4: updateList
private void updateList(Interface.IGame game)
{
if (!lbxListGames.Items.Contains(game.getGameID()))
{
lbxListGames.Items.Add(game.getGameID());
}
}
示例5: Translate
/// <summary>
/// Translates control using InterfaceLanguage instance
/// </summary>
/// <param name="control">Control to translate</param>
/// <param name="lang">Language object</param>
/// <returns>True if control has been translated, false otherwise</returns>
public static bool Translate( this Control control, Interface.InterfaceLanguage lang )
{
string prefix = "lang";
if( control.Tag == null )
return (false);
if( !control.Tag.ToString().StartsWith( prefix ) )
return (false);
string tag = control.Tag.ToString().Substring( prefix.Length );
FieldInfo field = null;
try
{
field = lang.GetType().GetField( tag );
}
catch( Exception )
{
return (false);
}
if( field == null )
return (false);
else if( !field.IsPublic )
return (false);
else if( field.FieldType != typeof( string ) )
return (false);
string value = (string)field.GetValue( lang );
control.Text = value;
return (true);
}
示例6: GetUtilization
public override Task<IEnumerable<Interface.InterfaceUtilization>> GetUtilization(Interface nodeInteface, DateTime? start, DateTime? end, int? pointCount = null)
{
const string allSql = @"
Select itd.DateTime,
itd.In_Maxbps InMaxBps,
itd.In_Averagebps InAvgBps,
itd.Out_Maxbps OutMaxBps,
itd.Out_Averagebps OutAvgBps,
Row_Number() Over(Order By itd.DateTime) RowNumber
From InterfaceTraffic itd
Where itd.InterfaceID = @Id
And {dateRange}
";
const string sampledSql = @"
Select *
From (Select itd.DateTime,
itd.In_Maxbps InMaxBps,
itd.In_Averagebps InAvgBps,
itd.Out_Maxbps OutMaxBps,
itd.Out_Averagebps OutAvgBps,
Row_Number() Over(Order By itd.DateTime) RowNumber
From InterfaceTraffic itd
Where itd.InterfaceID = @Id
And {dateRange}) itd
Where itd.RowNumber % ((Select Count(*) + @intervals
From InterfaceTraffic itd
Where itd.InterfaceID = @Id
And {dateRange})/@intervals) = 0";
return UtilizationQuery<Interface.InterfaceUtilization>(nodeInteface.Id, allSql, sampledSql, "itd.DateTime", start, end, pointCount);
}
示例7: InExecutive
protected override Object InExecutive(Interface.WATFDictionary<String, String> attributes)
{
object rtn = default(object);
if (this.context.Assemblys.ContainsKey(attributes[GlobalDefine.Keyword.Executive.From]))
{
//执行反射外部函数
WATF.Plugin.IPlugin reflection = (WATF.Plugin.IPlugin)this.context.Assemblys[attributes[GlobalDefine.Keyword.Executive.From]].CreateInstance(attributes[GlobalDefine.Keyword.Executive.Select]);
Dictionary<string, object> paramList = GetParamsFromWhere(attributes[GlobalDefine.Keyword.Executive.Where],this.context);
if (this.context.Results.Count > 0)
{
rtn = reflection.StartMethod(this.context.Results.Peek(), paramList);
}
else
{
rtn = reflection.StartMethod(null, paramList);
}
if (attributes.ContainsKey(GlobalDefine.Keyword.Executive.Into)
&& !attributes[GlobalDefine.Keyword.Executive.Into].Equals(string.Empty))
{
this.context.SetVar(attributes[GlobalDefine.Keyword.Executive.Into], rtn);
}
}
else//如果没有from关键字,则执行内部函数逻辑
{
}
return rtn;
}
示例8: AddTestDataToIndex
public static void AddTestDataToIndex(Interface.IIndexService indexService, Api.Index index, string testData)
{
string[] lines = testData.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
string[] headers = lines[0].Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines.Skip(1))
{
string[] items = line.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
var indexDocument = new Document();
indexDocument.Id = items[0];
indexDocument.Index = index.IndexName;
indexDocument.Fields = new Api.KeyValuePairs();
for (int i = 1; i < items.Length; i++)
{
indexDocument.Fields.Add(headers[i], items[i]);
}
indexService.PerformCommand(
index.IndexName,
IndexCommand.NewCreate(indexDocument.Id, indexDocument.Fields));
}
indexService.PerformCommand(index.IndexName, IndexCommand.Commit);
Thread.Sleep(100);
}
示例9: Register
/// <summary>
/// 注册收听者
/// </summary>
/// <param name="listenerMember">收听者对象</param>
/// <returns></returns>
public bool Register(Interface.IListenerMember listenerMember)
{
listenerMember.OnlyListenerKey = Guid.NewGuid().ToString();
this.ListenerMemberList.Add(listenerMember);
this.OnAddListenerMember(listenerMember);
return true;
}
示例10: Begin
public static void Begin(Interface.Struct.BeginSession session)
{
roundNumber = session.roundNumber;
techniteSubRoundNumber = session.techniteSubRoundNumber;
FactionUUID = session.factionUUID;
TechniteGridID = session.techniteGridID;
Out.Log(Significance.Important, "Session started: "+FactionUUID+" in round "+roundNumber+"/"+techniteSubRoundNumber);
}
示例11: multScalar
//res = vec*v
public static Interface.IVector multScalar(double v, Interface.IVector vec)
{
for (int i = 0; i < vec.Size; i++)
{
vec[i] *= v;
}
return vec;
}
示例12: AddModules
/// <summary>
/// 添加模块
/// </summary>
/// <param name="modules"></param>
/// <returns></returns>
public bool AddModules(Interface.IModules modules)
{
if (this.ModulesList.ContainsKey(modules.Key)) return false;
this.ModulesList.Add(modules.Key, modules);
return true;
}
示例13: DoControl
public override Model.Cache DoControl(Interface.IView view, Interface.IController controller)
{
menuSwitcher(view, controller);
ClientResponse = view.getResponse();
SelectedInMenuIndex = (Model.Cache.menuIndex)int.Parse(ClientResponse);
return prepareNewCacheFromMenuIndex();
}
示例14: InterfaceOperation
public InterfaceOperation(Mapping.InterfaceOperation operation, Interface iface, IpAddress ipAddress = null)
: base(operation)
{
this.InterfaceId = operation.InterfaceId;
this.Interface = iface;
this.IpAddressId = operation.IpAddressId;
this.IpAddress = ipAddress;
}
示例15: SetupFixture
public void SetupFixture()
{
if (System.IO.File.Exists(filename))
System.IO.File.Delete(filename);
intf = new Interface();
intf.CreateAccessDatabase(filename);
intf.CreateDefaultDatabaseContent();
}