コード例 #1
0
ファイル: Hub.cs プロジェクト: HeadhunterXamd/BasicUDPServer
 /// <summary>
 /// Create a hub which manages all the players in a game.
 /// </summary>
 /// <param name="_playerAmount">The maximum amount of players allowed in this room.</param>
 /// <param name="_name">The name of the room.</param>
 public Hub(int _playerAmount, string _name)
 {
     PlayerAmount = _playerAmount;
     Players = new EventList<Player>();
     Name = _name;
     Players.SubscribeToAdd(PlayerJoined);
 }
コード例 #2
0
 public SyncEventContext(Event pattern, IEnumerable<Event> events, EventList calendar, EventListManager mgr)
 {
     Pattern = pattern;
      Events = events;
      EventList = calendar;
      EventListManager = mgr;
 }
コード例 #3
0
ファイル: Subject.cs プロジェクト: Jay2645/text-adventure
 /// <summary>
 /// Notifies all observers under our control of the specified event.
 /// </summary>
 /// <param name='entity'>
 /// An entity relating to the event.
 /// </param>
 /// <param name='eventType'>
 /// A unique string identifying the event.
 /// </param>
 public void Notify(object entity, EventList eventType)
 {
     List<Observer> allObservers = new List<Observer> ();
     List<Observer> cObservers = new List<Observer> ();
     List<Observer> luaObservers = new List<Observer> ();
     foreach (Observer o in observerList)
     {
         if (o == null)
         {
             continue;
         }
         allObservers.Add (o);
         if (o is IO.LuaSystem.LuaBinding)
         {
             luaObservers.Add (o);
         }
         else
         {
             cObservers.Add (o);
         }
     }
     observerList = allObservers;
     foreach (Observer o in cObservers) // Do the C# observers first to make sure all code is processed
     {
         o.OnNotify (entity, eventType);
     }
     foreach (Observer o in luaObservers)
     {
         o.OnNotify (entity, eventType);
     }
 }
コード例 #4
0
        private void Create(Event eventItem, EventList calendar, BranchItem branch)
        {
            if (eventItem != null || calendar != null)
             {
            Item root = StaticSettings.EventTargetDatabase.GetItem(calendar.ID);

            if (root == null || SecurityManager.CanWrite(root) != true)
            {
               return;
            }

            Item parent = StaticSettings.EventTargetDatabase.GetItem(calendar.ID);

            if (parent != null)
            {
               parent = Utilities.CreateDatePath(parent, eventItem.StartDate);
            }

            if (SecurityManager.CanWrite(parent) != true || parent == null)
            {
               return;
            }

            Item child = parent.Add(Utilities.Sanitize(eventItem.Title), branch);

            eventItem.ID = child.ID.ToString();

            eventItem.Save();

            PublishUtil.Publishing(eventItem.GetTargetItem(), true, false);
             }
        }
コード例 #5
0
 /// <summary>
 /// start a small server that listens to UDP messages through _port 1337(as indicated when initializing the server instance).
 /// </summary>
 /// <param name="_port"></param>
 public Server(int _port)
 {
     this._iPort = _port;
     _lMessageBacklog = new EventQueue<NetworkMessage>();
     _lPlayerRooms = new EventList<Hub>();
     Instance = this;
     Console.WriteLine("Setting up the server...");
     MessageReceived += ParseMessage;
 }
コード例 #6
0
 public static void AddEventHandler(string eventName, GlobalEvent handler)
 {
     if (!EventContainer.ContainsKey(eventName))
     {
         var list = new EventList(eventName){handler};
         EventContainer.Add(eventName, list);
     }
     else
         EventContainer[eventName].Add(handler);
 }
コード例 #7
0
ファイル: UiItem.cs プロジェクト: CourageAndrey/Projects
 private IList<TreeUiItem> childrenLoader()
 {
     var result = new EventList<TreeUiItem>(
         childrenGetter(ValueMember).Select(o => childrenCreator(o)),
         added: OnItemAdded,
         removed: OnItemRemoved);
     foreach (var child in result)
     {
         OnItemAdded(result, child);
     }
     return result;
 }
コード例 #8
0
        public List <IStoryEntityObject> GetAllEntityList()
        {
            var el = new List <IStoryEntityObject>();

            ActorList.ForEach(v => el.Add(v));
            GroupList.ForEach(v => el.Add(v));
            EventList.ForEach(v => el.Add(v));
            LocationList.ForEach(v => el.Add(v));
            StuffList.ForEach(v => el.Add(v));
            TaskList.ForEach(v => el.Add(v));
            return(el);
        }
コード例 #9
0
        static void Main(string[] args)
        {
            var story = new Story();

            story.GetIntro();
            var hostList = new CreateHosts(story.YearBorn, story.CurrentYear);
            var myLeaper = new Leaper(story.Name, 100);
            var name     = myLeaper.Name;
            var wallet   = myLeaper.Wallet;
            var year     = story.YearBorn;

            Console.WriteLine($"NAME: {name}");
            Console.WriteLine($"YOUR YEAR {year}");
            Console.WriteLine($"YOUR WALLET {wallet}");

            while (true)
            {
                // list // year + wallet conditional
                var getAllJumpable = hostList.GetAllJumpableHosts(story.YearBorn, wallet);
                Console.WriteLine($"HOSTS IN YOUR YEAR THAT YOU CAN AFFORD TO JUMP TO");
                hostList.DisplayMenu(getAllJumpable);

                Console.WriteLine("ENTER ID OF HOST TO JUMP TO");
                var resp = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("ENTER THE AMOUNT OF DAYS TO STAY");
                var daysResp = Convert.ToInt32(Console.ReadLine());

                var eventDescriptions = new EventList();

                eventDescriptions.PrintNames();

                Console.WriteLine($"Which event would like to jump into?");
                var response = Console.ReadLine();

                var selectedEvent = eventDescriptions.GetEvent(int.Parse(response));

                Console.WriteLine($"You selected {selectedEvent.Name}");

                var myEvent = new Event(selectedEvent.Name, selectedEvent.Year, selectedEvent.Location, selectedEvent.Reward);

                myEvent.Complete();

                //// void // Changes actual host // This is what we should use to jump to a host
                hostList.JumpToHost(year, wallet, daysResp, resp, myLeaper);
            }

            //if (myEvent.IsPutRight == true)
            //{
            //    eventDescriptions.Remove(myEvent);
            //    eventDescriptions.PrintNames();
            //}
        }
コード例 #10
0
        private void purchaseTickets_Click(object sender, RoutedEventArgs e)
        {
            var eventBe =
                EventList.GetBindingExpression(ComboBox.TextProperty);
            var customerReferenceBe =
                CustomerReference.GetBindingExpression(TextBox.TextProperty);
            var privilegeLevelBe =
                PrivilegeLevel.GetBindingExpression(ComboBox.TextProperty);
            var numberOfTicketsBe =
                NumberOfTickets.GetBindingExpression(RangeBase.ValueProperty);

            if (eventBe == null)
            {
                return;
            }
            eventBe.UpdateSource();
            if (customerReferenceBe == null)
            {
                return;
            }
            customerReferenceBe.UpdateSource();
            if (privilegeLevelBe == null)
            {
                return;
            }
            privilegeLevelBe.UpdateSource();
            if (numberOfTicketsBe == null)
            {
                return;
            }
            numberOfTicketsBe.UpdateSource();

            if (eventBe.HasError || customerReferenceBe.HasError ||
                privilegeLevelBe.HasError || numberOfTicketsBe.HasError)
            {
                MessageBox.Show("Please correct errors", "Purchase aborted");
            }
            else
            {
                var ticketOrderBinding =
                    BindingOperations.GetBinding(PrivilegeLevel, ComboBox.TextProperty);
                if (ticketOrderBinding == null)
                {
                    return;
                }
                var ticketOrder = ticketOrderBinding.Source as TicketOrder;
                if (ticketOrder != null)
                {
                    MessageBox.Show(ticketOrder.ToString(), "Purchased");
                }
            }
        }
コード例 #11
0
 public long Modify(EventList eventList)
 {
     return(Repository.GetConnection().Query <long>("dbo.EventListModify", new
     {
         Id = eventList.Id,
         Title = eventList.Title,
         Description = eventList.Description,
         Date = eventList.Date,
         OwnerId = eventList.OwnerId,
         StoreId = eventList.StoreId,
         ProuctLists = eventList.ProductLists.ToTvp().AsTableValuedParameter()
     }, commandType: CommandType.StoredProcedure, commandTimeout: int.MaxValue).First());
 }
コード例 #12
0
ファイル: EventManager.cs プロジェクト: RedJunHee/IAA
 //등록
 public void RegisterObserver(EventList EventList, ObjectCallback observer)
 {
     if (_eventMap.ContainsKey(EventList) == false)
     {
         // Debug.Log("새로운 이벤트 추가" + observer.Method.Name);
         _eventMap.Add(EventList, observer);
     }
     else
     {
         //Debug.Log("이벤트 추가" + observer.Method.Name);
         _eventMap[EventList] += observer;
     }
 }
コード例 #13
0
        public List <string> GetAllParameterName()
        {
            List <string> l = new List <string>();

            AddParameterName(ActorList.Cast <IStoryEntityObject>().ToList(), l);
            AddParameterName(EventList.Cast <IStoryEntityObject>().ToList(), l);
            AddParameterName(GroupList.Cast <IStoryEntityObject>().ToList(), l);
            AddParameterName(TaskList.Cast <IStoryEntityObject>().ToList(), l);
            AddParameterName(StuffList.Cast <IStoryEntityObject>().ToList(), l);
            AddParameterName(RelationList.Cast <IStoryEntityObject>().ToList(), l);

            return(l);
        }
コード例 #14
0
        private void Create(string username)
        {
            var owner = context.Users.FirstOrDefault(u => u.UserName == username);

            var eventList = new EventList()
            {
                Owner = owner
            };

            context.EventLists.Add(eventList);

            context.SaveChanges();
        }
コード例 #15
0
        public void UpdateEventList(EventList el, ApplicationUser user)
        {
            EventList t = getEventList(el.Id, user);

            if (t != null)
            {
                t.Id       = el.Id;
                t.Event    = el.Event;
                t.JoinTime = el.JoinTime;
                t.User     = el.User;
                _db.SaveChanges();
            }
        }
コード例 #16
0
        public void PublishEvents(IAggregateRoot aggRoot, ICommand c)
        {
            if (aggRoot == null)
            {
                throw new ArgumentNullException("aggRoot");
            }

            foreach (IEvent e in aggRoot.PendingEvents)
            {
                EventCommandList.Add(new EventCommandPair(e, c, aggRoot.AggregateId));
                EventList.Add(e);
            }
        }
コード例 #17
0
 public void Setup()
 {
     QueryHelper = new QueryHelper();
     Data        = new TestData(QueryHelper);
     Session     = new TestSession();
     Session.BeginUpdate();
     Data.AddLocationsPersisted(3, Session);
     Data.AddNewslettersPersisted(4, Session);
     Session.Commit();
     EventList = new EventList {
         Session = Session
     };
 }
コード例 #18
0
        public void VisitEventDeclaration()
        {
            WithSourceFiles(Files.ChildClass);
            var childClass = CreateClass(nameof(ChildClassWithEvent));

            var eventList = new EventList();
            var eventSyntaxReader = new EventSyntaxReader(eventList, Semantic);

            eventSyntaxReader.Visit(childClass.SourceCode);

            Assert.IsNotEmpty(eventList);
            Assert.AreEqual("SomethingHappened", eventList.Single().Name);
        }
コード例 #19
0
    private void OnCollisionEnter(Collision collision)
    {
        Rigidbody rb = collision.collider.GetComponent <Rigidbody>();

        if (rb != null && collision.gameObject.tag == Constants.PUCK_TAG)
        {
            Vector3 forceVector = collision.collider.transform.position - transform.position;
            rb.AddForce(forceVector * Strength);
            if (EventList.BumperHit != null)
            {
                EventList.BumperHit(this.gameObject, rb.gameObject);
            }
        }
    }
コード例 #20
0
        ///<summary>
        ///сохранить изменения события
        ///</summary>
        protected void saveStateButton_Click(object sender, EventArgs e)
        {
            routeEvent.date = FormatDate(DateBox.Text);
            //routeEvent.date = FormatDate(DateBox.Attributes["value"]);

            routeEvent.dateR = FormatDate(DateRBox.Text);
            //routeEvent.dateR = FormatDate(DateRBox.Attributes["value"]);

            var index = EventList.FindIndex(x => x.application.ID == routeEvent.application.ID && x.point.position == routeEvent.point.position);

            EventList[index] = routeEvent;
            BuildRouteEvents();
            WorkPlaces.ActiveViewIndex = 0;
        }
コード例 #21
0
        ///<summary>
        ///сохранить состояния после drag'n'drop
        ///</summary>
        private void SaveStates()
        {
            if (routeTable == null || routeTable.Rows.Count == 0)
            {
                return;
            }

            for (int i = 1; i < routeTable.Rows.Count; i++)
            {
                for (int j = 1; j < routeTable.Rows[i].Cells.Count - 1; j++)
                {
                    var td       = routeTable.Rows[i].Cells[j];
                    var clr      = td.Controls[0] as TextBox;
                    var curEvent = EventList.FindIndex(x => x.application.ID == td.Attributes["appid"] && x.point.ID == td.Attributes["pointid"]);
                    switch (clr.Text)
                    {
                    case "yellow":
                        EventList[curEvent].done    = false;
                        EventList[curEvent].current = true;
                        EventList[curEvent].dateR   = string.Empty;
                        break;

                    case "limegreen":
                        EventList[curEvent].done    = true;
                        EventList[curEvent].current = false;
                        if (string.IsNullOrEmpty(EventList[curEvent].dateR))
                        {
                            EventList[curEvent].dateR = System.DateTime.Now.ToShortDateString();
                        }
                        break;

                    case "tomato":
                        EventList[curEvent].done    = false;
                        EventList[curEvent].current = false;
                        if (string.IsNullOrEmpty(EventList[curEvent].dateR))
                        {
                            EventList[curEvent].dateR = System.DateTime.Now.ToShortDateString();
                        }
                        break;

                    default:
                        EventList[curEvent].done    = false;
                        EventList[curEvent].current = false;
                        EventList[curEvent].dateR   = string.Empty;
                        break;
                    }
                }
            }
            this.DataBind();
        }
コード例 #22
0
        public string Verify(Model.LiveSplitState splitStates)
        {
            StringBuilder sbIssues = new StringBuilder();

            var segments = splitStates.Run.ToList();

            if (segments.Count < EventList.Count)
            {
                EventList.RemoveRange(segments.Count, EventList.Count - segments.Count);                  //TO DO: Test this!
                sbIssues.AppendLine("- Event list had more positions than splits (the list was trimmed!)");
            }
            else if (segments.Count > EventList.Count)
            {
                var splitsToAdd = segments.Where((x, i) => i >= EventList.Count).Select(x => new SplitsToEvents.SplitEvent());
                EventList.AddRange(splitsToAdd);
                sbIssues.AppendLine("- Event list has less positions than splits (new positions were added!)");
            }

            for (int i = 0; i < EventList.Count; i++)
            {
                EventList[i].SegmentName = segments[i].Name;
            }

            RequiresManualFixing = false;
            bool predictionRunning = false;

            for (int i = 0; i < EventList.Count; i++)
            {
                if (EventList[i].EventType == SplitEventType.None)
                {
                    continue;
                }
                else if (EventList[i].EventType == SplitEventType.StartPredictionOnSplitStart && !predictionRunning)
                {
                    predictionRunning = true;
                }
                else if (EventList[i].EventType == SplitEventType.StartPredictionOnSplitStart && predictionRunning)
                {
                    sbIssues.AppendLine($"- Event list tries to start a prediction before the other prediction is closed (Split #{i + 1}.)");
                    RequiresManualFixing = true;
                    break;
                }
                else if (EventList[i].EventType == SplitEventType.FinishPredictionWithOption1 || EventList[i].EventType == SplitEventType.FinishPredictionWithOption2)
                {
                    predictionRunning = false;
                }
            }

            return(sbIssues.ToString());
        }
コード例 #23
0
        public object Clone()
        {
            var clone = new SplitsToEvents();

            clone.UsePBPrediction       = UsePBPrediction;
            clone.NotifyOfErrorsInChat  = NotifyOfErrorsInChat;
            clone.EventList             = EventList.Select(x => (SplitEvent)x.Clone()).ToList();
            clone.OnTimerResetBehaviour = OnTimerResetBehaviour;
            clone.OnRunCompletion       = OnRunCompletion;
            clone.OnRunCompletionDelay  = OnRunCompletionDelay;
            clone.Filename             = Filename;
            clone.RequiresManualFixing = RequiresManualFixing;
            return(clone);
        }
コード例 #24
0
    private void NewLaunchHandler(Launch launch)
    {
        if (launch.LauncherId == LauncherId &&
            launchQueue.Contains(launch) == false &&
            (currentLaunch == null || currentLaunch.RandId != launch.RandId))
        {
            launchQueue.Add(launch);

            if (EventList.LaunchQueueUpdated != null)
            {
                EventList.LaunchQueueUpdated(LauncherId, launchQueue);
            }
        }
    }
コード例 #25
0
        private void Update(UpdateCommandContext context, EventList oldCalendar, BranchItem branch)
        {
            if (!SecurityManager.CanWrite(context.Event.GetTargetItem()))
             {
            return;
             }

             bool isClearSchedule = !context.UpdateSeries;

             if (context.Event.IsDateScopeChanged && oldCalendar.ID.ToString() == context.CalendarID && !context.UpdateSeries)
             {
            isClearSchedule = true;
            context.Event.ScheduleID = string.Empty;
            MoveEvent(context);
             }

             if (context.Event != null)
             {
            if (context.Schedule != null && !isClearSchedule)
            {
               context.Event.ScheduleID = context.Schedule.ID;
            }

            if ((context.Schedule != null && context.UpdateSeries &&
                (context.Schedule.IsChanged || context.Event.IsDateScopeChanged)) ||
                (context.UpdateSeries && oldCalendar.ID.ToString() != context.CalendarID))
            {
               this.UpdateAllSeriesTogetherWithSchedule(context, branch);
               return;
            }

            if (oldCalendar.ID.ToString() != context.CalendarID)
            {
               UpdateThisOccurrence(context, branch);
               return;
            }

            var events = new List<Event>();
            if (context.UpdateSeries && context.Schedule != null)
            {
               events.AddRange(context.Schedule.GetTargetEvents());
            }
            else
            {
               events.Add(new Event(context.Event.GetTargetItem()));
            }

            SyncEvents(context, events);
             }
        }
コード例 #26
0
    public void Search()
    {
        var p = GameManager.ThePlayer;

        if (p.PreventInput)
        {
            return;
        }
        var e = EventList.FindEventForRoom(Data);

        e.Trigger(p, this);
        EventAvailable = false;
        RoomUI.SearchButton.gameObject.SetActive(false);
    }
コード例 #27
0
        private void EventViewerDialog_Shown(object sender, EventArgs e)
        {
            // タブ初期化
            foreach (var tabPage in CreateTabsFromUserStreamsEvent())
            {
                TabEventType.TabPages.Add(tabPage);
            }

            EventList.BeginUpdate();
            _curTab = TabEventType.SelectedTab;
            CreateFilterdEventSource();
            EventList.EndUpdate();
            this.TopMost = SettingCommon.Instance.AlwaysTop;
        }
コード例 #28
0
        // GET: Event
        public ActionResult Index()
        {
            if (Authenticate.IsAuthenticated())
            {
                events = new EventList();
                events.Load();

                return(View(events));
            }
            else
            {
                return(RedirectToAction("Login", "Login", new { returnurl = HttpContext.Request.Url }));
            }
        }
コード例 #29
0
ファイル: Carriage.cs プロジェクト: lzw37/PassengerPlot
        public Point GetLocationByTime(int time)
        {
            CarriageEvent previousEvent  = EventList.First();
            CarriageEvent followingEvent = EventList.Last();

            if (time < previousEvent.Time || time > followingEvent.Time)
            {
                return(new Point(0, 0));
            }

            for (int i = 0; i < EventList.Count - 1; i++)
            {
                if (EventList[i].Time <= time && EventList[i + 1].Time >= previousEvent.Time)
                {
                    previousEvent  = EventList[i];
                    followingEvent = EventList[i + 1];
                }
            }

            if (previousEvent == followingEvent)
            {
                //CarriageView.RotationTangent = 0;
                return(previousEvent.AttachedStopFacility.LinkedStation.Location);
            }

            if (previousEvent.Type == CarriageEventTypes.Arrive && followingEvent.Type == CarriageEventTypes.Depart) // dwelling at station
            {
                //CarriageView.RotationTangent = 0;
                return(previousEvent.AttachedStopFacility.LinkedStation.Location);
            }

            if (previousEvent.Type == CarriageEventTypes.Depart && followingEvent.Type == CarriageEventTypes.Arrive)// running
            {
                //Section sec = EntityData.GetSection(previousEvent.AttachedStopFacility.LinkedStation, followingEvent.AttachedStopFacility.LinkedStation);

                double percentage = Convert.ToDouble(time - previousEvent.Time) / (followingEvent.Time - previousEvent.Time);

                //CarriageView.RotationTangent = sec.LinkView.RotationTangent;

                double x = percentage * (followingEvent.AttachedStopFacility.LinkedStation.Location.X - previousEvent.AttachedStopFacility.LinkedStation.Location.X) + previousEvent.AttachedStopFacility.LinkedStation.Location.X;
                double y = percentage * (followingEvent.AttachedStopFacility.LinkedStation.Location.Y - previousEvent.AttachedStopFacility.LinkedStation.Location.Y) + previousEvent.AttachedStopFacility.LinkedStation.Location.Y;

                Station fromNode = previousEvent.AttachedStopFacility.LinkedStation;
                Station toNode   = followingEvent.AttachedStopFacility.LinkedStation;
                //CarriageView.RotationTangent = (fromNode.Location.Y - toNode.Location.Y) / (fromNode.Location.X - toNode.Location.X);
                return(new Point(x, y));
            }

            return(new Point(0, 0));
        }
コード例 #30
0
    private void BumperHitHandler(GameObject bumper, GameObject puck)
    {
        if (remainingHits > 0)
        {
            //objectiveText.text = string.Format(objectiveString, --remainingHits, goalHits);
            //display.Add(titleString, string.Format(objectiveString, --remainingHits, goalHits), 5, 0);
            if (EventList.AddRotatingText != null)
            {
                EventList.AddRotatingText(titleString, string.Format(objectiveString, --remainingHits, goalHits));
            }
            if (remainingHits <= 0)
            {
                //objectiveText.text = string.Format(completedString, goalHits);
                //display.Add(titleString, string.Format(objectiveString, --remainingHits, goalHits), 5, 0);
                if (EventList.AddRotatingText != null)
                {
                    EventList.AddRotatingText(titleString, string.Format(completedString, goalHits));
                }
                string missionId = Constants.GetMissionId(missionName);
                if (missionId == null)
                {
                    Debug.LogError("Could not retrieve mission Id for mission name: " + missionName);
                    return;
                }

                if (EventList.MissionCompleted != null)
                {
                    EventList.MissionCompleted(missionId);
                }
            }
        }

        LaunchData launchData = puck.GetComponent <LaunchData>();

        if (launchData != null)
        {
            if (hitsPerPlayer.ContainsKey(launchData.Player.DisplayName))
            {
                int currentHitAmount = hitsPerPlayer[launchData.Player.DisplayName];
                hitsPerPlayer[launchData.Player.DisplayName] = currentHitAmount + 1;
            }
            else
            {
                hitsPerPlayer.Add(launchData.Player.DisplayName, 1);
            }
        }

        UpdateLeaderboard();
    }
コード例 #31
0
        private async Task UpdateEventList(ListView listView)
        {
            var json = await GetJsonByApi("events/group/" + _groupId);

            if (json != null)
            {
                _events = JsonConvert.DeserializeObject <List <GetEventModel> >(json);
                if (_events != null)
                {
                    _eventListViewAdabter = new EventList(this, _events);
                    listView.Adapter      = _eventListViewAdabter;
                    listView.ItemClick   += EventClicked;
                }
            }
        }
コード例 #32
0
        internal static void reset()
        {
            foreach (Room room in Rooms)
            {
                foreach (Heater heater in room.Heaters)
                {
                    if (heater.Valve != null)
                    {
                        calibration.deactivateValve(heater.Valve);
                    }
                }
            }

            Rooms = new EventList <Room>();
        }
コード例 #33
0
        public void GivenMultipleEvents_ShouldExecutionActionOnAll()
        {
            var first  = new TestEvent("One");
            var second = new TestEvent("Two");
            var x      = new EventList(first);

            x.Add(second);

            var actuals = new List <IEvent>();

            x.ForEach(e => actuals.Add(e));

            Assert.Contains <IEvent>(first, actuals);
            Assert.Contains <IEvent>(second, actuals);
        }
コード例 #34
0
        ///<summary>
        ///добавить доки/инстанции - только доки
        ///</summary>
        protected void includeButton_Click(object sender, EventArgs e)
        {
            SaveStates();
            if (routeTable != null)
            {
                routeTable.Rows.Clear();
            }

            if (PointList.Count == 0)
            {
                return;
            }

            if (AppList == null)
            {
                AppList = new List <Application>();
            }

            if (EventList == null)
            {
                EventList = new List <RouteEvent>();
            }

            foreach (ListItem item in ApplicationList.Items)
            {
                if (item.Selected)
                {
                    var a = new Application();
                    a.InitApplication(item.Value);

                    foreach (var routePoint in PointList)
                    {
                        var routeEvent = new RouteEvent();
                        routeEvent.InitEvent(a, routePoint);
                        EventList.Add(routeEvent);
                    }

                    AppList.Add(a);
                }
            }

            ApplicationFilterBox.Text = string.Empty;

            FillLists();

            DataBind();
            //BuildRoute();
        }
コード例 #35
0
ファイル: ProjectEvents.ascx.cs プロジェクト: Hennz/StageBitz
        /// <summary>
        /// Adds to event grid.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void AddToEventGrid(object sender, EventArgs e)
        {
            if (!PageBase.StopProcessing)
            {
                if (Page.IsValid)
                {
                    ProjectEvent projectEvent = new ProjectEvent();
                    projectEvent.EventName = txtEvent.Text.Trim();

                    if (EventDate.SelectedDate.HasValue)
                    {
                        projectEvent.EventDate = EventDate.SelectedDate;
                    }

                    projectEvent.CreatedByUserId     = UserID;
                    projectEvent.CreatedDate         = Now;
                    projectEvent.LastUpdatedByUserId = UserID;
                    projectEvent.LastUpdatedDate     = Now;

                    if (ProjectID != 0)
                    {
                        #region Project Notification

                        DataContext.Notifications.AddObject(CreateNotification(Support.GetCodeIdByCodeValue("OperationType", "ADD"), string.Format("{0} added a Project Schedule.", Support.UserFullName)));

                        #endregion Project Notification

                        projectEvent.ProjectId = ProjectID;
                        DataContext.ProjectEvents.AddObject(projectEvent);
                        DataContext.SaveChanges();
                    }
                    else
                    {
                        //Will be used from AddNewProject screen.So Saving will not be done.Instead add to the viewState
                        EventList.Add(projectEvent);
                    }
                    LoadData();
                    btnAddKeyDate.Attributes["disabled"] = "disabled";
                    txtEvent.Text = string.Empty;
                    EventDate.Clear();
                    EventDate.DateInput.Clear();
                    gvEvents.DataBind();
                    upnl.Update();
                }

                txtEvent.Focus();
            }
        }
コード例 #36
0
        public Guid Modify(EventList eventList)
        {
            var productListsId = eventList.ProductList.Select(x => x.Id.Value).ToList();

            return(_eventListRepository.Modify(new
            {
                eventList.Id,
                eventList.OwnerId,
                eventList.Title,
                eventList.Active,
                eventList.Description,
                eventList.Flags,
                eventList.Public,
                ProductListsId = productListsId.ToTvp()
            }));
        }
コード例 #37
0
        public async void SaveToXml()
        {
            XDocument xDoc = new XDocument(
                new XElement("Goal",
                             new XElement("Title", Title),
                             new XElement("EventList", EventList.Select <Event, XElement>((eventItem) => {
                return(eventItem.ToXml());
            }))
                             )
                );

            using (Stream fileStream = await RoamingFolder.OpenStreamForWriteAsync(DataPath, CreationCollisionOption.ReplaceExisting))
            {
                xDoc.Save(fileStream);
            }
        }
コード例 #38
0
ファイル: Statistics.cs プロジェクト: tjnowak/Phase-5
        // Display the average damage caused by tornadoes by state
        public static void showMeanCostPerState(EventList list)
        {
            List <string> damage = new List <string>();             // list of avg tornado damage

            // Calculate average damage per state
            damage = list.CalculateMeanDamagePerState();

            // Display results to user
            Console.WriteLine("\nBelow is a list of the average damage (property + crop)" +
                              " caused by a tornado in each state.\nOnly states with" +
                              " historical tornado records are shown\n");
            foreach (var item in damage)
            {
                Console.WriteLine(item);
            }
        }
コード例 #39
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            tableView.DeselectRow(indexPath, true);
            var item = _listItem[indexPath.Row];

            if (item != null)
            {
                EventList model = new EventList()
                {
                    EventId = item.EventId
                };
                StorageUtils <EventList> .SavePreferences(AppConstant.EventDetail, model);

                CommonUtils.RedirectToController(AppConstant.EventDetailController);
            }
        }
コード例 #40
0
ファイル: EventManager.cs プロジェクト: Obles/vwdaddin
 public void FillEventList(EventList EventList, IEnumerable<short> Events)
 {
     short t = 0;
     //try
     {
         foreach (short eventCode in Events)
         {
             t = eventCode;
             EventList.AddAdvise(eventCode, eventHandler, "", "");
         }
     }
     //catch (Exception err)
     //{
     //    Debug.WriteLine(EventHandler.GetDescription(t));
     //    Debug.WriteLine(err.Message);
     //}
 }
コード例 #41
0
        public override EventList EventNames()
        {
            EventList list = new EventList();
            #region done
            EventListRow row = list.NewEventListRow();
            row.Name = "InstalledFontsChanged";
            row.Text = "Installed fonts changed";
            row.Description = "The user added fonts to or removed fonts from the system.";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "FontAdded";
            row.Text = "Font added";
            row.Description = "The user added a font to the system";
            row.Type = Manager.EventTypes.SingleValue;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "FontRemoved";
            row.Text = "Font removed";
            row.Description = "The user removed a font from the system";
            row.Type = Manager.EventTypes.SingleValue;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "PowerModeChanged";
            row.Text = "Power mode changed";
            row.Description = "The user suspends or resumes the system";
            row.Type = Manager.EventTypes.SingleValue;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "Suspend";
            row.Text = "Suspend";
            row.Description = "The user suspends the system";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "Resume";
            row.Text = "Resume";
            row.Description = "The user resumes the system";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "SessionEnding";
            row.Text = "Session ending";
            row.Description = "The user is trying to log off or shut down the system";
            row.Type = Manager.EventTypes.SingleValue;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "Logoff";
            row.Text = "Log off";
            row.Description = "The user is trying to log off";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "Shutdown";
            row.Text = "Shut down";
            row.Description = "The user is trying to shut down the system";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "SessionSwitch";
            row.Text = "Session switch";
            row.Description = "The currently logged-in user has changed";
            row.Type = Manager.EventTypes.SingleValue;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "ConsoleConnect";
            row.Text = "Console connect";
            row.Description = "A session has been connected from the console";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "ConsoleDisconnect";
            row.Text = "Console disconnect";
            row.Description = "A session has been disconnected from the console";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "RemoteConnect";
            row.Text = "Remote connect";
            row.Description = "A session has been connected from a remote connection";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "RemoteDisconnect";
            row.Text = "Remote disconnect";
            row.Description = "A session has been disconnected from a remote connection";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "SessionLock";
            row.Text = "Session locked";
            row.Description = "A session has been locked";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "SessionLogoff";
            row.Text = "Session logged off";
            row.Description = "A user has logged off from a session";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "SessionLogon";
            row.Text = "Session logged on";
            row.Description = "A user has logged on to a session";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "SessionRemoteControl";
            row.Text = "Session remote controlled mode changed";
            row.Description = "A session has changed its status to or from remote controlled mode";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "SessionUnlock";
            row.Text = "Session unlocked";
            row.Description = "A session has been unlocked";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "PaletteChanged";
            row.Text = "Palette changed";
            row.Description = "The user switched to an application that uses a different palette.";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            #endregion

            row = list.NewEventListRow();
            row.Name = "AAAA";
            row.Text = "AAAA";
            row.Description = "AAAAAAAAAAAAAAA";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "AAAA";
            row.Text = "AAAA";
            row.Description = "AAAAAAAAAAAAAAA";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "AAAA";
            row.Text = "AAAA";
            row.Description = "AAAAAAAAAAAAAAA";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            return list;
        }
コード例 #42
0
ファイル: ReadNewLog.cs プロジェクト: engincancan/utilities
        internal ReadNewLog(string fileName)
        {
            //
            // TODO: Add constructor logic here
            //
            assemblies = new Dictionary<string/*assembly name*/, int/*stack id*/>();
            assembliesJustLoaded = new Dictionary<int/*thread id*/, List<string>>();
            typeName = new string[1000];
            funcName = new string[1000];
            funcSignature = new string[1000];
            funcModule = new int[1000];
            modBasicName = new string[10];
            modFullName = new string[10];
            commentEventList = new EventList();
            gcEventList = new EventList();
            heapDumpEventList = new EventList();
            finalizableTypes = new Dictionary<int/*type id*/,bool>();
            gcCount = new int[4];
            inducedGcCount = new int[3];
            generationSize = new ulong[4];
            cumulativeGenerationSize = new ulong[4];

            this.fileName = fileName;

            this.typeSignatureIdHash = new Dictionary<string/*type name*/, int/*type id*/>();
            this.funcSignatureIdHash = new Dictionary<string/*func name*/, int/*func id*/>();

            this.progressFormVisible = true;
        }
コード例 #43
0
        private EventList LoadEventDocument(IResult result) {
            EventList events = new EventList();

            if (!Common.IsFileAvailable(EventFilePath)) {
                result.Errors.Add(string.Format("File not found: [{0}]", EventFilePath));
            }

            XmlDocument eventXMLDoc = new XmlDocument();            
            eventXMLDoc.Load(EventFilePath);

            XmlNodeList eventNodeList = eventXMLDoc.SelectNodes("/events/event");

            foreach (XmlNode eventNode in eventNodeList) {
                Event evt = new Event();
                evt.EventId = Convert.ToInt32(eventNode.SelectSingleNode("id").InnerText);

                XmlNodeList regionNodeList = eventNode.SelectNodes("region");
                foreach (XmlNode regionNode in regionNodeList) {
                    evt.Regions.Add(Convert.ToInt32(regionNode.InnerText));
                }

                events.Add(evt);
            }

            return events;
        }
コード例 #44
0
	public MainWindow() : base(Gtk.WindowType.Toplevel) {
		Build();

		notebook.CurrentPage = 1;
		volume.Percentage = 70;

		Gdk.Color bk = new Gdk.Color(17, 118, 207);
		Gdk.Color fg = new Gdk.Color(255, 255, 255);
		this.ModifyBg(StateType.Normal, bk);
		this.ModifyFg(StateType.Normal, fg);
		ctlArtwork.ModifyBg(StateType.Normal, bk);
		ctlArtwork.ModifyFg(StateType.Normal, fg);
		ctlDrawingMeta.ModifyBg(StateType.Normal, bk);
		ctlDrawingMeta.ModifyFg(StateType.Normal, fg);
		drawWiFi.ModifyBg(StateType.Normal, bk);
		drawWiFi.ModifyFg(StateType.Normal, fg);
		eventLeft.ModifyBg(StateType.Normal, bk);
		eventLeft.ModifyFg(StateType.Normal, fg);
		eventRight.ModifyBg(StateType.Normal, bk);
		eventRight.ModifyFg(StateType.Normal, fg);
		analogclock.ModifyBg(StateType.Normal, bk);
		analogclock.ModifyFg(StateType.Normal, fg);
		notebook.ModifyBg(StateType.Normal, bk);
		notebook.ModifyFg(StateType.Normal, fg);
		notebook.ModifyBg(StateType.Active, bk);
		notebook.ModifyFg(StateType.Active, fg);
		volume.ModifyBg(StateType.Normal, bk);
		volume.ModifyFg(StateType.Normal, fg);
		labelClockInfo.ModifyBg(StateType.Normal, bk);
		labelClockInfo.ModifyFg(StateType.Normal, fg);
		labelClockInfo.ModifyFont(Pango.FontDescription.FromString("Serif 12"));
		weatherview.ChangeColors(fg, bk);

		loadImages();

		wordList = new List<string>();
		if (File.Exists("missing_words.txt")) {
			FileStream file = new FileStream("missing_words.txt", FileMode.Open, FileAccess.Read);
			StreamReader reader = new StreamReader(file);
			string line = reader.ReadLine();
			while (line != null) {
				wordList.Add(line);
				line = reader.ReadLine();
			}
			reader.Close();
			reader.Dispose();
			file.Close();
			file.Dispose();
		}

		clockEvents = new EventList();
		clockEvents.Load();
		Console.WriteLine("Events ******************");
		foreach (EventItem item in clockEvents.Events) {
			Console.WriteLine("  " + item.Name);
		}
		Console.WriteLine("*************************");
		Console.WriteLine("Loaded " + clockEvents.Events.Count + " events");
		clockAlarms = new AlarmList();
		clockAlarms.Load();
		Console.WriteLine("Alarms ******************");
		foreach (AlarmItem item in clockAlarms.Alarms) {
			Console.WriteLine("  " + item.Name);
		}
		Console.WriteLine("*************************");
		Console.WriteLine("Loaded " + clockAlarms.Alarms.Count + " alarms");

		wireless = new WirelessWrapper();
		wireless.Status += Wireless_Status;

		network = new NetworkWorker();
		network.Start();

		findArtwork = new FindArtwork();
		volumeService = new VolumeService();

		stations = new List<StationInfo>();
		stations.Add(null);
		LoadStations();

		ttsRecordings = new TTSRecordings();
		ttsRecordings.MissingWords += TtsRecordings_MissingWords;
		ttsRecordings.Status += TtsRecordings_Status;

		player = new SoundPlayer();

		radio = new RadioPlayer();
		radio.MetadataReceived += Player_MetadataReceived;

		recognizer = new SpeechRecognition();
		recognizer.StatusChanged += Recognizer_StatusChanged;
		recognizer.Recognized += Recognizer_Recognized;
		//recognizer.LogMessage += Recognizer_LogMessage;
		Console.WriteLine("Starting recognizer");
		recognizer.Start();

		analogclock.TimeChanged += Analogclock_TimeChanged;

		intercomView.Start();
		timedimage.Start();

		timer = new Timer(new TimerCallback(timerTick));
		timer.Change(250, 250);

		background = new Timer(new TimerCallback(backgroundTick));
		background.Change(2000, 2000);
	}
コード例 #45
0
        /// <summary>
        /// <para>Get all events that are provided</para>
        /// </summary>
        /// <returns></returns>
        public override EventList EventNames()
        {
            EventList list = new EventList();

            EventListRow row = list.NewEventListRow();

            return list;
        }
コード例 #46
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public override EventList EventNames()
        {
            EventList list = new EventList();

            EventListRow row = list.NewEventListRow();
            row.Name = "ProcessCreated";
            row.Text = "Process created";
            row.Description = "A new process was created";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            return list;
        }
コード例 #47
0
ファイル: EventsPlugin.cs プロジェクト: TNOCS/csTouch
 void el_Clicked(object sender, EventList.EventClickedArgs e)
 {
     UpdateIcon(envelope);
 }
コード例 #48
0
 public override EventList getEvents() {
   EventList ret = new EventList(bwapiclientPINVOKE.GameImpl_getEvents(swigCPtr), false);
   return ret;
 }
コード例 #49
0
ファイル: ReportEvents.cs プロジェクト: nikola-v/jaustoolset
                public bool isEqual(EventList value)
                {
                    for (int i = 0; i < value.m_ReportEventRec.Count; i++)
                    {
                    if (!this.m_ReportEventRec[i].isEqual(value.m_ReportEventRec[i]))
                    {
                        return false;
                    }
                    }

                    return true;
                }
コード例 #50
0
ファイル: LuaBinding.cs プロジェクト: Jay2645/text-adventure
 /// <summary>
 /// Raises the notify event.
 /// Will call any function bound to the specified EventList.
 /// </summary>
 /// <param name='entity'>
 /// The entity to pass as a parameter.
 /// </param>
 /// <param name='eventType'>
 /// The type of event.
 /// </param>
 public override void OnNotify(object entity, EventList eventType)
 {
     CallLuaFunction (eventType.ToString (), new object[] {
         entity
     }
     );
 }
コード例 #51
0
ファイル: Game.cs プロジェクト: Omnigazer/StarcraftBot
 public virtual EventList getEvents() {
   EventList ret = new EventList(bwapiPINVOKE.Game_getEvents(swigCPtr), false);
   return ret;
 }
コード例 #52
0
ファイル: ReportEvents.cs プロジェクト: nikola-v/jaustoolset
 public bool notEquals(EventList value)
 {
     return !this.isEqual(value);
 }
コード例 #53
0
        private void loadCommands()
        {
            // if the commands text file has been created, load it; otherwise load the defualt commands.
            string fileContents = File.Exists("commands.txt") ? File.ReadAllText("commands.txt") : Properties.Resources.Commands;

            var tempList = new EventList<Command>();

            using (StringReader reader = new StringReader(fileContents))//@"Commands.json"
            {
                JObject o = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
                JArray a = (JArray) o["commands"];
                tempList.AddRange(from JObject variable in a select CommandFactory.CreateCommandFromJson(variable));

            }
            commands = tempList;
            saveCommands();
        }
コード例 #54
0
 public SAPReport()
 {
     _summary = new Summary();
     _steps = new EventList<TestStep>();
 }
コード例 #55
0
ファイル: ReportEvents.cs プロジェクト: nikola-v/jaustoolset
 public void setParent(EventList parent)
 {
     m_parent = parent;
 }
コード例 #56
0
ファイル: Observer.cs プロジェクト: Jay2645/text-adventure
 public abstract void OnNotify(object entity, EventList eventType);
コード例 #57
0
        public static PointPairList ProcessExpression(ref DFLog dflog, ref CollectionBuffer logdata, string expression)
        {
            PointPairList answer = new PointPairList();

            //earth_accel_df(IMU2,ATT).x
            if (expression.Contains("earth_accel_df"))
            {
                var matchs = Regex.Matches(expression, @"([A-z0-9_]+),([A-z0-9_]+)");

                List<string> msglist = new List<string>();

                foreach (Match match in matchs)
                {
                    foreach (var item in match.Groups)
                    {
                        msglist.Add(item.ToString());
                    }
                }

                foreach (var item in logdata.GetEnumeratorType(msglist.ToArray()))
                {
                    IMU imu = new IMU();
                    ATT att = new ATT();

                    if (item.msgtype == "ATT")
                    {
                        ATT.Roll = double.Parse(item.items[dflog.FindMessageOffset("ATT", "Roll")]);
                        ATT.Pitch = double.Parse(item.items[dflog.FindMessageOffset("ATT", "Pitch")]);
                        ATT.Yaw = double.Parse(item.items[dflog.FindMessageOffset("ATT", "Yaw")]);
                    } 
                    else if (item.msgtype == "IMU")
                    {
                        IMU.AccX = double.Parse(item.items[dflog.FindMessageOffset("IMU", "AccX")]);
                        IMU.AccY = double.Parse(item.items[dflog.FindMessageOffset("IMU", "AccY")]);
                        IMU.AccZ = double.Parse(item.items[dflog.FindMessageOffset("IMU", "AccZ")]);
                    }
                    else if (item.msgtype == "IMU2")
                    {
                        IMU.AccX = double.Parse(item.items[dflog.FindMessageOffset("IMU2", "AccX")]);
                        IMU.AccY = double.Parse(item.items[dflog.FindMessageOffset("IMU2", "AccY")]);
                        IMU.AccZ = double.Parse(item.items[dflog.FindMessageOffset("IMU2", "AccZ")]);
                    }

                    if (expression.Contains(".x"))
                    {
                        answer.Add(item.lineno, earth_accel_df(imu, att).x);
                    }
                    if (expression.Contains(".y"))
                    {
                        answer.Add(item.lineno,earth_accel_df(imu, att).y);
                    }
                    if (expression.Contains(".z"))
                    {
                        answer.Add(item.lineno,earth_accel_df(imu, att).z);
                    }
                }
            } // delta(gps_velocity_df(GPS).x,'x',GPS.TimeUS)
            else if (expression.Contains("delta(gps_velocity_df(GPS)"))
            {
                foreach (var item in logdata.GetEnumeratorType("GPS"))
                {
                    var gps = new GPS();

                    if (item.msgtype == "GPS")
                    {
                        GPS.Spd = double.Parse(item.items[dflog.FindMessageOffset("GPS", "Spd")]);
                        GPS.GCrs = double.Parse(item.items[dflog.FindMessageOffset("GPS", "GCrs")]);
                        GPS.VZ = double.Parse(item.items[dflog.FindMessageOffset("GPS", "VZ")]);
                    }

                    if (expression.Contains(".x"))
                    {
                        answer.Add(item.lineno,delta(gps_velocity_df(gps).x, "x", item.timems * 1000));
                    }
                    else if (expression.Contains(".y"))
                    {
                        answer.Add(item.lineno,delta(gps_velocity_df(gps).y, "y", item.timems * 1000));
                    }
                    else if (expression.Contains(".z"))
                    {
                        answer.Add(item.lineno, delta(gps_velocity_df(gps).z, "z", item.timems * 1000) - 9.8);
                    }
                }
            }
            else if (expression.StartsWith("degrees"))
            {
                var matchs = Regex.Matches(expression, @"([A-z0-9_]+)\.([A-z0-9_]+)");

                if (matchs.Count > 0)
                {
                    var type = matchs[0].Groups[1].Value.ToString();
                    var field = matchs[0].Groups[2].Value.ToString();

                    foreach (var item in logdata.GetEnumeratorType(type))
                    {
                        answer.Add(item.lineno, degrees(double.Parse(item.items[dflog.FindMessageOffset(type, field)])));
                    }
                }
            }
            else if (expression.StartsWith("sqrt"))
            {
                // there are alot of assumptions made in this code
                Dictionary<int,double> work = new Dictionary<int, double>();
                List<KeyValuePair<string, string>> types = new EventList<KeyValuePair<string, string>>();

                var matchs = Regex.Matches(expression, @"(([A-z0-9_]+)\.([A-z0-9_]+)\*\*2)");

                if (matchs.Count > 0)
                {
                    foreach (Match match in matchs)
                    {
                        var type = match.Groups[2].Value.ToString();
                        var field = match.Groups[3].Value.ToString();

                        types.Add(new KeyValuePair<string, string>(type,field));
                    }

                    List<string> keyarray = new List<string>();
                    types.ForEach(g => { keyarray.Add(g.Key); });
                    List<string> valuearray= new List<string>();
                    types.ForEach(g => { valuearray.Add(g.Value); });

                    foreach (var item in logdata.GetEnumeratorType(keyarray.ToArray()))
                    {
                        for (int a = 0; a < types.Count; a++)
                        {
                            var key = keyarray[a];
                            var value = valuearray[a];
                            var offset = dflog.FindMessageOffset(key, value);
                            if (offset == -1)
                                continue;
                            work[a] = double.Parse(item.items[offset]);
                        }

                        double workanswer = 0;
                        foreach (var value in work.Values)
                        {
                            workanswer += Math.Pow(value, 2);
                        }
                        answer.Add(item.lineno, Math.Sqrt(workanswer));
                    }
                }
            }

            return answer;
        }
コード例 #58
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public override EventList EventNames()
        {
            EventList list = new EventList();

            EventListRow row = list.NewEventListRow();
            row.Name = "PowerModeChanged";
            row.Text = "Power mode changed";
            row.Description = "The user suspends or resumes the system";
            row.Type = Manager.EventTypes.SingleValue;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "Suspend";
            row.Text = "Suspend";
            row.Description = "The user suspends the system";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            row = list.NewEventListRow();
            row.Name = "Resume";
            row.Text = "Resume";
            row.Description = "The user resumes the system";
            row.Type = Manager.EventTypes.Simple;
            list.AddEventListRow(row);

            return list;
        }
コード例 #59
0
ファイル: ReportEvents.cs プロジェクト: nikola-v/jaustoolset
                public ReportEvents.Body.EventList setEventList(EventList value)
                {
                    m_ReportEventRec.Clear();

                    for (int i = 0; i < value.m_ReportEventRec.Count; i++)
                    {
                    m_ReportEventRec.Add(value.m_ReportEventRec[i]);
                    m_ReportEventRec[i].setParent(this);
                    }

                    return this;
                }
コード例 #60
0
 public void SetCommands(List<Command> commands)
 {
     this.commands = (EventList<Command>)commands;
 }