public void GetAnotherUserSolutionTest() { const long submitId = 1; const long userId = 2; const string sourceCode = "qwe"; var submitResult = new SubmitResult(new ProblemSubmit { FileName = "main.cpp", Id = submitId, LanguageId = 4, ProblemId = 6, SourceCode = sourceCode, UserId = userId }) { Id = submitId }; var task = new TaskName { IsOpened = false, Name = "task" }; _submitResultRepository.Stub(o => o.Get(submitId)).Return(submitResult); _taskRepository.Stub(o => o.Get(6)).Return(task); Assert.Throws <AuthenticationException>(() => _service.GetSolution(submitId, 3)); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (String.IsNullOrEmpty(TaskName)) { yield return(new ValidationResult("Task name cannot be empty", new[] { nameof(TaskName) })); } else { TaskName = Validations.Capitalize(TaskName.Trim()); } if (String.IsNullOrEmpty(TaskDescription)) { yield return(new ValidationResult("Task name cannot be empty", new[] { nameof(TaskDescription) })); } if (TaskDuration < 0) { yield return(new ValidationResult("Task duration cannot be less than 0 days", new[] { nameof(TaskDuration) })); } if (ExpectedDate < DateTime.Now) { yield return(new ValidationResult("The due date must be in the future.", new[] { nameof(ExpectedDate) })); } yield return(ValidationResult.Success); }
/// <summary> /// See http://taskscheduler.codeplex.com/ for help on using the TaskService wrapper library. /// </summary> /// <param name="context"></param> protected override void Execute(CodeActivityContext context) { try { using (TaskService ts = new TaskService()) { TaskDefinition td = ts.NewTask(); td.RegistrationInfo.Description = TaskDescription.Get(context); var triggers = Triggers.Get(context); if (triggers != null) { triggers.ToList().ForEach(t => td.Triggers.Add(t)); } td.Actions.Add(new ExecAction(FileName.Get(context), Arguments.Get(context), WorkingDirectory.Get(context))); string username = Username.Get(context); string password = Password.Get(context); if (string.IsNullOrEmpty(username)) { username = WindowsIdentity.GetCurrent().Name; } ts.RootFolder.RegisterTaskDefinition( TaskName.Get(context), td, TaskCreation.CreateOrUpdate, username, password); } } catch { throw; } }
private void Button_Click(object sender, RoutedEventArgs e) { TaskName.Clear(); TaskDescription.Clear(); TaskDue.DisplayDate = DateTime.Now; taskPopUp.IsOpen = true; }
public void CheckFailTooMuch() { if (IsVoteTask()) { int succ = 0; if (TaskName.Equals(TASK_VOTE_JIUTIAN)) { TimerChecked++; succ = JiuTian.GetSucc(); } else if (TaskName.Equals(TASK_VOTE_MM)) { TimerChecked++; succ = MM.GetSucc(); } else if (TaskName.Equals(TASK_VOTE_YUANQIU)) { TimerChecked++; succ = YuanQiu.GetSucc(); } if (succ - SuccCount < 2 && TimerChecked >= 2) { FailTooMuch = true; } LogCore.Write("success:" + succ + " last:" + SuccCount); SuccCount = succ; } }
public void AddNewTask2() { WaitforIt(Properties.InactivePhase); AddBtn.WaitUntil(); AddBtn.Clicks(); AddNewTask.Clicks(); TaskName.WaitUntil(); TaskName.EnterText("Test Task 2"); TaskTypeParent("Office Tasks").Clicks(); TaskTypeChild("Discipline").Clicks(); WaitforIt(Properties.VeryInactivePhase);//WaitforIt(Properties.VeryInactivePhase) Complexity.SelectIndex(1); WaitforIt(Properties.VeryInactivePhase); SaveTask.WaitUntil(); SaveTask.Clicks(); AddBtn.WaitUntil(); }
public void AddNewTask1() { TaskElement("Maintenance Spend - WTD").Clicks(); RemoveTask.WaitUntil(); RemoveTask.Clicks(); AddBtn.Clicks(); AddNewTask.Clicks(); TaskName.WaitUntil(); TaskName.EnterText("Test Task 1"); TaskTypeParent("Office Tasks").Clicks(); TaskTypeChild("Discipline").Clicks(); WaitforIt(Properties.VeryInactivePhase); Complexity.SelectIndex(1); WaitforIt(Properties.VeryInactivePhase); SaveTask.WaitUntil(); SaveTask.Clicks(); AddBtn.WaitUntil(); }
public void AddNewTask4() { AddBtn.WaitUntil(); AddBtn.Clicks(); AddNewTask.Clicks(); TaskName.WaitUntil(); TaskName.EnterText("Unplanned Task 2"); TaskTypeParent("Office Tasks").Clicks(); TaskTypeChild("Discipline").Clicks(); WaitforIt(Properties.VeryInactivePhase); Complexity.SelectIndex(1); WaitforIt(Properties.InactivePhase); UCodeNewTask.WaitUntil(); UCodeNewTask.Clicks(); WaitforIt(Properties.VeryInactivePhase); UCommentNewTask.EnterText("Unplanned2"); WaitforIt(Properties.InactivePhase); SaveTask.WaitUntil(); SaveTask.Clicks(); WaitforIt(Properties.InactivePhase); AddBtn.WaitUntil(); }
public override int GetHashCode() { int hash = 1; if (TaskID != 0) { hash ^= TaskID.GetHashCode(); } if (MaxDoneCount != 0) { hash ^= MaxDoneCount.GetHashCode(); } if (TaskName.Length != 0) { hash ^= TaskName.GetHashCode(); } if (TaskDesc.Length != 0) { hash ^= TaskDesc.GetHashCode(); } if (FinishConditionID != 0) { hash ^= FinishConditionID.GetHashCode(); } hash ^= stage_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private async void RunTask(TaskName taskName, string arg1, string arg2, Action <ERROR_CODE> callback) { // 비동기로 Worker Thread에서 도는 task1 // Task.Run(): .NET Framework 4.5+ ERROR_CODE result = ERROR_CODE.NONE; switch (taskName) { case TaskName.OPEN_DEVICE: result = await ble.OpenDevice(arg1); listStatus.Items.Add($"ErrorCode: {result}"); break; case TaskName.SET_SERVICE: //task1 = Task.Run(() => bleservice.SetService(deviceName)); //result = await task1; result = await ble.SetService(arg2); listStatus.Items.Add($"ErrorCode: {result}"); break; case TaskName.READ_CHARACTERISTIC: result = await ble.ReadCharacteristic(arg1, arg2); listStatus.Items.Add($"ErrorCode: {result}"); if (result == ERROR_CODE.NONE) { var readstring = ble.getCharacteristic(); listStatus.Items.Add($"Result: {readstring}"); } break; } callback(result); }
public int CreateVersion(TaskName _taskName, string _subtaskName, int _version) { int version = _version; Debug.Log("count m_mappingVersionPath = " + m_mappingVersionPath.Count); Debug.Log("current version = " + version); int highestVersion = m_mappingVersionPath.Keys.Max(); bool succes = int.TryParse(m_mappingVersionPath[highestVersion].Split('v')[1], out version); //un peu degeu, voir si _version ne devrait pas etre un string, au lieu de parser a chaque fois ladepuis le dictionnaire, ce qui peut etre source d'erreur. if (succes) { version += 1; //nom de la version Debug.Log("version = " + version); Debug.Log("_version = " + _version); m_mappingVersionPath[_version] = "work_v" + version.ToString().PadLeft(3, '0'); string path = Path.Combine(new string[] { m_assetPath, m_mappingTaskPath[_taskName], _subtaskName, m_mappingVersionPath[_version] }); Directory.CreateDirectory(path); Debug.Log("new path = " + path); } else { ModalWindows.ModalWindow.ThrowError("Error : the version has not been created. Probleme parsing previous version name"); } return(version); }
public void UpdateTaskButton(TaskName _name, TaskState _state, string _warningMessage) { Debug.Log("Update Task Buttons : name = " + _name + " state = " + _state); ColorBlock colBlock = m_pipelineButtons[_name].colors; Color col = colBlock.normalColor; switch (_state) { case TaskState.Todo: col = new Color(1f, 0.75f, 0.5f, 1.0f); break; case TaskState.Progressing: col = new Color(0.75f, 0.75f, 1.0f, 1.0f); break; case TaskState.Done: col = Color.green; break; } Debug.Log("Warning msg = " + _warningMessage); if (string.IsNullOrEmpty(_warningMessage) == false) { Debug.Log("Warning msg1 = " + _warningMessage); m_pipelineButtons[_name].transform.Find("WarningButton").gameObject.SetActive(true); } colBlock.normalColor = col; m_pipelineButtons[_name].colors = colBlock; }
/// <summary>Activate busy spinner.</summary> public void AddTask(TaskName name) { lock (TasksLock) { Tasks.Add(name); UpdateIcon(); } }
public TaskResult(TaskName name, bool result, TaskStatus status = TaskStatus.finished, object payload = null, string message = "") { this.name = name; this.result = result; this.status = status; this.payload = payload; this.message = message; }
//判断当前是否为投票项目 public bool IsVoteTask() { IsAutoVote = ConfigCore.GetConfig("isAutoVote") == "1"; return(TaskName.Equals(TASK_VOTE_PROJECT) || TaskName.Equals(TASK_VOTE_JIUTIAN) || TaskName.Equals(TASK_VOTE_YUANQIU) || TaskName.Equals(TASK_VOTE_MM) || TaskName.Equals(TASK_VOTE_ML) || TaskName.Equals(TASK_VOTE_JZ) || TaskName.Equals(TASK_VOTE_JT) || TaskName.Equals(TASK_VOTE_DM) || TaskName.Equals(TASK_VOTE_OUTDO)); }
/// <summary> /// Do the lookup! /// </summary> protected override void ProcessRecord() { // Setup for verbosity if we need it. var listener = new PSListener(this); Trace.Listeners.Add(listener); try { PandaTask t = null; bool needdatasets = OutputContainerNames.IsPresent || InputContainerNames.IsPresent; if (ParameterSetName == "TaskID") { t = TaskID.FindPandaJobWithTaskName(needdatasets); } if (ParameterSetName == "TaskObject") { t = PandaTaskObject.ID.FindPandaJobWithTaskName(needdatasets); } if (ParameterSetName == "TaskName") { t = TaskName.FindPandaJobWithTaskName(needdatasets); } if (ParameterSetName == "DatasetGRIDJob") { // Get the job and resulting dataset name. var job = JobParser.FindJob(JobName, JobVersion); var ds = job.ResultingDataSetName(DatasetName.Trim(), JobIteration); // Now, look up the job itself. t = (ds + "/").FindPandaJobWithTaskName(); } // We really can't deal with a bad task below. The returned objects are sufficiently complex. if (t == null) { throw new ArgumentException("Unable to find the task in panda: was it ever submitted?"); } // Dump the info to the output pipeline as requested. if (JobStatus.IsPresent) { WriteObject(t.status); } if (InputContainerNames.IsPresent) { WriteObject(t.DataSetNamesIN()); } if (OutputContainerNames.IsPresent) { WriteObject(t.DataSetNamesOUT()); } } finally { Trace.Listeners.Remove(listener); } }
public TraceIdentity(int id, TaskName name) { if (id < 0) { throw new ArgumentOutOfRangeException("id"); } this.TraceId = id; this.TaskName = name; }
public void CreateSubtask(TaskName _taskName, string _subtask) { string path = Path.Combine(PipelineSystem.System.GetPathTask(_taskName), _subtask); if (ConformToPipeline(path) == true)//if the path have been created so create the workV1 by default { path = Path.Combine(path, m_mappingVersionPath[1]); ConformToPipeline(path); } }
private bool ValidateTask() { if (String.IsNullOrEmpty(task.Name)) { TaskName.Focus(); return(false); } return(true); }
public Domain.Models.Task.Task Create(TaskName name, CategoryName categoryName) { var taskId = new TaskId(AssignId()); return(new Domain.Models.Task.Task( name, taskId, categoryName, new Domain.Models.Task.TaskStatus(Em_TaskStatus.Waiting))); }
protected TraceRecord(int traceId, TaskName taskName) { if (traceId < 0) { throw new ArgumentOutOfRangeException("traceId"); } this.TraceId = traceId; this.TaskName = taskName; this.instanceIdentity = null; }
/// <summary>Deactivate busy spinner if all tasks are gone.</summary> public void RemoveTask(TaskName name) { lock (TasksLock) { if (Tasks.Contains(name)) { Tasks.Remove(name); } UpdateIcon(); } }
/// <summary>Activate busy spinner.</summary> public void AddTask(TaskName name) { lock (TasksLock) { if (!Tasks.Contains(name)) { Tasks.Add(name); } UpdateIcon(); } }
public Guid CreateTask(Guid projectId, string name) { var aTaskName = new TaskName(name); var aProjectId = new ProjectId(projectId); var aTaskId = _taskRepository.GetNextIdentity(); var task = new Task(aTaskId, aProjectId, aTaskName); _taskRepository.Save(task); return(aTaskId.Value); }
public TaskReminder( TaskName taskName, DateTime dueDate, EmailAddress reminderTo, EmailAddress copyReminderTo ) { TaskName = taskName; DueDate = dueDate; ReminderTo = reminderTo; CopyReminderTo = copyReminderTo; }
private void OnNewTask(object sender, RoutedEventArgs e) { TaskName.Text = null; DueDate.SelectedDate = DateTime.Today; Instructions.Text = null; Animals.Clear(); Candidates.Clear(); TaskName.Focus(); ScheduleTask.IsEnabled = true; NewTask.IsEnabled = false; }
protected bool PrepareTaskAssembly(out Type taskType) { taskType = null; Assembly assembly = string.IsNullOrEmpty(TaskAssemblyName) ? typeof(MultiToolTask).Assembly : Assembly.LoadFrom(TaskAssemblyName); if (assembly == null) { Log.LogErrorWithCodeFromResources("General.InvalidValue", TaskAssemblyName.GetType().Name, GetType().Name); return(false); } taskType = assembly.GetType(TaskName); if (taskType == null) { Log.LogErrorWithCodeFromResources("General.InvalidValue", TaskName.GetType().Name, GetType().Name); return(false); } object obj = Activator.CreateInstance(taskType); if (new TrackedVCToolTaskInterfaceHelper(obj, taskType) == null) { Log.LogErrorWithCodeFromResources("General.InvalidValue", TaskName.GetType().Name, GetType().Name); return(false); } if (SchedulerVerbose) { Log.LogMessageFromResources("MultiTool.TaskFound", TaskName); } if (string.IsNullOrEmpty(ToolExe)) { ToolExe = (obj as ToolTask).ToolExe; } var pathToTool = ComputePathToTool(ToolPath, ToolExe); if (!string.IsNullOrEmpty(pathToTool)) { ToolPath = Path.GetDirectoryName(pathToTool); ToolExe = Path.GetFileName(pathToTool); } if (SchedulerVerbose) { Log.LogMessageFromResources("MultiTool.BuildingWith", ToolExe); } return(true); }
internal void Run(string[] args) { // Should you want to decompose to running single tasks you can just create a workflow containing nodes with no parents or // children. The system works out where to start by identifying nodes with no parents, and assuming they're immediately // runnable. The hosting workflow then gives you a handle by which you can treat the individual tasks as a related set. var t1 = new TaskName("TestNode1"); var t2 = new TaskName("TestNode2"); var t3 = new TaskName("TestNode3"); var t4 = new TaskName("TestNode4"); var t5 = new TaskName("TestNode5"); var t6 = new TaskName("TestNode6"); var type1 = new TaskType("testTaskType"); var workflow = new Common.Workflow(new WorkflowName("TestWorkflow")); workflow.AddTask(t1, new Payload("Node1"), type1, SimplePriority, EmptyTaskList, new[] { t2 }); workflow.AddTask(t2, new Payload("Node2"), type1, SimplePriority, EmptyTaskList, new[] { t3, t4, t5, t6 }); workflow.AddTask(t3, new Payload("Node3"), type1, SimplePriority, new[] { t2 }, EmptyTaskList); workflow.AddTask(t4, new Payload("Node4"), type1, SimplePriority, new[] { t2 }, EmptyTaskList); workflow.AddTask(t5, new Payload("Node5"), type1, SimplePriority, new[] { t2 }, EmptyTaskList); workflow.AddTask(t6, new Payload("Node6"), type1, SimplePriority, new[] { t2 }, EmptyTaskList); // A client will start acting on tasks immediately. May not want that to // be behaviour -- so might want to have an independent submit-only client. TaskHandler only needed for // submission. TaskHandler needs to be stateless, taking configuration for a specific task on a run call? No, that's // true per-task, but agiven ITaskHandler instance might be configured once wth e.g. compute resource connection details var th = new TaskHandler(); var wh = new WorkflowHandler(); var complete = new ManualResetEvent(false); var failed = new ManualResetEvent(false); wh.WorkflowComplete += (s, w) => { Console.WriteLine("workflow complete: " + w); complete.Set(); }; wh.WorkflowFailed += (s, w) => { Console.WriteLine("workflow failed: " + w); failed.Set(); }; EventHandler <Exception> eh = (s, e) => { }; var wm = new WorkflowManagement(ConnectionMultiplexer.Connect("localhost"), th, wh, new WorkflowManagementId("sampleApp"), eh); wm.ClearBacklog(); // Pushing a workflow causes it to be executed var id = wm.PushWorkflow(workflow); Console.WriteLine("Workflow pushed"); WaitHandle.WaitAny(new[] { failed, complete }); wm.CleanUp(id.ToString()); Console.ReadLine(); }
public void Establish() { s_dueDate = DateTime.UtcNow.AddDays(1); s_recipient = new EmailAddress("*****@*****.**"); s_copyTo = new EmailAddress("*****@*****.**"); s_taskName = new TaskName("My Task"); s_taskReminder = new TaskReminder( taskName: new TaskName(s_taskName), dueDate: s_dueDate, reminderTo: s_recipient, copyReminderTo: s_copyTo); }
void ReleaseDesignerOutlets() { if (CalendarSwitch != null) { CalendarSwitch.Dispose(); CalendarSwitch = null; } if (CattegoryPicker != null) { CattegoryPicker.Dispose(); CattegoryPicker = null; } if (DatePicker != null) { DatePicker.Dispose(); DatePicker = null; } if (Duration != null) { Duration.Dispose(); Duration = null; } if (NotificationSwitch != null) { NotificationSwitch.Dispose(); NotificationSwitch = null; } if (Save != null) { Save.Dispose(); Save = null; } if (TaskName != null) { TaskName.Dispose(); TaskName = null; } if (TaskShortLable != null) { TaskShortLable.Dispose(); TaskShortLable = null; } }
public Subtask_Model(AssetManagerModel _assetManager, TaskName _taskName, string _name, int _softwareIndex) : base(_assetManager, _taskName) { m_name = _name; Debug.Log("_softwareIndex = " + _softwareIndex + " Taskname = " + _taskName); m_software = AssetSystem.System.GetSoftwareList(m_taskName)[_softwareIndex]; //Debug.Log("Create a subtask"); m_mementoHandler = new MementoHandler(); //using memento pattern to handle saving/loading and also undo/redo in the PipelineSystem.System.CreateSubtask(m_taskName, m_name); //create the directory if not exist //todo : m_versions = pipelineSystem.GetVersions(subtaskName, TaskName) m_versions = PipelineSystem.System.GetVersionList(m_taskName, m_name); IsSelected = false; }