Ejemplo n.º 1
0
        //methods
        public async void CreateEvent()
        {
            try
            {
                if (Evm.NewItem.Name == null || Evm.NewItem.Type == null || Evm.NewItem.Description == null || Evm.NewItem.Location == null || Evm.Date1 <= DateTime.Now)
                {
                    MessageDialog msg = new MessageDialog("In order to create event, you have to fill all the information. Otherwise make sure that the date is picked.", "Creating failed");
                    msg.ShowAsync();
                }
                else
                {
                    DateTime date = DataTimeConvertor.DateTimeOffsetAndTimeSetToDateTime(Evm.Date1, Evm.Time1);

                    _catalog.Events.Add(new Event(Evm.NewItem.Name, Evm.NewItem.Type, Evm.NewItem.Description, date,
                                                  Evm.NewItem.Location));
                    await _getEvents.SavetoJson(_catalog.Events);

                    _frameNAvigation.ActivateFrameNavigation(typeof(EventPage));
                }
            }
            catch (Exception e)
            {
                string        ex  = e.ToString();
                MessageDialog msg = new MessageDialog(ex, "Error");
                msg.ShowAsync();
            }
        }
Ejemplo n.º 2
0
        public void DateTimeConverterTest()
        {
            //Act
            DateTime _expectedDate = new DateTime(2017, 12, 12, 6, 7, 0);
            DateTime _actualDate   = DataTimeConvertor.DateTimeOffsetAndTimeSetToDateTime(new DateTimeOffset(2017, 12, 12, 0, 0, 0, 0, new TimeSpan()),
                                                                                          new TimeSpan(6, 7, 0));

            //Assert
            Assert.AreEqual(_expectedDate, _actualDate);
        }