Ejemplo n.º 1
0
        public EventViewModel()
        {
            EventCatalogSingleton = EventCatalogSingleton.Instance;
            EventHandler          = new Handler.EventHandler(this);
            DateTime dt = System.DateTime.Now;

            date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            EventCatalogSingleton.LoadEventsAsync();
        }
Ejemplo n.º 2
0
        public EventViewModel()

        {
            EventHandler = new Handler.EventHandler(this);
            //EventHandler.LoadEvents();
            //_createEventCommand = new RelayCommand(EventHandler.CreateEvent);
            CreateEvent = new RelayCommand(EventHandler.CreateEvent);
            //RemoveEvent = new RelayCommand(EventHandler.RemoveEvent);
            _deleteEventCommand = new RelayCommand(EventHandler.RemoveEvent);
        }
Ejemplo n.º 3
0
        public EventViewModel()
        {
            _eventCatalogSingleton = EventCatalogSingleton.Instance;
            EventHandler           = new Handler.EventHandler(this);
            _createEventCommand    = new RelayCommand(EventHandler.CreateEvent);
            _deleteEventCommand    = new RelayCommand(EventHandler.DeleteEvent);
            DateTime dt = DateTime.Now;

            _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
        }
Ejemplo n.º 4
0
        //contructor
        public EventViewModel()
        {
            _allEvents = EventCatalogSingleton.Instance.GetList;
            DateTime dt = System.DateTime.Now;

            _date              = new DateTimeOffset(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Millisecond, new TimeSpan());
            _time              = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            _eventHandler      = new Handler.EventHandler(this);
            CreateEventCommand = new RelayCommand(CreateEventMethod);
            DeleteEventCommand = new RelayCommand(DeleteEventMethod);
        }
Ejemplo n.º 5
0
        public EventViewModel()
        {
            _events = EventCalalogSingleton.Instance;
            DateTime dt = System.DateTime.Now;

            Date               = new DateTimeOffset(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0, 0, new TimeSpan());
            Time               = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            _eventhandler      = new Handler.EventHandler(this);
            CreateEventCommand = new RelayCommand(CreateEvent);
            SaveEventCommand   = new RelayCommand(SaveEvent);
        }
Ejemplo n.º 6
0
        public EventViewModel()
        {
            EventCatalog = EventCatalogSingleton.Instance;
            EventHandler = new Handler.EventHandler(this);

            Date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            Time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

            CreateEventCommand = new RelayCommand(EventHandler.CreateEvent);
            SelectedEvent      = new Event();
            DeleteEventCommand = new RelayCommand(EventHandler.DeleteEvent);
        }
Ejemplo n.º 7
0
        public EventViewModel()
        {
            EventCatalogSingleton = EventCatalogSingleton.Instance;
            EventCatalogSingleton.ObservableCollection.CollectionChanged += EventsCollection_CollectionChanged;
            var dt = DateTime.Now;

            Date                = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            Time                = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            EventHandler        = new Handler.EventHandler(this);
            _createEventCommand = new RelayCommand(EventHandler.CreateEvent);
            _deleteEventCommand = new RelayCommand(EventHandler.DeleteEvent);
            SelectedEventIndex  = -1;
        }
Ejemplo n.º 8
0
        public EventViewModel()
        {
            DateTime dt = System.DateTime.Now;

            _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

            EventList = EventCatalogSingleton.Instance.Events;

            eh = new Handler.EventHandler(this);
            CreateEventCommand = new RelayCommand(eh.CreateEvent, null);
            DeleteEventCommand = new RelayCommand(eh.DeleteEvent, IfEventListIsEmpty);
        }
        public EventViewModel()
        {
            EventCatalog = EventCatalogSingleton.Instance;
            DateTime dt = System.DateTime.Now;

            Date               = new DateTimeOffset(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0, 0, new TimeSpan());
            Time               = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            EventHandler       = new Handler.EventHandler(this);
            CreateEventCommand = new RelayCommand(EventHandler.CreateEvent);
            //DeleteEventCommand= new RelayCommand(EventHandler.DeleteEvent);
            //SelectEventCommand = new RelayCommand(EventHandler.SetSelectedEvent());
            //EventCatalogSingleton.Instance.events.Clear();
            //EventCatalogSingleton.Instance.LoadEventsAsync();
        }
Ejemplo n.º 10
0
        public EventViewModel()
        {
            DateTime dt = System.DateTime.Now;
            date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0,0,0,0, new TimeSpan());
            time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

            EventHandler = new Handler.EventHandler(this);
            
            createEventCommand = new RelayCommand(EventHandler.CreateEvent,null);
            deleteEventCommand = new RelayCommand(EventHandler.DeleteEvent,IsEventEmpty);
            restoreEventCommand = new RelayCommand(EventHandler.RestoreEvent,IsEventsRestoreEmpty);
            deleteEventForeverCommand = new RelayCommand(EventHandler.DeleteEventForGood,IsEventsRestoreEmpty);

            EventCatalogSingleton = EventCatalogSingleton.Instance;
        }
Ejemplo n.º 11
0
        public EventViewModel()
        {
            _id                 = Id;
            _name               = Name;
            _description        = Description;
            _place              = Place;
            _date               = Date;
            _time               = Time;
            _createEventCommand = new RelayCommand(EventHandler.CreateEvent);
            DateTime dt = System.DateTime.Now;

            _date        = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            _time        = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            EventHandler = new Handler.EventHandler(this);
        }
        public EventViewModel()
        {
            MyCatalogSingleton = EventCatalogSingleton.GetInstance();
            DateTime dateTime = DateTime.Now;
            _date = new DateTimeOffset(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0, 0, new TimeSpan());
            _time = new TimeSpan(dateTime.Hour, dateTime.Minute, dateTime.Second);

            EventHandler = new Handler.EventHandler(this);

            _createEventCommand = new RelayCommand(EventHandler.CreateEvent);

            _deleteEventCommand = new RelayCommand(EventHandler.DeleteEvent);


        }
Ejemplo n.º 13
0
        //public ICommand DisplaySelectedEventCommand { get; set; }

        //private Event _selectedEvent;

        //public Event SelectedEvent
        //{
        //    get { return _selectedEvent; }
        //    set { _selectedEvent = value; OnPropertyChanged(nameof(SelectedEvent)); }
        //}



        public EventViewModel()
        {
            DateTime dt = System.DateTime.Now;

            _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

            EventList = EventCatalogSingleton.Instance.EventList;

            TilmeldList = TilmeldSingleton.Instance.TilmeldList;

            eh = new Handler.EventHandler(this);
            CreateEventCommand   = new RelayCommand(eh.CreateEvent, null);
            CreateTilmeldCommand = new RelayCommand(eh.CreateTilmeld, null);
            // DisplaySelectedEventCommand = new RelayCommand(eh.DisplaySelectedEvent, null);
        }
Ejemplo n.º 14
0
        public EventViewModel()
        {
            DateTime dt = System.DateTime.Now;

            Date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0, 0, new TimeSpan());
            Time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

            EventCatalogSingleton = EventCatalogSingleton.Instance;

            EventHandler = new Handler.EventHandler(this);

            CreateEventCommand = new RelayCommand(EventHandler.CreateEvent);

            CheckExpireCommand = new RelayCommand(EventHandler.ExpireCheck);

            FilteredList = EventCatalogSingleton.Events;
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            Console.WriteLine("Synchronization service started @{0}.", DateTime.Now);

            try
            {
                while (true)
                {
                    using (EventDBEntities _dbContext = new EventDBEntities())
                    {
                        Handler.EventHandler handler = new Handler.EventHandler();
                        List <Event>         unSynchronizedEvents = _dbContext.Event.Where(t => !t.Synchronized && t.FailedTimes < 3).OrderBy(t => t.Id).ToList();
                        if (unSynchronizedEvents.Count > 0)
                        {
                            foreach (Event @event in unSynchronizedEvents)
                            {
                                try
                                {
                                    Assembly assembly = Assembly.Load("Events");
                                    Type     type     = assembly.GetType(@event.EventType);
                                    object   obj      = JsonConvert.DeserializeObject(@event.Data, type);
                                    handler.Handle(obj);
                                    @event.Synchronized = true;

                                    Console.WriteLine("AggregateRootId:{0},EventType:{1},Version:{2}", @event.AggregateRootId, @event.EventType, @event.Version);
                                }
                                catch (Exception ex)
                                {
                                    @event.FailedTimes++;
                                    @event.FailedReason = ex.Message;
                                }

                                _dbContext.Entry(@event).State = EntityState.Modified;
                                _dbContext.SaveChanges();
                            }
                        }

                        Thread.Sleep(5000); //每隔5秒执行一次
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 16
0
        public EventViewModel()
        {
            EventHandler = new Handler.EventHandler(this);

            EventList = EventCatalogSingleTon.Instance.Events;
            DateTime dt = System.DateTime.Now;

            _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0, 0, new TimeSpan());
            _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);


            DeleteEventCommand         = new RelayCommand(EventHandler.DeleteEvent, null);
            CreateEventCommand         = new RelayCommand(EventHandler.CreateEvent, null);
            ReturnCommand              = new RelayCommand(EventHandler.ReturnMethod, null);
            UpdateEventCommand         = new RelayCommand(UpdateEventMethod, null);
            GoToCreateEventPageCommand = new RelayCommand(GoToCreateEventPageMethod, null);
            OnPropertyChanged(nameof(EventList));
        }
Ejemplo n.º 17
0
        // Constructor
        public EventViewModel()
        {
            //Initializes Date and Time with some values that are bound to controls.
            DateTime dt = System.DateTime.Now;
            _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

            EventCatalogSingleton = EventCatalogSingleton.getInstance();
            EventHandler = new Handler.EventHandler(this);

            // Creates an instance of the RelayCommand and passes the CreateEvent method as a parameter
            _createEventCommand = new RelayCommand(EventHandler.CreateEvent);

            _deleteEventCommand = new RelayCommand(EventHandler.GetDeleteConfirmationAsync);

            _enableOrNotCommand = new RelayCommand(EventHandler.EnableOrNot);

            // Assigns a unique Id to each newly created event. TODO Not working correctly
            Id = System.Threading.Interlocked.Increment(ref IdCounter);
        }
Ejemplo n.º 18
0
        public EventViewModel()
        {
            _events = new ObservableCollection <Event>();
            EventCatalogSingleton = EventCatalogSingleton.Instance;
            EventHandler          = new Handler.EventHandler(this);

            DateTime dt = System.DateTime.Now;

            Date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, 0, new TimeSpan());
            Time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

            EventCategories = new ObservableCollection <EventCategory>();
            EventCategories.Add(new EventCategory("Wedding", new Uri("ms-appx:///Assets/wedding.jpg")));
            EventCategories.Add(new EventCategory("Birthday", new Uri("ms-appx:///Assets/birthday.jpg")));
            EventCategories.Add(new EventCategory("Thanksgiving", new Uri("ms-appx:///Assets/Thanksgiving.jpg")));
            EventCategories.Add(new EventCategory("Halloween", new Uri("ms-appx:///Assets/halloween.jpg")));
            EventCategories.Add(new EventCategory("Valentines Day", new Uri("ms-appx:///Assets/valentinesDay.png")));
            EventCategories.Add(new EventCategory("New Years Eve", new Uri("ms-appx:///Assets/NewYearsEve.jpg")));
            EventCategories.Add(new EventCategory("Bachelorette Party", new Uri("ms-appx:///Assets/bachelorette.jpg")));
            EventCategories.Add(new EventCategory("Confirmation", new Uri("ms-appx:///Assets/Confirmation.png")));
        }
Ejemplo n.º 19
0
        public EventViewModel()
        {
            DateTime dt = System.DateTime.Now;

            _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            EHandler = new Handler.EventHandler(this);

            EventCatalog.LoadEvents();
            Id = EventCatalog.Events.Last().Id + 1;
        }
Ejemplo n.º 20
0
		// Constructor
		public EventViewModel()
		{
			EventHandler = new Handler.EventHandler(this);
			Date = new DateTimeOffset(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0, 0, new TimeSpan());
			Time = new TimeSpan(dateTime.Hour, dateTime.Minute, dateTime.Second);
		}
Ejemplo n.º 21
0
        public EventViewModel()
        {
            DateTime dt = System.DateTime.Now;

            _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan());
            _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            EHandler = new Handler.EventHandler(this);
        }
Ejemplo n.º 22
0
        //Constructor:
        public EventViewModel()
        {
            EventCatalog = EventCatalogSingleton.GetInstance();
            DateTime dt = DateTime.Now;
            Date = new DateTimeOffset(dt);
            Time = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            EventHandler = new Handler.EventHandler(this);
            _createEventCommand = new RelayCommand(EventHandler.CreateEvent);
            _deleteEventCommand = new RelayCommand(EventHandler.DeleteEvent);


        }