private void TrainingWeekPage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "BindingWeekTrainingDays")
            {
                TrainingWeekViewModel viewModel = sender as TrainingWeekViewModel;
                if (viewModel != null)
                {
                    TouchViewCell touchViewCell;
                    DaySection.Clear();
                    foreach (var bindingWeekTrainingDay in viewModel.BindingWeekTrainingDays)
                    {
                        touchViewCell = new TouchViewCell()
                        {
                            IsIndicatorVisible = true,
                            BindingContext     = bindingWeekTrainingDay,
                            TitleTextColor     = Color.Red,
                            ValueTextColor     = Color.Red
                        };
                        touchViewCell.Tapped += DayCellTaped;
                        touchViewCell.SetBinding(TouchViewCell.ValueProperty, (BindingWeekTrainingDay source) => source.Label);

                        var trigger = new DataTrigger(typeof(Label));
                        trigger.BindingContext = bindingWeekTrainingDay;
                        trigger.Binding        = new Binding("TrainingDayExist");
                        trigger.Value          = true;
                        var setter = new Setter();
                        setter.Property = Label.TextColorProperty;
                        setter.Value    = Color.FromHex("#337ab7");
                        trigger.Setters.Add(setter);
                        touchViewCell.SetValueTrigger(trigger);

                        trigger = new DataTrigger(typeof(Label));
                        trigger.BindingContext = bindingWeekTrainingDay;
                        trigger.Binding        = new Binding("TrainingDayExist");
                        trigger.Value          = true;
                        setter          = new Setter();
                        setter.Property = Label.TextColorProperty;
                        setter.Value    = Color.FromHex("#337ab7");
                        trigger.Setters.Add(setter);
                        touchViewCell.SetTitleTrigger(trigger);

                        var menuItem = new MenuItem();
                        menuItem.SetBinding(MenuItem.TextProperty, new Binding(path: "SwitchDayLabel", source: viewModel));
                        menuItem.BindingContext = bindingWeekTrainingDay;
                        menuItem.Command        = viewModel.SwitchTrainingDayCommand;
                        menuItem.SetBinding(MenuItem.CommandParameterProperty, new Binding(path: "DayOfWeek", source: bindingWeekTrainingDay));
                        touchViewCell.ContextActions.Add(menuItem);

                        menuItem = new MenuItem();
                        menuItem.SetBinding(MenuItem.TextProperty, new Binding(path: "CopyDayLabel", source: viewModel));
                        menuItem.BindingContext = bindingWeekTrainingDay;
                        menuItem.Command        = viewModel.CopyTrainingDayCommand;
                        menuItem.SetBinding(MenuItem.CommandParameterProperty, new Binding(path: "DayOfWeek", source: bindingWeekTrainingDay));
                        touchViewCell.ContextActions.Add(menuItem);

                        DaySection.Add(touchViewCell);
                    }
                }
            }
        }
コード例 #2
0
        private DailyInOut ComputeDailyInOut(DaySection section, long itemId)
        {
            DailyInOut dInOut            = new DailyInOut();
            TemporaryHistoryStorage temp =
                _tempHistories.FirstOrDefault(t => t.DaySection.DateId == section.DateId);

            List <ItemHistory> historiesOfItem = temp.Histories.Where(h => h.Item_Id == itemId).ToList();

            List <ItemHistory> inHistories = historiesOfItem.Where(h => h.InOrOut == InOrOut.In).ToList();
            double             inQty       = 0;

            foreach (var h in inHistories)
            {
                inQty = inQty + h.AppopriateQty;
            }

            List <ItemHistory> outHistories = historiesOfItem.Where(h => h.InOrOut == InOrOut.Out).ToList();
            double             outQty       = 0;

            foreach (var h in outHistories)
            {
                outQty = outQty + h.AppopriateQty;
            }

            dInOut.DaySection = section;
            dInOut.InQty      = inQty;
            dInOut.OutQty     = outQty;

            return(dInOut);
        }
コード例 #3
0
        private List <DaySection> MakeDaySections()
        {
            List <DaySection> sections   = new List <DaySection>();
            List <DateTime>   daysInWeek = GenerateTheDaysWithinThisRange();
            int sectionId = 1;

            foreach (var day in daysInWeek)
            {
                DaySection d = new DaySection();
                d.DateId = sectionId;
                d.Day    = day;

                sections.Add(d);
                sectionId++;
            }

            return(sections);
        }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        dayTime += Time.deltaTime / 60;

        if (dayTime > fullDayLength)
        {
            dayTime -= fullDayLength;
        }

        DaySection section = GetDaySection();

        if (daySection == DaySection.night && section == DaySection.sunrise)
        {
            dayCount++;
            Debug.Log(dayCount.ToString());
        }
        daySection = section;

        if (daySection == DaySection.sunrise)
        {
            skyLight.intensity += sunriseSpeed * Time.deltaTime;
            if (skyLight.intensity > dayIntensity)
            {
                skyLight.intensity = dayIntensity;
            }
        }
        else if (daySection == DaySection.daytime)
        {
            skyLight.intensity = dayIntensity;
        }
        else if (daySection == DaySection.sunset)
        {
            skyLight.intensity -= sunsetSpeed * Time.deltaTime;
            if (skyLight.intensity < nightIntensity)
            {
                skyLight.intensity = nightIntensity;
            }
        }
        else
        {
            skyLight.intensity = nightIntensity;
        }
    }
コード例 #5
0
        private void DisplayQty(DaySection d, ItemRow row)
        {
            IXLWorksheet tempSheet = _currentSheet == InOrOut.In ? _sheetForIn : _sheetForOut;

            double     qty    = 0;
            DailyInOut dInOut = row.DailyInOuts.FirstOrDefault(o => o.DaySection.DateId == d.DateId);

            if (dInOut != null)
            {
                if (_currentSheet == InOrOut.In)
                {
                    qty = dInOut.InQty;
                }
                else if (_currentSheet == InOrOut.Out)
                {
                    qty = dInOut.OutQty;
                }
            }

            var qtyCell = tempSheet.Cell(_rowIndex, d.ColumnIndex);

            qtyCell.Value = qty;
        }