Example #1
0
        public static List <Activity> GetSpecificDateActivityLog(DateTimeOffset specificTime)
        {
            List <Activity> activityLog = new List <Activity>();

            using (var db = new MemoAppContext())
            {
                List <EachTask> eachTaskList = EachTaskModel.GetSpecificDateEachTasks(specificTime);

                foreach (var eachTask in eachTaskList)
                {
                    List <TimeInfo> timeInfoList = TimeInfoModel.GetSpecificTaskTimeInfo(eachTask.EachTaskId);

                    foreach (TimeInfo timeInfo in timeInfoList)
                    {
                        Activity activity = new Activity()
                        {
                            ExactStartTime = timeInfo.Start.LocalDateTime,
                            StartTime      = timeInfo.Start.LocalDateTime.ToString(" HH : mm "),
                            StopTime       = timeInfo.Stop == DateTimeOffset.MinValue ? " XX : XX " : timeInfo.Stop.LocalDateTime.ToString(" HH : mm "),
                            TaskContent    = eachTask.Content,
                            EachTaskId     = eachTask.EachTaskId
                        };

                        activityLog.Add(activity);
                    }
                }
            }

            return(activityLog.OrderBy(log => log.ExactStartTime).ToList());
        }
Example #2
0
        public void TaskPause(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IsEachTaskIdEmpty())
                {
                    CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Msg1001"));
                    return;
                }

                Msg = TimeInfoModel.RegisterPause(SelectedEachTaskId);
                if (Msg != null)
                {
                    CommonViewModel.NotifySystemMessage(Msg);
                    return;
                }

                if (NotifyRestTime != null)
                {
                    NotifyRestTime.Cancel();
                }

                CommonViewModel.RecentSelectedEachTaskId = SelectedEachTaskId;

                // Update Recent status
                SetRecentInfo("Msg1011");
            }
            catch
            {
                CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Exception"));
            }
        }
Example #3
0
        public void TaskStart(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IsEachTaskIdEmpty())
                {
                    CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Msg1001"));
                    return;
                }


                Msg = TimeInfoModel.RegisterStart(SelectedEachTaskId);
                if (Msg != null)
                {
                    CommonViewModel.NotifySystemMessage(Msg);

                    if (Msg != GetLangMessage.GetMessage("Msg1016"))
                    {
                        // If the button pushing is invalid, return and not update the status.
                        return;
                    }
                }

                if (ConfigModel.GetSpecificConfigValue(ConfigModel.ConfigType.NotificationFlag) == true.ToString())
                {
                    this.NotifyRestTime = ThreadPoolTimer.CreatePeriodicTimer((source) =>
                    {
                        Notification notification = new Notification();
                        notification.NotifyRestTime();
                    }, TimeSpan.FromMinutes(float.Parse(ConfigModel.GetSpecificConfigValue(ConfigModel.ConfigType.NotificationSpanMinute))));
                }

                // Update Recent status
                SetRecentInfo("Msg1010");
            }
            catch
            {
                CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Exception"));
            }
        }
Example #4
0
        public void TaskStop(object sender, RoutedEventArgs e)
        {
            if (IsEachTaskIdEmpty())
            {
                NotifySystemMessage("タスクを選択してください");
                return;
            }

            Msg = TimeInfoModel.RegisterStop(SelectedEachTaskId);
            if (Msg != null)
            {
                NotifySystemMessage(Msg);
            }

            if (NotifyRestTime != null)
            {
                NotifyRestTime.Cancel();
            }

            CommonViewModel.RecentSelectedEachTaskId = SelectedEachTaskId;

            SetRecentInfo("完了済");
        }
Example #5
0
        public void TaskStart(object sender, RoutedEventArgs e)
        {
            if (IsEachTaskIdEmpty())
            {
                NotifySystemMessage("タスクを選択してください");
                return;
            }

            Msg = TimeInfoModel.RegisterStart(SelectedEachTaskId);
            if (Msg != null)
            {
                NotifySystemMessage(Msg);
            }

            NotifyRestTime = ThreadPoolTimer.CreatePeriodicTimer((source) =>
            {
                Notification notification = new Notification();
                notification.NotifyRestTime();
            }, TimeSpan.FromMinutes(float.Parse(ConfigModel.GetSpecificConfigValue(ConfigModel.ConfigType.NotificationSpanMinute))));


            SetRecentInfo("実行中");
        }
Example #6
0
        public void TaskStop(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IsEachTaskIdEmpty())
                {
                    CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Msg1001"));
                    return;
                }

                Msg = TimeInfoModel.RegisterStop(SelectedEachTaskId);
                if (Msg != null)
                {
                    CommonViewModel.NotifySystemMessage(Msg);

                    if (Msg != GetLangMessage.GetMessage("Msg1020"))
                    {
                        // If the button pushing is invalid, return and not update the status.
                        return;
                    }
                }

                if (NotifyRestTime != null)
                {
                    NotifyRestTime.Cancel();
                }

                CommonViewModel.RecentSelectedEachTaskId = SelectedEachTaskId;

                // Update Recent status
                SetRecentInfo("Msg1012");
            }
            catch
            {
                CommonViewModel.NotifySystemMessage(GetLangMessage.GetMessage("Exception"));
            }
        }
Example #7
0
 public async void ChangeSmallTaskCompleteFlag()
 {
     await TimeInfoModel.ChangeComplateFlag(EachTaskId, !IsComplete);
 }