Пример #1
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override async void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            _baby = await BabyManager.Load();

            _weights = await WeightManager.Load();

            if (string.IsNullOrEmpty(_baby.Name))
            {
                this.pageTitle.Text = "请输入宝宝信息";
                return;
            }
            else
            {
                string title = string.Format("{0}的体重是:", _baby.NickName);
                this.pageTitle.Text = title;
            }

            if (0 == _weights.Count)
            {
                _weights = MockWeights();
            }

            if (_weights.Count > 0)
            {
                listWeight.ItemsSource = _weights;
                UpdateCharts();
            }
        }
Пример #2
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override async void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            _baby = await BabyManager.Load();

            if (string.IsNullOrEmpty(_baby.Name))
            {
                this.pageTitle.Text = "请输入宝宝信息";
                return;
            }
            else
            {
                ConstellationType type          = GetConstellationType(_baby.Birthday);
                string            constellation = GetConstellationName(type);
                string            title         = string.Format("{0}的星座是{1}", _baby.NickName, constellation);
                this.pageTitle.Text = title;
                //BitmapImage image = new BitmapImage(new Uri(@"ms-appx:/Assets/Constellation/巨蟹座.jpg"));
                string      imagePath = string.Format(@"ms-appx:/Assets/Constellation/{0}.jpg", constellation);
                BitmapImage image     = new BitmapImage(new Uri(imagePath));
                this.image.Source = image;

                string            jsonPath = constellation + ".json";
                ConstellationInfo info     = await FileHelper.LoadData <ConstellationInfo>(jsonPath, "Assets\\Constellation", true);

                this.description.Text = info.Description;
            }
        }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        m_BabyManager = new BabyManager();
        m_HomeManager = new HomeManager();

        m_GameSpeed = 1f;

        _earlierDate = Clock.m_Instance.CurrentDate.m_Day;
    }
Пример #4
0
        private void Button_Click_Save(object sender, RoutedEventArgs e)
        {
            _baby.Name     = tbName.Text;
            _baby.NickName = tbNickname.Text;
            DateTime dt;

            if (DateTime.TryParse(tbBirthday.Text, out dt))
            {
                _baby.Birthday = dt;
            }
            BabyManager.Save();

            // save and go back
            this.Frame.GoBack();
        }
Пример #5
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override async void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            _baby = await BabyManager.Load();

            if (!string.IsNullOrWhiteSpace(_baby.Name))
            {
                tbName.Text     = _baby.Name;
                tbNickname.Text = _baby.NickName;
                tbBirthday.Text = _baby.Birthday.ToString();
            }
            else
            {
                tbName.Text = "千万别忘记宝宝名字哟";
            }
        }
Пример #6
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override async void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            _baby = await BabyManager.Load();

            if (string.IsNullOrEmpty(_baby.Name))
            {
                this.pageTitle.Text = "请输入宝宝信息";
                return;
            }
            else
            {
                string zodiac = getShengXiao(_baby.Birthday);
                string title  = string.Format("{0}的生肖是{1}", _baby.NickName, zodiac);
                this.pageTitle.Text = title;
            }
        }
Пример #7
0
        private async void Init()
        {
            //DateTime birth = MockBirth();
            //await BabyManager.Load();
            //_baby = BabyManager.BabyInstance();
            _baby = await BabyManager.Load();

            if (string.IsNullOrEmpty(_baby.Name))
            {
                this.pageName.Text = "请输入宝宝信息";
                return;
            }

            string title = string.Format("{0}诞生了:", _baby.NickName);

            this.pageName.Text = title;
            DateTime birth = _baby.Birthday;

            TimeSpan span = DateTime.Now - birth;

            int    days       = span.Days;
            string daysToShow = string.Format("总共{0}天", days);

            this.tbDays.Text = daysToShow;

            int    hours       = days * 24 + span.Hours;
            string hoursToShow = string.Format("总共{0}小时", hours);

            this.tbHours.Text = hoursToShow;

            int minutes = hours * 60 + span.Hours;
            //double totalMinutes = span.TotalMinutes;
            string minutesToShow = string.Format("总共{0}分钟", minutes);

            this.tbMinutes.Text = minutesToShow;

            ShowSeconds(span);

            _timer          = new DispatcherTimer();
            _timer.Tick    += timer_Tick;
            _timer.Interval = new TimeSpan(0, 0, 3);

            if (!_timer.IsEnabled)
            {
                _timer.Start();
            }
        }
Пример #8
0
 public void OnObjectInitiate(SpriteManager sm)
 {
     babyManager = (BabyManager)sm;
     this.transform.SetParent(sm.transform);
     animator = GetComponent <Animator>();
 }
Пример #9
0
 private void Awake()
 {
     instance = this;
 }
Пример #10
0
 void Awake()
 {
     Instance = this;
 }