示例#1
0
        public MainViewModel()
        {
            string logPath = @$ "{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\Stempeluhr";

            Directory.CreateDirectory(logPath);

            try
            {
                if (LogOperations.WasEndtimeRecorded())
                {
                    LogOperations.RecordStartTime();
                }
                else if (LogOperations.GetRecordedDays().Last().Date == DateTime.Today)
                {
                    MessageBox.Show("Willkommen zurück!");
                }
                else
                {
                    MessageBox.Show($"Endzeit vom {LogOperations.GetRecordedDays().Last().Date.ToString("dd.MM.yyyy")} konnte nicht ermittelt werden. Bitte tragen Sie diese nach.");
                    LogOperations.RecordEndTime(new DateTime {
                    });
                    CurrentDate = LogOperations.GetRecordedDays().Last().Date;
                    LogOperations.RecordStartTime();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            SystemEvents.SessionEnding += SystemEvents_SessionEnding;

            SetUpTextBoxes();
        }