当前位置: 首页>>代码示例>>C#>>正文


C# Events类代码示例

本文整理汇总了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;
			}
开发者ID:Ghost53574,项目名称:CSdk,代码行数:7,代码来源:Map.cs

示例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;
				}
			}
		}
开发者ID:chaipokoi,项目名称:Ocalm,代码行数:29,代码来源:Party.cs

示例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);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:28,代码来源:TestSearchByDateFromConsole.cs

示例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;
                }
            }
        }
开发者ID:nathandelane,项目名称:dotnet-http-web-testing,代码行数:25,代码来源:ExtractHiddenFields.cs

示例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;
            }
        }
开发者ID:nathandelane,项目名称:dotnet-http-web-testing,代码行数:34,代码来源:ValidateFormField.cs

示例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);
                }
            }
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:30,代码来源:TestsStream.cs

示例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);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:27,代码来源:TestsConsole.cs

示例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);
 }
开发者ID:Jonny007-MKD,项目名称:Trigger4Win,代码行数:7,代码来源:LogPowerEvents.cs

示例9: databaseCreatedEventHandler

 private void databaseCreatedEventHandler(Events.DatabaseCreated databaseCreatedEvent)
 {
     Databases.Clear();
       foreach (SqlServerDatabase database in databaseManager.GetAllDatabases()) {
     Databases.Add(database);
       }
 }
开发者ID:andyjmay,项目名称:Taikun,代码行数:7,代码来源:ProjectsViewModel.cs

示例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;
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:33,代码来源:Dispenser.cs

示例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);
 }
开发者ID:Jonny007-MKD,项目名称:Trigger4Win,代码行数:7,代码来源:LogPowerEvents.cs

示例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);
     }
 }
开发者ID:Vengadeswaran,项目名称:ITX-Venky-Projects,代码行数:28,代码来源:FeatureReceiver.cs

示例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;
                        }
                    }
                }
            }
        }
开发者ID:Bedrok,项目名称:800craft,代码行数:28,代码来源:DummyAI.cs

示例14: ProgressBar

 public ProgressBar(Vector2 position, float current, Events callbackEvent)
 {
     Dst.X = (int)position.X;
       Dst.Y = (int)position.Y;
       Current = current;
       CallbackEvent = callbackEvent;
 }
开发者ID:colincapurso,项目名称:IC2013,代码行数:7,代码来源:ProgressBar.cs

示例15: LoadGrid

 public void LoadGrid()
 {
     evnts = new  Events();
     evnts.GetAll();
     gvwEvents.DataSource = evnts;
     gvwEvents.DataBind();
 }
开发者ID:pakoito,项目名称:web,代码行数:7,代码来源:NewTourDate.aspx.cs


注:本文中的Events类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。