public void Initalise()
        {
            // Initialise an EventCollection
            collection = new EventCollection();

            // Add four Events in the shape of a square
            Drop drop1 = new Drop();

            drop1.Coordinate = new Coordinate(10, 10, 0);
            collection.Add(drop1);

            Drop drop2 = new Drop();

            drop2.Coordinate = new Coordinate(10, 20, 0);
            collection.Add(drop2);

            Fail fail1 = new Fail();

            fail1.Coordinate = new Coordinate(20, 10, 0);
            collection.Add(fail1);

            Fail fail2 = new Fail();

            fail2.Coordinate = new Coordinate(20, 20, 0);
            collection.Add(fail2);
        }
Ejemplo n.º 2
0
        public MainPageViewModel()
        {
            Culture = CultureInfo.CreateSpecificCulture("en-US");

            // testing all kinds of adding events
            // when initializing collection
            Events = new EventCollection
            {
                [DateTime.Now.AddDays(-3)] = new List <EventModel>(GenerateEvents(10, "Cool")),
            };

            // with add method
            Events.Add(DateTime.Now.AddDays(-1), new List <EventModel>(GenerateEvents(5, "Cool")));

            // with indexer
            Events[DateTime.Now] = new List <EventModel>(GenerateEvents(2, "Boring"));

            Task.Delay(5000).ContinueWith(_ =>
            {
                // indexer - update later
                Events[DateTime.Now] = new ObservableCollection <EventModel>(GenerateEvents(10, "Cool"));

                // add later
                Events.Add(DateTime.Now.AddDays(3), new List <EventModel>(GenerateEvents(5, "Cool")));

                // indexer later
                Events[DateTime.Now.AddDays(10)] = new List <EventModel>(GenerateEvents(10, "Boring"));

                // add later
                Events.Add(DateTime.Now.AddDays(15), new List <EventModel>(GenerateEvents(10, "Cool")));

                Task.Delay(3000).ContinueWith(t =>
                {
                    // get observable collection later
                    var todayEvents = Events[DateTime.Now] as ObservableCollection <EventModel>;

                    // insert/add items to observable collection
                    todayEvents.Insert(0, new EventModel {
                        Name = "Cool event insert", Description = "This is Cool event's description!"
                    });
                    todayEvents.Add(new EventModel {
                        Name = "Cool event add", Description = "This is Cool event's description!"
                    });
                });
            }, TaskScheduler.FromCurrentSynchronizationContext());

            Task.Delay(5000).ContinueWith(_ =>
            {
                SelectedDate = DateTime.Today.AddDays(35).Date;
            });
        }
        public EventEmitter CreateEvent(string name, EventAttributes atts, Type type)
        {
            var eventEmitter = new EventEmitter(this, name, atts, type);

            events.Add(eventEmitter);
            return(eventEmitter);
        }
        public CalendarAlarmClockModel()
        {
            Culture = CultureInfo.CreateSpecificCulture("en-US");
            Events  = new EventCollection();

            Task.Run(async() =>
            {
                var alarmClocks = await App.DbContext.GetAlarmClocksAsync();
                if (alarmClocks != null && alarmClocks.Any())
                {
                    var q = from r in alarmClocks
                            group r by r.AlarmTime.ToString("yyyy-MM-dd") into daysGroup
                            select new
                    {
                        date  = DateTime.Parse(daysGroup.Key),
                        datas = alarmClocks.Where(m => m.AlarmTime.ToString("yyyy-MM-dd") == daysGroup.Key)?.Select(m => new EventModel {
                            Name = m.Name, Description = m.AlarmTime.ToString("yyyy-MM-dd HH:mm:ss")
                        })
                    };

                    foreach (var item in q)
                    {
                        Events.Add(item.date, item.datas?.ToList());
                    }
                }
            }).Wait();
        }
Ejemplo n.º 5
0
        private void CarregarEventos()
        {
            Database database = new Database();

            List <Tarefa> Lista = database.Consultar();

            Events = new EventCollection();
            Lista.OrderBy(a => a.Data);

            DateTime dataAnterior = DateTime.MinValue;

            foreach (Tarefa tarefa in Lista)
            {
                if (dataAnterior.Date == tarefa.Data.Date)
                {
                    continue;
                }
                else
                {
                    ICollection Colecao = Lista.Where <Tarefa>(a => a.Data.Date.Equals(tarefa.Data.Date)).ToList();
                    Events.Add(tarefa.Data.Date, Colecao);

                    dataAnterior = tarefa.Data;
                }
            }
        }
Ejemplo n.º 6
0
        public EventCollection GetGameEvents(SessionToken session)
        {
            var gameSession = gameData.GetSession(session.SessionId);

            if (gameSession == null)
            {
                return(new EventCollection());
            }

            var events          = gameData.GetSessionEvents(gameSession);
            var eventCollection = new EventCollection();

            foreach (var ev in events)
            {
                var gameEvent = ModelMapper.Map(ev);
                if (eventCollection.Revision < gameEvent.Revision)
                {
                    eventCollection.Revision = gameEvent.Revision;
                }
                if (gameEvent.Revision > gameSession.Revision)
                {
                    eventCollection.Add(gameEvent);
                }
            }

            if (eventCollection.Revision > gameSession.Revision)
            {
                gameSession.Revision = eventCollection.Revision;
            }

            return(eventCollection);
        }
        public CustomAppointmentModel()
        {
            // Set the commands for Add/Remove the exception dates.
            this.SetUpCommands();

            // Create the new recurrence exception dates.
            var exceptionDate = new DateTime(2017, 09, 07);
            var recExcepDate2 = new DateTime(2017, 09, 03);
            var recExcepDate3 = new DateTime(2017, 09, 05);

            //Adding schedule appointment in schedule appointment collection
            var recurrenceAppointment = new Meeting()
            {
                ID             = 1,
                From           = new DateTime(2017, 09, 01, 10, 0, 0),
                To             = new DateTime(2017, 09, 01, 12, 0, 0),
                EventName      = "Occurs Daily",
                EventColor     = Color.Blue,
                RecurrenceRule = "FREQ=DAILY;COUNT=20"
            };

            // Add RecuurenceExceptionDates to appointment.
            recurrenceAppointment.RecurrenceExceptionDates = new ObservableCollection <DateTime>()
            {
                exceptionDate,
                recExcepDate2,
                recExcepDate3,
            };

            //Adding schedule appointment in schedule appointment collection
            EventCollection.Add(recurrenceAppointment);
        }
Ejemplo n.º 8
0
        private void AddEvent(string constructorServiceId)
        {
            var newEvent = App.Container.ResolveKeyed <Event>(constructorServiceId);

            EventCollection.Add(newEvent);
            EventList.ScrollIntoView(EventList.Items.LastOrDefault());
            EventList.SelectedItem = newEvent;
        }
Ejemplo n.º 9
0
 public void setEvents(params Entry[] eventsArray)
 {
     events.Clear();
     foreach (Entry e in eventsArray)
     {
         events.Add(e);
     }
     eventsUpdated();
 }
Ejemplo n.º 10
0
        public void Apply(ViewPacket packet)
        {
            Type entityType = null;

            if (!string.IsNullOrEmpty(packet.EntityType))
            {
                foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    entityType = assembly.GetType(packet.EntityType);
                    if (entityType != null)
                    {
                        break;
                    }
                }
            }

            switch (packet.PacketType)
            {
            case ViewPacket.ViewPacketType.CreateEntity:

                var clonedEntity = (Entity)packet.Data.ToObject(entityType);
                clonedEntity.Id = packet.Entity;
                Entities.Add(clonedEntity.Id, clonedEntity);
                break;

            case ViewPacket.ViewPacketType.DestroyEntity:
                Entities.Remove(packet.Entity);
                break;

            case ViewPacket.ViewPacketType.SetFieldValue:

                var targetEntity = Entities[packet.Entity];

                string[] path = packet.FieldPath.Split('.');

                var targetedEventWrapper = targetEntity.SyncedObjects.Where(s => s.Key == path[0]).First().Value;

                for (int i = 1; i < path.Length; i++)
                {
                    if (targetedEventWrapper is IEventCollection <string, ISyncField> collection)
                    {
                        targetedEventWrapper = collection[path[i]];
                    }
                    else
                    {
                        throw new InvalidOperationException("Something went wrong!");
                    }
                }

                if (targetedEventWrapper is IEventField field)
                {
                    object newValue = packet.Data.ToObject(entityType);
                    field.SetValue(newValue);
                }
                break;
            }
        }
Ejemplo n.º 11
0
        protected void Page_InitComplete(object src, EventArgs args)
        {
            EventCollection.Add(EventSource.Page, "InitComplete");

            /* NOTE: Самое раннее безопасное место для установки обработчиков событий для элементов управления
             * Counter.Count +=
             * (sender, eventArgs) =>
             *    EventCollection.Add(EventSource.Page, string.Format("Control - Counter: {0}", eventArgs.Counter));*/
        }
Ejemplo n.º 12
0
        public static EventCollection CopyEvents(EventCollection events)
        {
            EventCollection newEvents = new EventCollection(events.HostFormEntity, events.HostEntity);

            foreach (EventBase _event in events)
            {
                newEvents.Add(EventFactory.GetEventDevByXml(_event.ToXml()));
            }
            return(newEvents);
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EventCollection.Add(EventSource.Control, "PreRender");
            int count;

            Session["counter"] = count = ((int)(Session["counter"] ?? 0)) + 1;
            OnCount(new ViewCounterEventArgs {
                Counter = count
            });
        }
        public void Initalise()
        {
            // Initialise an EventCollection
              collection = new EventCollection();

              // Add four Events in the shape of a square
              Drop drop1 = new Drop();
              drop1.Coordinate = new Coordinate(10, 10, 0);
              collection.Add(drop1);

              Drop drop2 = new Drop();
              drop2.Coordinate = new Coordinate(10, 20, 0);
              collection.Add(drop2);

              Fail fail1 = new Fail();
              fail1.Coordinate = new Coordinate(20, 10, 0);
              collection.Add(fail1);

              Fail fail2 = new Fail();
              fail2.Coordinate = new Coordinate(20, 20, 0);
              collection.Add(fail2);
        }
        public void AddEventTest()
        {
            // Ensure there are four elements before starting
            Assert.AreEqual(4, collection.Count);

            // Add a new coordiante
            Drop drop = new Drop();

            drop.Coordinate = new Coordinate(0, 0, 0);
            collection.Add(drop);

            // Test to ensure the count has gone up.
            Assert.AreEqual(5, collection.Count);
        }
        private void InitEventsInCalendar()
        {
            Events = new EventCollection();

            using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.DB_PATH))
            {
                conn.CreateTable <Photo>();

                var photos = conn.Table <Photo>().ToList();

                if (photos.Count <= 0)
                {
                    return;
                }

                var days = (from table in conn.Table <Photo>()
                            select table.CreatedOn).Distinct().ToList();

                foreach (var day in days)
                {
                    List <EventModel> list = new List <EventModel>();

                    foreach (var photoObj in photos)
                    {
                        if (photoObj.CreatedOn == day)
                        {
                            var tagName = conn.Table <Tag>().SingleOrDefault(t => t.Id == photoObj.TagId).Name;

                            if (string.IsNullOrEmpty(tagName))
                            {
                                tagName = "undefined?";
                            }

                            EventModel eventModel = new EventModel()
                            {
                                Tag         = tagName,
                                ImagePath   = photoObj.Path,
                                ClumpedData = photoObj.Path + "|" + tagName
                            };

                            list.Add(eventModel);
                        }
                    }
                    Events.Add(day, list);
                }
            }

            calendarRef.Events = Events;
        }
        public void UpdateCentroidTest()
        {
            // Setup a new Collection
            EventCollection col = new EventCollection();

            // Check the centroid has been initalised
            Assert.AreEqual(0, col.Centroid.Latitude);
            Assert.AreEqual(0, col.Centroid.Latitude);
            Assert.AreEqual(0, col.Centroid.Altitude);

            // Add four Events in the shape of a square
            Drop drop1 = new Drop();

            drop1.Coordinate = new Coordinate(10, 10, 0);
            col.Add(drop1);

            Drop drop2 = new Drop();

            drop2.Coordinate = new Coordinate(10, 20, 0);
            col.Add(drop2);

            Fail fail1 = new Fail();

            fail1.Coordinate = new Coordinate(20, 10, 0);
            col.Add(fail1);

            Fail fail2 = new Fail();

            fail2.Coordinate = new Coordinate(20, 20, 0);
            col.Add(fail2);

            // Check the centroid has been updated
            Assert.AreEqual(15, col.Centroid.Longitude);
            Assert.AreEqual(15, col.Centroid.Latitude);
            Assert.AreEqual(0, col.Centroid.Altitude);
        }
Ejemplo n.º 18
0
 private void OnAdd()
 {
     AddMode        = true;
     CanEditFields  = true;
     CanUseDatagrid = false;
     SelectedEvent  = new EventModel
     {
         Description    = "",
         AudioLocation  = "",
         PlayerLocation = Global.PlayerLocation,
         Date           = DateTime.Now.Date,
         IsChecked      = false,
         StartTime      = new TimeSpan(0, 0, 0)
     };
     EventCollection.Add(SelectedEvent);
 }
Ejemplo n.º 19
0
 private EventCollection GenerateCluster(double latlower, double latupper, double longlower, double longupper, int size)
 {
     // Initalise a new EventCollection
       EventCollection collection = new EventCollection();
       // Initalise a new Random number generator
       Random random = new Random();
       // Create size number of Coordinates
       for (int i = 0; i < size; i++)
       {
     // Generate a Longitude
     double longitude = random.NextDouble() * (longupper - longlower) + longlower;
     // Generate a Latitude
     double latitude = random.NextDouble() * (latupper - latlower) + latlower;
     // Setup a Test Event - it doesn't matter if its a drop, failure or success
     Drop evt = new Drop();
     evt.Coordinate = new Coordinate(longitude, latitude);
     // Add to the collection
     collection.Add(evt);
       }
       // return the collection of events
       return collection;
 }
Ejemplo n.º 20
0
        public async Task <EventCollection> GetGameEventsAsync(
            SessionToken session)
        {
            using (var db = dbProvider.Get())
            {
                var gameSession = await db.GameSession.FirstOrDefaultAsync(x => x.Id == session.SessionId);

                if (gameSession == null)
                {
                    return(new EventCollection());
                }

                var sessionRevision = gameSession.Revision ?? 0;
                var events          = await db.GameEvent.Where(x =>
                                                               x.GameSessionId == session.SessionId &&
                                                               x.Revision > sessionRevision).ToListAsync();

                var eventCollection = new EventCollection();

                foreach (var ev in events)
                {
                    var gameEvent = ModelMapper.Map(ev);
                    if (eventCollection.Revision < gameEvent.Revision)
                    {
                        eventCollection.Revision = gameEvent.Revision;
                    }
                    eventCollection.Add(gameEvent);
                }

                if (eventCollection.Revision > sessionRevision)
                {
                    gameSession.Revision = eventCollection.Revision;
                    db.Update(gameSession);
                    await db.SaveChangesAsync();
                }

                return(eventCollection);
            }
        }
Ejemplo n.º 21
0
        public EventCollection GetGameEvents(SessionToken session)
        {
            var gameSession = gameData.GetSession(session.SessionId);

            if (gameSession == null)
            {
                return(new EventCollection());
            }

            var events = gameData.GetSessionEvents(gameSession).ToList();

            if (events == null || events.Count == 0)
            {
                events = gameData.GetUserEvents(gameSession.UserId).ToList();
            }

            var eventCollection = new EventCollection();

            foreach (var ev in events)
            {
                var gameEvent = ModelMapper.Map(ev);
                if (eventCollection.Revision < gameEvent.Revision)
                {
                    eventCollection.Revision = gameEvent.Revision;
                }

                //if (gameEvent.Revision > gameSession.Revision)
                eventCollection.Add(gameEvent);
                gameData.Remove(ev);
            }

            //if (eventCollection.Revision > gameSession.Revision)
            //{
            //    gameSession.Revision = eventCollection.Revision;
            //}

            return(eventCollection);
        }
Ejemplo n.º 22
0
        private EventCollection GenerateCluster(double latlower, double latupper, double longlower, double longupper, int size)
        {
            // Initalise a new EventCollection
            EventCollection collection = new EventCollection();
            // Initalise a new Random number generator
            Random random = new Random();

            // Create size number of Coordinates
            for (int i = 0; i < size; i++)
            {
                // Generate a Longitude
                double longitude = random.NextDouble() * (longupper - longlower) + longlower;
                // Generate a Latitude
                double latitude = random.NextDouble() * (latupper - latlower) + latlower;
                // Setup a Test Event - it doesn't matter if its a drop, failure or success
                Drop evt = new Drop();
                evt.Coordinate = new Coordinate(longitude, latitude);
                // Add to the collection
                collection.Add(evt);
            }
            // return the collection of events
            return(collection);
        }
Ejemplo n.º 23
0
        private void InitCalendar()
        {
            var updates = new List <Update>();

            Task.Run(async() =>
            {
                updates = await _updatesRepository.GetEnrolledUpdates();
            }).Wait();


            Dictionary <DateTime, List <Update> > groupedUpdates =
                updates
                .GroupBy(k => k.Deadline)
                .OrderByDescending(k => k.Key)
                .ToDictionary(k => k.Key, v => v.OrderByDescending(x => x.Deadline).ToList());

            Events = new EventCollection();
            foreach (var date in groupedUpdates)
            {
                var key = date.Key;
                Events.Add(key, groupedUpdates[key]);
            }
        }
Ejemplo n.º 24
0
 protected void Page_Init(object sender, EventArgs e)
 {
     EventCollection.Add(EventSource.Control, "Init");
 }
Ejemplo n.º 25
0
 protected void Application_Start(object sender, EventArgs e)
 {
     EventCollection.Add(EventSource.Application, "Start");
 }
Ejemplo n.º 26
0
 protected void Application_End(object sender, EventArgs e)
 {
     EventCollection.Add(EventSource.Application, "End");
 }
Ejemplo n.º 27
0
 protected void Application_PostRequestHandlerExecute(object sender, EventArgs e)
 {
     EventCollection.Add(EventSource.Application, "PostRequestHandlerExecute");
 }
Ejemplo n.º 28
0
 protected void Application_BeginRequest(object sender, EventArgs e)
 {
     EventCollection.Add(EventSource.Application, "BeginRequest");
 }
Ejemplo n.º 29
0
 /// <summary>
 /// This method will return all coordinates within C's eps-neighbourhood.
 /// </summary>
 /// <param name="c">The centroid coordinate</param>
 /// <returns>A list of neighbouring coordinates</returns>
 private EventCollection GetRegion(Event evt)
 {
     // Collection of neighbouring coordinates
       EventCollection neighbours = new EventCollection();
       // Square the Epsilon (radius) to get the diameter of the neighbourhood
       double eps = Epsilon * Epsilon;
       // Loop over all coordinates
       foreach (Event neighbour in Calls)
       {
     // Calculate the distance of the two coordinates
     double distance = Distance.haversine(evt.Coordinate, neighbour.Coordinate);
     // Class as a neighbour if it falls in the 'catchment area'
     if (eps >= distance)
     {
       neighbours.Add(neighbour);
     }
       }
       return neighbours;
 }
Ejemplo n.º 30
0
        /// <summary>
        /// This method is the main entry point for initalising the DBSCAN algorithm. The results of 
        /// the analysis are put into the Clusters List found as a member variable within this class. 
        /// Any coordinates that are deduced as noise, are added into the Noise Coordinate Collection, 
        /// found as a member variable within this class.
        /// The method will initially for N number of times, where N is the number of coordinates within 
        /// the Coordinates Collection. The N value does not take visiting neighbouring coordinates into 
        /// consideration, so the number of passes will be larger.
        /// </summary>
        public void Analyse()
        {
            // Setup the final data stores
              Clusters = new List<EventCollection>();
              Noise = new EventCollection();
              Noise.Name = "Noisy Clusters";
              Noise.Noise = true;

              // Place each coordinate into a cluster or deduce it as noise
              int clusterId = 1;
              foreach (Event evt in Calls)
              {
            if (!evt.Coordinate.Classified && ExpandCluster(evt, clusterId))
            {
              clusterId++;
            }
              }

              // Group all of the coordinates as either Noise or as part of it's respected cluster
              foreach (Event evt in Calls)
              {
            if (evt.Coordinate.Noise)
            {
              Noise.Add(evt);
            }
            else if (evt.Coordinate.Classified)
            {
              // Decrement the Cluster ID by 1 to make use of index 0 of the final list
              int index = evt.Coordinate.ClusterId - 1;

              // Setup the Cluster if it doesn't already exist (any any previous to this)
              InitaliseClusters(index);

              Clusters[index].Add(evt);
            }
              }

              // Remove any unrequired (empty) clusters
              CleanClusters();
        }
Ejemplo n.º 31
0
 protected void Page_PreInit(object src, EventArgs args)
 {
     EventCollection.Add(EventSource.Page, "PreInit");
 }
Ejemplo n.º 32
0
 protected void Page_Unload(object sender, EventArgs e)
 {
     EventCollection.Add(EventSource.Control, "Unload");
 }
Ejemplo n.º 33
0
        public EventCollection SelectEventsWithConstrain(string procedureName)
        {
            OpenConnection();
            var dynamic = new DynamicParameters();
            dynamic.Add(Constants.SDate, Modal.StartDT);
            dynamic.Add(Constants.EDate, Modal.EndDT);
            EventCollection lists = new EventCollection();
            DbConnection.Query<EventTableModal, UpdaterDetailTableModal, EventCollection>(procedureName, (eventTable, updateTable) =>
            {
                eventTable.UpdateModal = updateTable;
                lists.Add(eventTable);
                return lists;
            }, dynamic, splitOn: "CreatedById",
            commandType: CommandType.StoredProcedure);

            CloseConnection();
            return lists;
        }
Ejemplo n.º 34
0
 public EventCollection SelectEvents(string procedureName)
 {
     OpenConnection();
     EventCollection lists = new EventCollection();
     DbConnection.Query<EventTableModal, UpdaterDetailTableModal, EventCollection>(procedureName, (eventTable, updateTable) =>
     {
         eventTable.UpdateModal = updateTable;
         lists.Add(eventTable);
         return lists;
     }, splitOn: "CreatedById",
     commandType: CommandType.StoredProcedure);
     CloseConnection();
     return lists;
 }
        public void UpdateCentroidTest()
        {
            // Setup a new Collection
              EventCollection col = new EventCollection();

              // Check the centroid has been initalised
              Assert.AreEqual(0, col.Centroid.Latitude);
              Assert.AreEqual(0, col.Centroid.Latitude);
              Assert.AreEqual(0, col.Centroid.Altitude);

              // Add four Events in the shape of a square
              Drop drop1 = new Drop();
              drop1.Coordinate = new Coordinate(10, 10, 0);
              col.Add(drop1);

              Drop drop2 = new Drop();
              drop2.Coordinate = new Coordinate(10, 20, 0);
              col.Add(drop2);

              Fail fail1 = new Fail();
              fail1.Coordinate = new Coordinate(20, 10, 0);
              col.Add(fail1);

              Fail fail2 = new Fail();
              fail2.Coordinate = new Coordinate(20, 20, 0);
              col.Add(fail2);

              // Check the centroid has been updated
              Assert.AreEqual(15, col.Centroid.Longitude);
              Assert.AreEqual(15, col.Centroid.Latitude);
              Assert.AreEqual(0, col.Centroid.Altitude);
        }
Ejemplo n.º 36
0
 protected override void Render(HtmlTextWriter writer)
 {
     EventCollection.Add(EventSource.Control, "Render");
     base.Render(writer);
 }
Ejemplo n.º 37
0
        public AdvancedPageViewModel() : base()
        {
            Culture = CultureInfo.CreateSpecificCulture("en-GB");

            // testing all kinds of adding events
            // when initializing collection
            Events = new EventCollection
            {
                [DateTime.Now.AddDays(-3)] = new List <AdvancedEventModel>(GenerateEvents(10, "Cool")),
                [DateTime.Now.AddDays(-6)] = new DayEventCollection <AdvancedEventModel>(Color.Purple, Color.Purple)
                {
                    new AdvancedEventModel {
                        Name = "Cool event1", Description = "This is Cool event1's description!", Starting = new DateTime()
                    },
                    new AdvancedEventModel {
                        Name = "Cool event2", Description = "This is Cool event2's description!", Starting = new DateTime()
                    }
                }
            };

            //Adding a day with a different dot color
            Events.Add(DateTime.Now.AddDays(-2), new DayEventCollection <AdvancedEventModel>(GenerateEvents(10, "Cool"))
            {
                EventIndicatorColor = Color.Blue, EventIndicatorSelectedColor = Color.Blue
            });
            Events.Add(DateTime.Now.AddDays(-4), new DayEventCollection <AdvancedEventModel>(GenerateEvents(10, "Cool"))
            {
                EventIndicatorColor = Color.Green, EventIndicatorSelectedColor = Color.White
            });
            Events.Add(DateTime.Now.AddDays(-5), new DayEventCollection <AdvancedEventModel>(GenerateEvents(10, "Cool"))
            {
                EventIndicatorColor = Color.Orange, EventIndicatorSelectedColor = Color.Orange
            });

            // with add method
            Events.Add(DateTime.Now.AddDays(-1), new List <AdvancedEventModel>(GenerateEvents(5, "Cool")));

            // with indexer
            Events[DateTime.Now] = new List <AdvancedEventModel>(GenerateEvents(2, "Boring"));

            MonthYear = MonthYear.AddMonths(1);

            Task.Delay(5000).ContinueWith(_ =>
            {
                // indexer - update later
                Events[DateTime.Now] = new ObservableCollection <AdvancedEventModel>(GenerateEvents(10, "Cool"));

                // add later
                Events.Add(DateTime.Now.AddDays(3), new List <AdvancedEventModel>(GenerateEvents(5, "Cool")));

                // indexer later
                Events[DateTime.Now.AddDays(10)] = new List <AdvancedEventModel>(GenerateEvents(10, "Boring"));

                // add later
                Events.Add(DateTime.Now.AddDays(15), new List <AdvancedEventModel>(GenerateEvents(10, "Cool")));


                Task.Delay(3000).ContinueWith(t =>
                {
                    MonthYear = MonthYear.AddMonths(-2);

                    // get observable collection later
                    var todayEvents = Events[DateTime.Now] as ObservableCollection <AdvancedEventModel>;

                    // insert/add items to observable collection
                    todayEvents.Insert(0, new AdvancedEventModel {
                        Name = "Cool event insert", Description = "This is Cool event's description!", Starting = new DateTime()
                    });
                    todayEvents.Add(new AdvancedEventModel {
                        Name = "Cool event add", Description = "This is Cool event's description!", Starting = new DateTime()
                    });
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Ejemplo n.º 38
0
        /// <summary>
        /// This method will return an event collection of events from the given KML 
        /// file in the constructor of this object.
        /// </summary>
        /// <returns>A collection of events</returns>
        public EventCollection GetCallLogs()
        {
            EventCollection calls = new EventCollection();
              while (reader.Read())
              {
            // Get the Coordinate
            Coordinate coordinate = ReadCoordinate();

            // Move to the ExtendedData Space
            reader.ReadToNextSibling("ExtendedData");

            //Get the additional data elements
            String device = GetSimpleData("device");
            String pin = GetSimpleData("pin");
            String timestamp = GetSimpleData("timestamp");
            String reference = GetSimpleData("reference");
            String type = GetSimpleData("type");
            String start_rat = GetSimpleData("start_rat");
            String end_rat = GetSimpleData("end_rat");
            String start_mix_band = GetSimpleData("start_mix_band");
            String end_mix_band = GetSimpleData("end_mix_band");
            String start_rrc_state = GetSimpleData("start_rrc_state");

            // Create a new Call Log Object
            Event callLog = null;

            // Force the call log to be a type
            switch (type)
            {
              case "Call Drop":
            callLog = new Drop();
            break;

              case "Setup Failure":
            callLog = new Fail();
            break;

              case "Call Success":
            callLog = new Success();
            break;

              default:
            break;
            }

            // Add additional attributes & add to the list
            if (callLog != null)
            {
              callLog.Device = device;
              callLog.Pin = pin;
              callLog.Timestamp = DateTime.Parse(timestamp);
              callLog.Reference = Boolean.Parse(reference);
              callLog.StartRat = start_rat;
              callLog.EndRat = end_rat;
              callLog.StartMixBand = start_mix_band;
              callLog.EndMixBand = end_mix_band;
              callLog.StartRRCState = start_rrc_state;
              callLog.Coordinate = coordinate;

              calls.Add(callLog);
            }
              }

              return calls;
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Gets the app events from the DTO objects. Returns an empty collection if no events.
        /// </summary>
        /// <param name="eventDtos">An enumerable object containing the app event data transfer objects.</param>
        /// <returns>Returns an <see cref="IEventCollection" />.</returns>
        private static IEventCollection GetEventsFromDtos(IEnumerable<EventDto> eventDtos)
        {
            var events = new EventCollection();

            try
            {
                foreach (var ev in eventDtos)
                {
                    events.Add(new Event(ev.EventId,
                        ev.EventType,
                        ev.FKGalleryId,
                        ev.TimeStampUtc,
                        ev.ExType,
                        ev.Message,
                        Deserialize(ev.EventData),
                        ev.ExSource,
                        ev.ExTargetSite,
                        ev.ExStackTrace,
                        ev.InnerExType,
                        ev.InnerExMessage,
                        ev.InnerExSource,
                        ev.InnerExTargetSite,
                        ev.InnerExStackTrace,
                        Deserialize(ev.InnerExData),
                        ev.Url,
                        Deserialize(ev.FormVariables), Deserialize(ev.Cookies), Deserialize(ev.SessionVariables), Deserialize(ev.ServerVariables)));
                }
            }
            catch (InvalidOperationException ex)
            {
                if (ex.Source.Equals("System.Data.SqlServerCe"))
                {
                    // We hit the SQL CE bug described here: http://connect.microsoft.com/SQLServer/feedback/details/606152
                    // Clear the table.
                    var sqlCeController = new SqlCeController(GetConnectionStringSettings().ConnectionString);

                    sqlCeController.ClearEventLog();

                    events.Clear();
                }
                else throw;
            }

            return events;
        }