コード例 #1
0
        private static void CalculateLevels()
        {
            DateTime lastDate = DateTime.Now;
            int      lastGas = 0, lastLow = 0, lastHigh = 0;

            foreach (var record in Records)
            {
                DateTimeWeekNumber dwn = new DateTimeWeekNumber(record.Date);
                record.Week = dwn.ISOWeekNoExtended;

                if (lastGas != 0)
                {
                    record.Time = record.Date - lastDate;
                    record.Gas  = record.LevelGas - lastGas;
                    record.Low  = record.LevelLow - lastLow;
                    record.High = record.LevelHigh - lastHigh;
                    if (record.Gas < 0)
                    {
                        record.Gas  = record.LevelGas;
                        record.Low  = record.LevelLow;
                        record.High = record.LevelHigh;
                    }
                }
                record.Current = record.Low + record.High;
                lastDate       = record.Date;
                lastGas        = record.LevelGas;
                lastLow        = record.LevelLow;
                lastHigh       = record.LevelHigh;
            }
        }
コード例 #2
0
        private void GetWeekNumber()
        {
            DateTimeWeekNumber dwn = new DateTimeWeekNumber(Date.SelectedDate.Value);

            WeekNumber.Text = dwn.WeekNoCompact;      //19041
            Reference.Text  = $"{WeekNumber.Text}00"; //1904100
        }
コード例 #3
0
        private void ProjectDate_SelectedDateChanged()
        {
            DateTimeWeekNumber dwn = new DateTimeWeekNumber(DatePickerProjectDate.SelectedDate.Value);

            SelectedWeekNoCompact = dwn.WeekNoCompact;

            SelectedWeekNoMaxumumCount = GetSelectedWeekNoMaxumumCount(SelectedWeekNoCompact);

            CurrentWeekNoCompact.Text = $"WeekRef: {SelectedWeekNoCompact}";
            CurrentWeekNoCount.Text   = $"Max: {SelectedWeekNoMaxumumCount}";
        }
コード例 #4
0
        private void GetDate()
        {
            DateTime?date = DateTimeWeekNumber.WeekNoCompactToDate(InputReference.Text);

            if (date == null)
            {
                ReferenceDate.Text = "Invalidate";
            }
            else
            {
                ReferenceDate.Text = date.Value.ToString("yyyy-MM-dd");
            }
        }
コード例 #5
0
        public ProjectWindow(Project projectParameter, ProjectWindowsArgs e)
        {
            projectScreen   = projectParameter.Copy();
            windowsArgs     = e;
            e.Save          = false;
            e.ProjectScreen = projectScreen;

            DataContext = projectScreen;

            InitializeComponent();

            Title.Text          += $" {DateTimeWeekNumber.WeekNoCompactToDate(projectScreen.WeekNoCompact).Value.ToString("yyyy-MM-dd")}";
            ButtonSave.IsEnabled = !string.IsNullOrWhiteSpace(ProjectName.Text);
            ProjectName.Focus();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Console.WriteLine($"Today: {DateTime.Now.ToString("yyyy-MM-dd")}");
            string Reference = "1903401";

            Console.Write($"Reference {Reference} => ");
            DateTime?date = DateTimeWeekNumber.WeekNoCompactToDate(Reference);

            if (date == null)
            {
                Console.WriteLine("Is invalid");
            }
            else
            {
                Console.WriteLine(date);
            }

            Console.Write("\nPress any key...");
            Console.ReadKey();
        }