示例#1
0
 void fillPgae(DiaryPage currentPage)
 {
     dateText.text         = currentPage.getDate();
     contentTextLeft.text  = currentPage.getContentLeft();
     contentTextRight.text = currentPage.getContentRight();
     WeatherText.text      = currentPage.getWeather();
 }
示例#2
0
        private void UpdatePageEntity(EditPageRequest editPageRequest)
        {
            DiaryPage page = _pageRepository.GetPageById(editPageRequest.DiaryId, editPageRequest.PageId);

            page.Title = editPageRequest.Title;
            _diaryModifier.UpdatePage(page);
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("Title,Message")] DiaryPage diaryPage)
        {
            if (ModelState.IsValid)
            {
                if (diaryPage.Title == null || diaryPage.Message == null)
                {
                    return(View());
                }
                diaryPage.Type        = DiaryPageType.User;
                diaryPage.GameId      = (Guid)GameId();
                diaryPage.CharacterId = (await GetCharacter()).Id;
                diaryPage.DateTime    = DateTime.UtcNow;
                _context.Diary.Add(diaryPage);
                await _context.SaveChangesAsync();;
                return(RedirectToAction(nameof(Index), "InGame", null));
            }
            var game = await GameAsync();

            if (IsMaster(game))
            {
                ViewData["IsMaster"] = "true";
                ViewData["Id"]       = game.Id;
            }
            return(View(diaryPage));
        }
示例#4
0
 public void UpdatePage(DiaryPage page)
 {
     using (var dbContext = new TripMeContext())
     {
         dbContext.DiaryPages.AddOrUpdate(page);
         dbContext.SaveChanges();
     }
 }
示例#5
0
 public void CreateNewPage(DiaryPage page)
 {
     using (var dbContext = new TripMeContext())
     {
         dbContext.DiaryPages.Add(page);
         dbContext.SaveChanges();
     }
 }
示例#6
0
        public long CreateNewDiaryPage(AddNewPageRequest newPageRequest)
        {
            DiaryPage newPage = Mapper.Map <DiaryPage>(newPageRequest);

            _diaryModifier.CreateNewPage(newPage);
            StorePageReviews(newPage.PageId, newPageRequest.Reviews);
            return(newPage.PageId);
        }
示例#7
0
    //create new page when a day is end(either because tired, time or die)
    public void createNewPage()
    {
        //create a new page with current info
        DiaryPage newPage = new DiaryPage((int)Mathf.Round(day), weathers, currentWeather, events);

        pageList.Add(newPage);
        showDiary();

        //clear current info for next day
        //day and weather is alreay subscribed sp we don't need to modify it
        events.Clear();
        weathers.Clear();
    }
        public ItemDetailPage()
        {
            InitializeComponent();

            var item = new DiaryPage
            {
                Title       = "Item 1",
                Description = "This is an item description."
            };

            viewModel      = new ItemDetailViewModel(item);
            BindingContext = viewModel;
        }
示例#9
0
    // Opens the given page and starts the input delay timer. This deactivates all pages, while it activates the page that matches the enum index.
    public void OpenPage(DiaryPage newPage, List <Reaction> triggerOnClose)
    {
        inputDelayTimer     = 0.1f;
        currentPage         = newPage;
        this.triggerOnClose = triggerOnClose;

        int index = (int)newPage - 1;

        for (int i = 0; i < pageObjects.Count; i++)
        {
            pageObjects[i].SetActive(i == index);
        }

        player.enabled = newPage == DiaryPage.none;
    }
示例#10
0
        public DiaryPageDto GetPageById(long diaryId, long pageId)
        {
            DiaryPage page = _pageRepository.GetPageById(diaryId, pageId);

            if (page == null)
            {
                return(null);
            }

            DiaryPageDto diaryPageDto = Mapper.Map <DiaryPageDto>(page);
            Dictionary <Guid, ReviewQuestionnaireAnswerDto> pageReviews = _reviewGetter.GetPageReviews(pageId);

            diaryPageDto.Reviews = pageReviews;
            return(diaryPageDto);
        }
示例#11
0
        public async Task <ActionResult <DiaryPage> > PostDiaryPage([FromBody] DiaryPage diaryPage, string id)
        {
            var diary = await _context.Diaries.FindAsync(id);

            if (diary == null)
            {
                return(NotFound());
            }
            diaryPage.diary = await _context.Diaries.FindAsync(id);

            _context.Pages.Add(diaryPage);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDiaryPage",
                                   new DiaryPageResource {
                id = diaryPage.id, number = diaryPage.number, text = diaryPage.text
            }));
        }
示例#12
0
    void displayContent(int pageIndex)
    {
        if (pageIndex == 0)
        {
            previousButton.SetActive(false);
            if (pageList.Count <= 1)
            {
                nextButton.SetActive(false);
            }
        }
        else if (pageIndex == pageList.Count - 1)
        {
            nextButton.SetActive(false);
            previousButton.SetActive(true);
        }
        else
        {
            previousButton.SetActive(true);
            nextButton.SetActive(true);
        }
        DiaryPage currentPage = pageList[pageIndex];

        fillPgae(currentPage);
    }
示例#13
0
 public ItemDetailViewModel(DiaryPage item = null)
 {
     Title = item?.Title;
     Item  = item;
 }
示例#14
0
 private async void EditItem(DiaryPage item)
 {
     await App.Current.MainPage.Navigation.PushModalAsync(new NavigationPage(new NewItemPage(item)));
 }
 public NewItemPage(DiaryPage item)
 {
     InitializeComponent();
     Item           = item;
     BindingContext = this;
 }