Beispiel #1
0
        //NAME检测
        public bool NameCheck()
        {
            TaskChange = ConfigCore.GetTaskChange();
            if (TaskChange.Equals("1"))
            {
                TaskName = ConfigCore.GetTaskName();
                if (!TaskName.Equals(ProjectName))
                {
                    TaskChangeProcess();
                    return(false);
                }
            }

            return(true);
        }
 private void OutlookItems_ItemChange(object Item)
 {
     if (Item is Outlook.TaskItem)
     {
         Outlook.TaskItem taskItem = Item as Outlook.TaskItem;
         taskAndCategoryLoader.Tasks.ForEach(task =>
         {
             if (task.EntryId.Equals(taskItem.EntryID))
             {
                 taskAndCategoryLoader.UpdateTask(task, taskItem, taskAndCategoryLoader.Categories, taskAndCategoryLoader.DefaultCategory);
                 TaskChange?.Invoke(task);
             }
         });
     }
 }
Beispiel #3
0
 public TaskChangeDTO ConvertDalToBbl(TaskChange entity)
 {
     return(new TaskChangeDTO(entity.Id, entity.TaskId, entity.EmployeeId, entity.ChangeText, entity.ChangeDate));
 }
        public static Data.TaskChanges CreateListOfLocalTaskChanges(Data.TaskList oldlist, Data.TaskList newlist)
        {
            var taskChanges = new Data.TaskChanges();

            Data.TaskChange taskChange;
            bool            found;

            foreach (var oldtask in oldlist.AllTasks)
            {
                found = false;

                foreach (var newtask in newlist.AllTasks.Where(newtask => newtask.Id == oldtask.Id))
                {
                    found = true;

                    taskChange = new Data.TaskChange();

                    if (oldtask.ParentId != newtask.ParentId || oldtask.PreviousId != newtask.PreviousId)
                    {
                        taskChange.TaskChangeType = TaskChangeType.ChangeAndMove;
                    }

                    else if (oldtask.Title != newtask.Title || oldtask.Done != newtask.Done || oldtask.DueDate != newtask.DueDate || oldtask.Notes != newtask.Notes)
                    {
                        taskChange.TaskChangeType = TaskChangeType.Change;
                    }

                    if (taskChange.TaskChangeType != TaskChangeType.None)
                    {
                        taskChange.NewTask = newtask;
                        taskChange.Id      = newtask.Id;
                        taskChanges.AddChangeOverwriteExisting(taskChange);
                    }
                }
                if (!found)
                {
                    taskChange = new TaskChange();
                    taskChange.TaskChangeType = TaskChangeType.Delete;
                    taskChange.Id             = oldtask.Id;
                    taskChanges.AddChangeOverwriteExisting(taskChange);
                }
            }

            foreach (var newtask in newlist.AllTasks)
            {
                found = false;

                foreach (var oldtask in oldlist.AllTasks.Where(oldtask => oldtask.Id == newtask.Id))
                {
                    found = true;
                }

                if (!found)
                {
                    taskChange = new TaskChange
                    {
                        TaskChangeType = TaskChangeType.Create,
                        NewTask        = newtask,
                        Id             = newtask.Id
                    };
                    taskChanges.AddChangeOverwriteExisting(taskChange);
                }
            }

            return(taskChanges);
        }
Beispiel #5
0
        //切换任务
        private void ChangeTask()
        {
            if (TaskChange.Equals("1"))
            {
                overTimeCount = 0;
                ConfigCore.InitWorker("");
                CustomPath = ConfigCore.GetCustomPath();
                if (CustomPath != "")
                {
                    LogCore.Write($"切换任务:{CustomPath}");
                }

                if (IsVoteTask() && IsAutoVote)
                {
                    string projectName = ConfigCore.GetAutoVote("ProjectName");
                    string drop        = "";
                    try
                    {
                        drop = IniReadWriter.ReadIniKeys("Command", "drop", "./handler.ini");
                    }
                    catch (Exception)
                    {
                    }

                    if (drop != projectName)
                    {
                        IniReadWriter.WriteIniKeys("Command", "drop", "", "./handler.ini");
                    }
                }
            }

            if (TaskName.Equals(TASK_SYS_WAIT_ORDER)) //待命
            {
                NetCore.DisConnect();
                TaskName = ConfigCore.GetTaskName();
                if (TaskName.Equals(TASK_SYS_WAIT_ORDER))
                {
                    WaitOrder();
                }
            }
            else if (TaskName.Equals(TASK_SYS_NET_TEST)) //网络TEST
            {
                NetCore.NetCheck();
                if (Net.IsOnline())
                {
                    NetCore.DisConnect();
                    WaitOrder();
                }
            }
            else if (TaskName.Equals(TASK_SYS_SHUTDOWN)) //关机
            {
                WaitOrder();
                Process.Start("shutdown.exe", "-s -t 0");
                Form1.MainClose();
            }
            else if (TaskName.Equals(TASK_SYS_RESTART)) //重启
            {
                string computerRename = ConfigCore.GetComputerRename();
                if (!StringUtil.isEmpty(computerRename))
                {
                    Computer.apiSetComputerNameEx(5, computerRename + "-" + ConfigCore.Sort);
                }

                WaitOrder();
                Process.Start("shutdown.exe", "-r -t 0");
                Form1.MainClose();
            }
            else if (TaskName.Equals(TASK_SYS_UPDATE)) //升级
            {
                WaitOrder();
                Upgrade.Update();
                Form1.MainClose();
            }
            else if (TaskName.Equals(TASK_SYS_CLEAN)) //清理
            {
                WaitOrder();
                FileUtil.DeleteFolder(PathCore.WorkingPath + "\\投票项目");
            }
            else if (IsVoteTask()) //投票
            {
                NetCore.NetCheck();
                if (CustomPath.Equals(""))
                {
                    WaitOrder();
                    TaskChangeProcess();
                    return;
                }

                if (TaskChange.Equals("1"))
                {
                    if (CustomPath.LastIndexOf("\\") + 1 <= CustomPath.Length && CustomPath.Substring(CustomPath.LastIndexOf("\\") + 1) == "vote.exe")
                    {
                        ProgressCore.StartProcess(CustomPath.Substring(0, CustomPath.Length - 9) + @"\启动九天.bat");
                        TaskName = TASK_VOTE_JIUTIAN;
                    }
                    else
                    {
                        IniReadWriter.WriteIniKeys("setsoft", "ghid", ConfigCore.Id, "c:\\gonghao.ini");
                        ProgressCore.StartProcess(CustomPath);
                        TaskName = TASK_VOTE_PROJECT;
                        IntPtr hwnd0, hwnd1, hwnd2, hwnd3, hwnd4;
                        do
                        {
                            hwnd0 = HwndUtil.FindWindow("WTWindow", null);
                            hwnd1 = HwndUtil.FindWindow("TForm1", null);
                            hwnd2 = HwndUtil.FindWindow("ThunderRT6FormDC", null);
                            hwnd3 = HwndUtil.FindWindow("obj_Form", null);
                            hwnd4 = HwndUtil.FindWindow("TMainForm", null);
                            if (hwnd0 != IntPtr.Zero)
                            {
                                string title = HwndUtil.GetControlText(hwnd0);
                                if (title.Length >= 6 && title.Substring(0, 6) == "自动投票工具")
                                {
                                    TaskName = TASK_VOTE_MM;
                                }
                                else if (title.Length >= 8 && title.Substring(0, 8) == "VOTE2016")
                                {
                                    TaskName = TASK_VOTE_ML;
                                }
                                else if (title.IndexOf("自动投票软件") != -1)
                                {
                                    TaskName = TASK_VOTE_HY;
                                }
                            }
                            else if (hwnd1 != IntPtr.Zero)
                            {
                                TaskName = TASK_VOTE_YUANQIU;
                            }
                            else if (hwnd2 != IntPtr.Zero)
                            {
                                TaskName = TASK_VOTE_JT;
                            }
                            else if (hwnd3 != IntPtr.Zero)
                            {
                                TaskName = TASK_VOTE_DM;
                            }
                            else if (hwnd4 != IntPtr.Zero)
                            {
                                TaskName = TASK_VOTE_JZ;
                            }

                            Thread.Sleep(500);
                        } while (TaskName.Trim().Equals(TASK_VOTE_PROJECT));
                    }

                    bool safeWrite = false;
                    Thread.Sleep(ConfigCore.Sort % 10 * 50);
                    do
                    {
                        try
                        {
                            ConfigCore.WriteTaskName(TaskName);
                            Thread.Sleep(200);
                            string taskNameCheck = ConfigCore.GetTaskName();
                            if (StringUtil.isEmpty(taskNameCheck) || !taskNameCheck.Equals(TaskName))
                            {
                                LogCore.Write("TaskName Write Error!");
                                ConfigCore.WriteTaskName(TaskName);
                                throw new Exception();
                            }

                            safeWrite = true;
                        }
                        catch (Exception)
                        {
                            Thread.Sleep(ConfigCore.Sort % 10 * 50);
                        }
                    } while (!safeWrite);
                }

                if (TaskName.Equals(TASK_VOTE_JIUTIAN))
                {
                    if (!TaskChange.Equals("1"))
                    {
                        ProgressCore.StartProcess(CustomPath.Substring(0, CustomPath.Length - 9) + @"\启动九天.bat");
                        Thread.Sleep(500);
                    }

                    JiuTian.Start();
                }
                else
                {
                    if (!TaskChange.Equals("1"))
                    {
                        ProgressCore.StartProcess(CustomPath);
                        Thread.Sleep(500);
                    }

                    if (TaskName.Equals(TASK_VOTE_MM))
                    {
                        MM.Start();
                    }
                    else if (TaskName.Equals(TASK_VOTE_ML))
                    {
                        //ML开始程序
                    }
                    else if (TaskName.Equals(TASK_VOTE_YUANQIU))
                    {
                        YuanQiu.Start();
                    }
                    else if (TaskName.Equals(TASK_VOTE_JT))
                    {
                        JT.start();
                    }
                    else if (TaskName.Equals(TASK_VOTE_DM))
                    {
                        //DM开始程序
                    }
                    else if (TaskName.Equals(TASK_VOTE_JZ))
                    {
                        JZ.start();
                    }
                    else if (TaskName.Equals(TASK_VOTE_HY))
                    {
                        HY.Start();
                    }
                }

                TaskPath = CustomPath;
            }
            else
            {
                TaskName = TASK_SYS_WAIT_ORDER;
            }
        }
Beispiel #6
0
        protected virtual void OnTaskMoved(Task task)
        {
            var args = new TaskMovedEventArgs(task);

            TaskChange?.Invoke(this, args);
        }
Beispiel #7
0
        public virtual void OnTaskEdited(Task task)
        {
            var args = new TaskEventArgs(task, TaskAction.Edit);

            TaskChange?.Invoke(this, args);
        }
Beispiel #8
0
        protected virtual void OnTaskChanged(Task task, TaskAction action)
        {
            var args = new TaskEventArgs(task, action);

            TaskChange?.Invoke(this, args);
        }