public ManageTasksWindow() { InitializeComponent(); WindowHelper.SmallWindowSettings(this); core = new TaskCore(); loadTasksToDatagrid(); }
public async void JobTest() { TestjobGet1 testjobGet1 = new TestjobGet1(); testjobGet1.i = 2; var tr = await TaskCore.Run(testjobGet1); Console.WriteLine(tr); Console.WriteLine(Thread.CurrentThread.ManagedThreadId); }
public TaskViewWidget() { log = new LogUtil ("TaskViewWidget"); this.Build (); TargetCore = new TaskCore (); this.ShowAll (); nameEntry.Changed += FormContentChanged; descriptionTextView.Buffer.Changed += FormContentChanged; priorityCombo.Changed += FormContentChanged; activateButton.Clicked += ActivateCurrentTask; }
/// <summary> /// Adds a new comment to the database. Does not affect the task /// </summary> /// <param name="task"> /// A <see cref="TaskCore"/> /// </param> /// <param name="comment"> /// A <see cref="CommentData"/> /// </param> public static void AddComment(TaskCore task, CommentData comment) { SqliteCommand cmd = conn.CreateCommand (); cmd.CommandText = "INSERT INTO Comments(TaskId, Subject, Author, Message, PostDate) VALUES (@taskid, @subject, @author, @message, @postdate);"; cmd.Parameters.AddWithValue ("@taskid", task.Id.ToString ()); cmd.Parameters.AddWithValue ("@subject", comment.Title); cmd.Parameters.AddWithValue ("@author", comment.Author); cmd.Parameters.AddWithValue ("@message", comment.Content); cmd.Parameters.AddWithValue ("@postdate", comment.PostDate.ToString (DateFormat)); LogQuery (cmd); }
//MM启动 public static void Start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_MM; IntPtr hwnd = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("WTWindow", null); Thread.Sleep(500); } while (hwnd == IntPtr.Zero); //设置拨号延迟 IntPtr ButtonHwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "设置"); IntPtr hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", "2"); if (hwndEx == IntPtr.Zero) { hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", "3"); } if (hwndEx == IntPtr.Zero) { hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", "4"); } HwndUtil.setText(hwndEx, (ConfigCore.Delay / 1000).ToString()); //设置工号 if (ConfigCore.InputId.Equals("1")) { ButtonHwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "会员"); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); HwndUtil.setText(hwndEx, ConfigCore.Id); } //开始投票 hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, null, "自动投票"); HwndThread.createHwndThread(hwndEx); taskCore.FinishStart(); }
public void BeginReceiveCallback(IAsyncResult ar) { i++; UDP_Data_Receive_Component uDP_Data_ = (UDP_Data_Receive_Component)ar.AsyncState; var dd = uDP_Data_.UDP_Server.EndReceive(ar, ref uDP_Data_.EndPoint); Console.WriteLine(i); var udpd = UDPComponentPool.UDPDataComponent(UDP_Service); UDP_Service.BeginReceive(BeginReceiveCallback, uDP_Data_); UDPtask uDPtask = new UDPtask { stream = Save_stream, UDP_Data_ = dd }; TaskCore.Run(uDPtask); }
//九天禁止虚拟机检测 public static bool VmBanCheck() { IntPtr hwnd = HwndUtil.FindWindow("#32770", "信息:"); IntPtr hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Static", "本任务禁止在虚拟机内运行"); if (hwndEx != IntPtr.Zero) { TaskCore taskCore = MonitorCore.GetTaskCore(); if (taskCore.IsAutoVote) { taskCore.AddVoteProjectNameDroped(false); } HwndUtil.closeHwnd(hwnd); return(true); } return(false); }
//JZ启动 public static void start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_JZ; IntPtr hwnd = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("TMainForm", null); Thread.Sleep(500); } while (hwnd == IntPtr.Zero); //设置拨号延迟 IntPtr hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwnd, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwnd, hwndEx, "TEdit", null); HwndUtil.setText(hwndEx, (ConfigCore.Delay / 1000).ToString()); //设置工号 if (ConfigCore.InputId.Equals("1")) { IntPtr hwndTGroupBox0 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "会员选项"); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox0, IntPtr.Zero, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox0, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox0, hwndEx, "TEdit", null); HwndUtil.setText(hwndEx, ConfigCore.Id); } //开始投票 IntPtr hwndTGroupBox = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "当前状态"); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, IntPtr.Zero, "TButton", "开 始"); HwndThread.createHwndThread(hwndEx); taskCore.FinishStart(); }
//JT启动 public static void start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_JT; IntPtr hwnd = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("ThunderRT6FormDC", null); Thread.Sleep(500); } while (hwnd == IntPtr.Zero); //设置拨号延迟 IntPtr ThunderRT6Frame = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "ThunderRT6Frame", "设置"); IntPtr hwndEx = HwndUtil.FindWindowEx(ThunderRT6Frame, IntPtr.Zero, "ThunderRT6TextBox", null); hwndEx = HwndUtil.FindWindowEx(ThunderRT6Frame, hwndEx, "ThunderRT6TextBox", null); HwndUtil.setText(hwndEx, (ConfigCore.Delay / 1000).ToString()); //设置工号 if (ConfigCore.InputId.Equals("1")) { ThunderRT6Frame = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "ThunderRT6Frame", "会员"); hwndEx = HwndUtil.FindWindowEx(ThunderRT6Frame, IntPtr.Zero, "ThunderRT6TextBox", null); HwndUtil.setText(hwndEx, ConfigCore.Id); } //开始投票 hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, null, "自动投票"); HwndThread.createHwndThread(hwndEx); taskCore.FinishStart(); }
public void AddNewTask() { AllTasks.Add(TaskCore.CreateTask()); }
public static async Task SendNewVerifyMailAsync() { VerifyeMail verifyeMail = new VerifyeMail("验证码", CSharpTools.CreateUUID().ToString(), "", null, "*****@*****.**"); await TaskCore.Run(verifyeMail); }
/// <summary> /// Adds a task and all the comments into the database /// </summary> /// <param name="input"> /// A <see cref="TaskCore"/> - the task to be added /// </param> /// <returns> /// A <see cref="System.Int32"/> - the task ID /// </returns> public static int AddTask(TaskCore input) { SqliteCommand cmd = new SqliteCommand (conn); cmd.CommandText = String.Format ("INSERT INTO Tasks (Name, Priority, Description, CreateDate, DueDate, Depends) VALUES ('{0}', {1}, '{2}', '{3}', '{4}', {5})", input.Title, input.Priority, input.Description, input.CreateDate.ToString (DateFormat), input.DueDate.ToString (DateFormat), input.Depends.ToString ()); LogQuery (cmd); // execute a query to find the new taskID of the newly created task cmd.CommandText = String.Format ("Select TaskID FROM Tasks WHERE(Name=\"{0}\");", input.Title); SqliteDataReader cursor = cmd.ExecuteReader (); int TaskID = -1; if (cursor.Read ()) { // This HAS to execute once because theoretically // there is only one row in the database that will be selected TaskID = cursor.GetInt32 (cursor.GetOrdinal ("TaskID")); } foreach (CommentData c in input.Comments) { c.TaskId = TaskID; SqliteCommand cmd1 = new SqliteCommand (conn); cmd1.CommandText = String.Format ("INSERT INTO Comments(TaskId, Subject, Author, Message, PostDate) VALUES ({0}, '{1}', '{2}', '{3}', '{4}')", c.TaskId, c.Title, c.Author, c.Content, c.PostDate.ToString (DateFormat)); LogQuery (cmd1); } return 0; //TODO: Return taskid }
public void DeleteTask(Guid g) { TaskCore.RemoveTask(g); }
/// <summary> /// Updates the task data /// /// NOTE: This does NOT update the comments too. /// you have to call DBHelper.AddComment() for that. /// </summary> /// <param name="input"> /// A <see cref="TaskCore"/> /// </param> public static void UpdateTask(TaskCore input) { // We're assuming that the task has the Task ID valid SqliteCommand cmd = conn.CreateCommand (); cmd.CommandText = "UPDATE Tasks SET Name = @name, Priority = @priority, Description = @description, CreateDate = @createdate, DueDate = @duedate, Depends = @depends WHERE TaskID = @taskid"; cmd.Parameters.AddWithValue ("@name", input.Title); cmd.Parameters.AddWithValue ("@priority", input.Priority); cmd.Parameters.AddWithValue ("@description", input.Description); cmd.Parameters.AddWithValue ("@createdate", input.CreateDate.ToString (DateFormat)); cmd.Parameters.AddWithValue ("@duedate", input.DueDate.ToString (DateFormat)); cmd.Parameters.AddWithValue ("@depends", input.Depends); cmd.Parameters.AddWithValue ("@taskid", input.Id); LogQuery (cmd); }
internal void CompleteTask(Guid g) { TaskCore.Complete(g); }
public void EditTask(Guid g) { TaskCore.Edit(g); }
/// <summary> /// Gets the taskcore object from the sqlite cursor /// </summary> /// <param name="cursor"> /// A <see cref="SqliteDataReader"/>. This won't be traversed, must be /// called each time the cursor moves ahead /// </param> /// <returns> /// A <see cref="TaskCore"/> - allocated and re-created /// Returns null if reading failed /// </returns> public static TaskCore GetTaskCoreFromCursor(SqliteDataReader cursor) { // this assumes a single task exists // the task to be extracted from the cursor TaskCore task = new TaskCore (); try { task.Id = cursor.GetInt32 (cursor.GetOrdinal ("TaskId")); task.Depends = cursor.GetInt32 (cursor.GetOrdinal ("Depends")); task.Title = cursor.GetString (cursor.GetOrdinal ("Name")); task.Description = cursor.GetString (cursor.GetOrdinal ("Description")); task.Priority = cursor.GetInt32 (cursor.GetOrdinal ("Priority")); task.DueDate = cursor.GetDateTime (cursor.GetOrdinal ("DueDate")); task.CreateDate = cursor.GetDateTime (cursor.GetOrdinal ("CreateDate")); } catch { log.ERROR ("Reading from cursor failed"); return null; } // now, extract the comments. SqliteCommand cmd = new SqliteCommand (conn); cmd.CommandText = String.Format ("SELECT * FROM Comments WHERE (TaskId = {0});", task.Id); log.WARN ("Trying to read comments with query - " + cmd.CommandText); SqliteDataReader commentCursor = cmd.ExecuteReader (); while (commentCursor.Read ()) { CommentData comment = new CommentData (); try { comment.Id = commentCursor.GetInt32 (commentCursor.GetOrdinal ("CommentID")); comment.TaskId = commentCursor.GetInt32 (commentCursor.GetOrdinal ("TaskId")); comment.Title = commentCursor.GetString (commentCursor.GetOrdinal ("Subject")); comment.Author = commentCursor.GetString (commentCursor.GetOrdinal ("Author")); comment.Content = commentCursor.GetString (commentCursor.GetOrdinal ("Message")); comment.PostDate = commentCursor.GetDateTime (commentCursor.GetOrdinal ("PostDate")); log.DEBUG ("Extracted comment - " + comment.ToString ()); } catch { log.ERROR ("Something went wrong while retrieving comment"); return null; } task.Comments.Add (comment); } log.DEBUG ("Extracted task as : " + task.ToString ()); return task; }
public void AddAlarm(Guid g, string time) { TaskCore.AddAlarm(g, time); }
//圆球启动 public static void Start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_YUANQIU; IntPtr hwnd = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("TForm1", null); Thread.Sleep(1000); } while (hwnd == IntPtr.Zero); Thread.Sleep(1000); //设置拨号延迟 IntPtr hwndTGroupBox = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "设置"); IntPtr hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, IntPtr.Zero, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); HwndUtil.setText(hwndEx, (ConfigCore.Delay / 1000).ToString()); //设置工号 //if (ConfigCore.InputId.Equals("1")) //{ // hwndTGroupBox = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "会员"); // hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, IntPtr.Zero, "TEdit", null); // HwndUtil.setText(hwndEx, ConfigCore.Id); // hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); // HwndUtil.setText(hwndEx, ConfigCore.Id); // hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); // HwndUtil.setText(hwndEx, ConfigCore.Id); // hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); // HwndUtil.setText(hwndEx, ConfigCore.Id); //} //开始投票 int count = 0; do { hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TButton", "开始"); Thread.Sleep(1000); if (count > 0) { LogCore.Write($"等待圆球启动{count}秒"); } count++; } while (hwndEx == IntPtr.Zero && count < 10); HwndThread.createHwndThread(hwndEx); taskCore.FinishStart(); }
public void ChangeEndDate(Guid g, DateTime date) { TaskCore.ChangeEndDate(g, date); }
public void LoadTasks(string path) { TaskCore.TaskStartup(Tasks.GetFromFile(path)); }
//九天启动 public static void Start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_JIUTIAN; IntPtr hwnd = IntPtr.Zero; IntPtr hwndSysTabControl32 = IntPtr.Zero; IntPtr workCondition = IntPtr.Zero; IntPtr preparedCheck = IntPtr.Zero; IntPtr startButton = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("WTWindow", null); hwndSysTabControl32 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", ""); workCondition = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "工作情况"); jiutianCode = "Afx:400000:b:10011:1900015:0"; preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票"); if (preparedCheck == IntPtr.Zero) { //不换 preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, "_EL_Label", "加载成功 可开始投票"); jiutianCode = "_EL_Label"; } if (preparedCheck == IntPtr.Zero) { //WIN7 jiutianCode = "Afx:400000:b:10003:1900015:0"; preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票"); } if (preparedCheck == IntPtr.Zero) { //WIN10 jiutianCode = "Afx:400000:b:10003:900015:0"; preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票"); } startButton = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", ""); startButton = HwndUtil.FindWindowEx(startButton, IntPtr.Zero, "Button", "开始投票"); Thread.Sleep(500); } while (preparedCheck == IntPtr.Zero || startButton == IntPtr.Zero); //设置拨号延迟 IntPtr hwndEx = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "拨号设置"); hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "SysTabControl32", ""); hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "Edit", null); HwndUtil.setText(hwndEx, ConfigCore.Delay.ToString()); //设置工号 if (ConfigCore.InputId.Equals("1")) { hwndEx = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "请输入工号"); hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "Edit", null); HwndUtil.setText(hwndEx, ConfigCore.Id); } HwndUtil.clickHwnd(startButton); Thread.Sleep(500); taskCore.FinishStart(); }
public void SeedDataForTesting(string seedString) { providerNode.CoreDataObject = new ProviderCore (); // initialize the database // DBHelper.Initialize(); // get an arraylist of all the taskcores // TODO: Phasing out the database model /* List<TaskCore> tasks = DBHelper.GetAllTasks(); // get all the coredata foreach(TaskCore core in tasks) { log.INFO("The core object is: " + core); // create a new task node TaskData taskNode = new TaskData(); // set the core data object taskNode.CoreDataObject = core; // set the label and icon taskNode.Label = core.Title; // update the tree without updating gui providerNode.AddChildSilent(taskNode); }*/ // create a few random taskcore items for (int i = 0; i < 3; i++) { // create a core data object and seed it TaskCore core = new TaskCore (); core.SeedTaskCore (seedString, i); TaskData taskNode = new TaskData (); taskNode.CoreDataObject = core; taskNode.Label = core.Title; providerNode.AddChildSilent (taskNode); } }
protected virtual void OnApplyButtonClicked(object sender, System.EventArgs e) { // Create a TaskCore object and populate with values from GUI TaskCore core = new TaskCore (); /* * TODO: Why isn't this working? all the objects are defined in stetic core.Title = this.taskNameEntry.Text; core.Description = this.taskDescText.Buffer.Text; core.CreateDate = DateTime.Now; core.DueDate = this.dueDateCal.Date; core.Priority = this.prioritySpin.Value;*/ core.Title = "Stub A"; core.Description = "Stub B"; core.CreateDate = DateTime.Now; core.DueDate = DateTime.Now; core.Priority = 10; log.INFO ("Added new TaskCore - " + core.ToString ()); // create a taskdata object TaskData task = new TaskData (); // attach the new core object to the task task.CoreDataObject = core; // write the task data to the database DBHelper.AddTask (core); // set the title of the task node task.Label = core.Title; // Add the task to the provider's children and thus trigger // an update of the treeview ProviderNode.AddChild (task); }