本文整理汇总了C#中Events类的典型用法代码示例。如果您正苦于以下问题:C# Events类的具体用法?C# Events怎么用?C# Events使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Events类属于命名空间,在下文中一共展示了Events类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Map
public Map(string name, string description, Events[] events, CSDK.Game.Location[] locations, Handler[] data) {
this.name = name;
this.description = description;
this.events = events;
this.locations = locations;
this.data = data;
}
示例2: handleEvent
public override void handleEvent (Events par1, object par2)
{
//TODO: implements touch screen
if (par1 == Scene.Events.Input) {
switch ((Keys)par2) {
case Keys.Up:
player.move (Entity.directions.Up);
break;
case Keys.Down:
player.move (Entity.directions.Down);
break;
case Keys.Left:
player.move (Entity.directions.Left);
break;
case Keys.Right:
player.move (Entity.directions.Right);
break;
case Keys.Space:
player.change ();
break;
case Keys.Escape:
if (pauseTime <= 0) {
pause = !pause;
pauseTime = 10;
}
break;
}
}
}
示例3: ShouldListEventsFromThisWeek
public void ShouldListEventsFromThisWeek()
{
Events newEvents = new Events
{
{ new Event ( "2015/01/01", "one", "test") },
{new Event(DateTime.Today.ToShortDateString(), "two") },
};
List<Event> expectedList = new List<Event>
{{ new Event (DateTime.Today.ToShortDateString(),"two") },
};
string[] args = { "/search", "date", "this week" };
SearchDateArgument searchArgs = new SearchDateArgument(args);
string field = "";
string op = "";
string val1 = "";
string val2 = "";
searchArgs.IsValid();
field = searchArgs.Field;
op = searchArgs.Criteria;
val1 = searchArgs.Date;
val2 = searchArgs.AnotherDate;
string[] values = { val1, val2 };
Events filteredList = Dispenser.SearchEvents(newEvents,field, op, values);
Utils.AssertAreEqual(filteredList, expectedList);
}
示例4: Extract
public override void Extract(object sender, Events.ExtractionEventArgs e)
{
base.Extract(sender, e);
IEnumerable<XElement> elements = base.Document.Document.Descendants();
IEnumerable<XElement> hiddenElements = from el in elements where el.Name.LocalName.Equals("input") && el.Attribute(XName.Get("type")).Value.Equals("hidden") select el;
foreach (XElement nextElement in hiddenElements)
{
string name = String.Empty;
string value = String.Empty;
if (nextElement.HasAttributes && nextElement.Attribute(XName.Get("name")) != null)
{
name = nextElement.Attribute(XName.Get("name")).Value;
if (nextElement.Attribute(XName.Get("value")) != null)
{
value = nextElement.Attribute(XName.Get("value")).Value;
}
base._context[name] = value;
}
}
}
示例5: Validate
public override void Validate(object sender, Events.ValidationEventArgs e)
{
if (String.IsNullOrEmpty(_name))
{
throw new ArgumentNullException("Name may not be null.");
}
try
{
base.Validate(sender, e);
IEnumerable<XElement> formElements = base.Document.Document.Descendants(XName.Get("input", "http://www.w3.org/1999/xhtml"));
foreach (XElement nextElement in formElements)
{
if (nextElement.Attribute(XName.Get("value")) != null && nextElement.Attribute(XName.Get("value")).Value.Equals(_expectedValue))
{
_context.Outcome = WebTestOutcome.Passed;
break;
}
}
if (_context.Outcome != WebTestOutcome.Passed)
{
_context.Outcome = WebTestOutcome.Failed;
}
}
catch (Exception ex)
{
_context.Outcome = WebTestOutcome.Error;
_message = ex.Message;
}
}
示例6: ShouldExportTOHTMLFromStream
public void ShouldExportTOHTMLFromStream()
{
string expectedFile = @"<!DOCTYPE html>
<html>
<head>
<title>Events List</title>
</head>
<body><p><b>Date:</b> 2015.12.25</p>
<p><b>Subject:</b> Christmas!</p><p><b>Title:</b> Christmas</p><p><b>Description:</b> Santa Claus</p><hr>
</body>
</html>";
expectedFile = expectedFile.Replace("\r", "");
Events newEvent = new Events();
string date = "2015/12/25";
string title = "Christams";
string description = "Santa Claus";
newEvent.Add(date, title,description);
using (MemoryStream ms = new MemoryStream())
{
using (IOStream streamObj = new IOStream(ms))
{
streamObj.ExportEventsInHTMLStream(newEvent);
var htmlContent = Encoding.UTF8.GetString(ms.ToArray());
htmlContent.ShouldContain(expectedFile);
}
}
}
示例7: ShouldDisplayEventsBeetwenTwoDate
public void ShouldDisplayEventsBeetwenTwoDate()
{
IOConsole toDisplay = new IOConsole();
string expectedConsole;
var consoleOut = new StringWriter();
Events newEvents = new Events {
{ new Event ( "2015/01/01", "one", "test") },
{new Event("2015/11/15", "two") },
{ new Event("2015/07/01", "three") },
{ new Event("2015/12/03", "four", "test1") },
{ new Event("2015/03/04", "five", "test2") },
{ new Event("2015/09/08", "six") }
};
SetExpectedResultToConsole("2015/09/08", "six", out expectedConsole, out consoleOut);
DateFilter firstFilter = new DateFilter( "<", "2015/10/25");
Events firstFilteredList = firstFilter.ApplyFilter((newEvents));
DateFilter eventsToDisplay = new DateFilter( ">", "2015/02/25");
Events filteredList = eventsToDisplay.ApplyFilter(firstFilteredList);
IOConsole newObj = new IOConsole(filteredList);
newObj.DisplayEventsToConsole();
consoleOut.ToString().ShouldContain(expectedConsole);
}
示例8: pwrEvents_PowerLineStatusChanged
private void pwrEvents_PowerLineStatusChanged(object sender, Events.EventArgsValues<PowerLineStatus> e)
{
if (e.NewValue == PowerLineStatus.Online)
this.Log.LogLineDate("The computer was connected to the power network", Trigger.Log.Type.PowerEvent);
else
this.Log.LogLineDate("The computer was disconnected from the power network", Trigger.Log.Type.PowerEvent);
}
示例9: databaseCreatedEventHandler
private void databaseCreatedEventHandler(Events.DatabaseCreated databaseCreatedEvent)
{
Databases.Clear();
foreach (SqlServerDatabase database in databaseManager.GetAllDatabases()) {
Databases.Add(database);
}
}
示例10: FilterEvents
public static Events FilterEvents(Events eventsList, string field, string criteria, string[] values)
{
Events filteredList = new Events();
switch (field)
{
case "date":
{
string firstValue = values[0];
string secondValue = values[1];
filteredList = GetFilteredListByDate(eventsList, criteria, firstValue, secondValue);
break;
}
case "description":
{
string firstValue = values[0];
filteredList = GetFilteredListByDescription(eventsList, criteria, firstValue);
break;
}
case "tag":
{
filteredList = GetFilteredListByTag(eventsList, criteria, values);
break;
}
default:
{
Console.WriteLine("Invalid parameter!");
break;
}
}
return filteredList;
}
示例11: pwrEvents_BatteryAvailabilityChanged
private void pwrEvents_BatteryAvailabilityChanged(object sender, Events.EventArgsValue<bool?> e)
{
if (e.Value.Value == true)
this.Log.LogLineDate("A battery was connected", Trigger.Log.Type.PowerEvent);
else
this.Log.LogLineDate("A battery was disconnected", Trigger.Log.Type.PowerEvent);
}
示例12: FeatureActivated
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
//Adding Project Published Event Handling Code starts here
try
{
MyUtilities.ErrorLog("Feature Event-Activated Started", EventLogEntryType.SuccessAudit);
var site = (SPSite)properties.Feature.Parent;
using (var Site = new SPSite(site.Url))
{
MyUtilities.EnableSQlServerCLR(Site.ID);
MyUtilities.InstallStoredProcedure(Site.ID, true);
var Events_Svc = new Events
{
UseDefaultCredentials = true,
AllowAutoRedirect = true,
Url = (Site.Url + @"/_vti_bin/psi/Events.asmx")
};
string FilePath = SPUtility.GetGenericSetupPath(string.Empty) + @"\TEMPLATE\FEATURES\ITXTaskBaseLineAudit\ITXTaskBaseLineAudit.dll";
Utilities.CreatePSEvent(Events_Svc, FilePath, "Project", "Published",
"ITX Task BaseLine Change Monitor",
"This code is to track the task baseline value changes.");
}
}
catch (Exception ex)
{
MyUtilities.ErrorLog("Error at activating feature due to : " + ex.Message, EventLogEntryType.Error);
}
}
示例13: DummyFollowing
public static void DummyFollowing(object sender, Events.PlayerMovingEventArgs e)
{
if (e.Player.World.Map.Dummys.Count() > 0)
{
foreach (Player d in e.Player.World.Map.Dummys)
{
if (d.Info.IsFollowing)
{
if (d.Info.ID.ToString() == e.Player.Info.followingID)
{
Vector3I oldPos = new Vector3I(e.OldPosition.X, e.OldPosition.Y, e.OldPosition.Z);
Vector3I newPos = new Vector3I(e.NewPosition.X, e.NewPosition.Y, e.NewPosition.Z);
Packet packet = PacketWriter.MakeMoveRotate(d.Info.ID, new Position
{
X = (short)(newPos.X - oldPos.X),
Y = (short)(newPos.Y - oldPos.Y),
Z = (short)(newPos.Z - oldPos.Z),
R = (byte)Math.Abs(e.Player.Position.R),
L = (byte)Math.Abs(e.Player.Position.L)
}); ;
e.Player.World.Players.Send(packet);
d.Info.DummyPos = d.Position;
}
}
}
}
}
示例14: ProgressBar
public ProgressBar(Vector2 position, float current, Events callbackEvent)
{
Dst.X = (int)position.X;
Dst.Y = (int)position.Y;
Current = current;
CallbackEvent = callbackEvent;
}
示例15: LoadGrid
public void LoadGrid()
{
evnts = new Events();
evnts.GetAll();
gvwEvents.DataSource = evnts;
gvwEvents.DataBind();
}