本文整理汇总了C#中Job类的典型用法代码示例。如果您正苦于以下问题:C# Job类的具体用法?C# Job怎么用?C# Job使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Job类属于命名空间,在下文中一共展示了Job类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: StartRunningJob
private void StartRunningJob(Job job)
{
Logger.Info("Starting WorkerProcess for job {0}", job.Id);
Process process = new Process
{
StartInfo =
{
FileName = ConfigurationManager.AppSettings["WorkerProcessLocation"],
Arguments = string.Format("-i {0}", job.Id),
UseShellExecute = false,
CreateNoWindow = true,
ErrorDialog = false,
RedirectStandardError = true
}
};
process.Start();
process.WaitForExit();
if (process.ExitCode != 0)
{
Logger.Error("Worker process for job ID: {0} exited with error.", job.Id);
//using (var repo = new JobRepository())
//{
// //repo.UpdateStateForJob(job, JobState.CompletedWithError, "Unspecified error");
//}
}
else
{
Logger.Info("Worker process for job ID: {0} completed.", job.Id);
}
}
开发者ID:tompoole,项目名称:DeploymentManager,代码行数:33,代码来源:DeploymentManagerService.cs
示例2: CreateAndSendSignatureJob
public async Task CreateAndSendSignatureJob()
{
ClientConfiguration clientConfiguration = null; //As initialized earlier
var directClient = new DirectClient(clientConfiguration);
var documentToSign = new Document(
"Subject of Message",
"This is the content",
FileType.Pdf,
@"C:\Path\ToDocument\File.pdf");
var exitUrls = new ExitUrls(
new Uri("http://redirectUrl.no/onCompletion"),
new Uri("http://redirectUrl.no/onCancellation"),
new Uri("http://redirectUrl.no/onError")
);
var job = new Job(
documentToSign,
new Signer(new PersonalIdentificationNumber("12345678910")),
"SendersReferenceToSignatureJob",
exitUrls
);
var directJobResponse = await directClient.Create(job);
}
开发者ID:digipost,项目名称:signature-api-client-docs-regression-tests,代码行数:26,代码来源:DirectClient.cs
示例3: CreateStartBilling
/// <summary>
/// 创建步骤 2 ,开始Billing
/// </summary>
/// <param name="jb">Job 实例</param>
/// <param name="databaseName">数据库名</param>
/// <param name="strSQl">SQL命令</param>
public void CreateStartBilling(Job jb, string databaseName, string strSQl)
{
try
{
JobStep jbstp = new JobStep(jb, "开始Billing");
//数据库
jbstp.DatabaseName = databaseName;
//计划执行的SQL命令
jbstp.Command = strSQl;
//* 制定执行步骤
//成功时执行的操作
jbstp.OnSuccessAction = StepCompletionAction.QuitWithSuccess;
//jbstp.OnSuccessAction = StepCompletionAction.GoToStep;
//jbstp.OnSuccessStep = 3;
//失败时执行的操作
jbstp.OnFailAction = StepCompletionAction.QuitWithFailure;
//创建 SQL 代理实例的作业步骤.
jbstp.Create();
}
catch (Exception)
{
throw;
}
}
开发者ID:hijushen,项目名称:WindowDemo,代码行数:35,代码来源:Steps.cs
示例4: Engage
/// <summary>
/// Engages autopilot execution to FinalDestination either by direct
/// approach or following a course.
/// </summary>
public void Engage(Vector3 destination) {
if (_job != null && _job.IsRunning) {
_job.Kill();
}
Destination = destination;
_job = new Job(Engage(), true);
}
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:11,代码来源:AutoPilot.cs
示例5: RetrieveVacancy
Job RetrieveVacancy()
{
var objJobId = Request.QueryString["jobid"];
var isInvalid = false;
var j = new Job();
if (objJobId != null && objJobId.IsNumeric() && int.Parse(objJobId) > 0)
{
var jobId = int.Parse(objJobId);
//retrieve vacancy object
j = new Jobs().GetJob(jobId);
//validate
if (j == null || j.JobId <= 0)
{
isInvalid = true;
}
//******** NEED TO IMPLEMENT CHECK CLIENT USERS PERMISSIONS ******
}
else
isInvalid = true;
if (isInvalid)
//invalid request redirect
Response.Redirect("/404.aspx");
return j;
}
开发者ID:NosDeveloper2,项目名称:RecruitGenie,代码行数:31,代码来源:vacancy-management.aspx.cs
示例6: EndTree
Job EndTree(Job job, JobStatus endStatus)
{
// If this is the root, mutate to completed status.
if (job.ParentId == null)
return _jobMutator.Mutate<EndTransition>(job, status: JobStatus.Completed);
job = _jobMutator.Mutate<EndTransition>(job, PendingEndStatus[endStatus]);
/*
* First, load the parent, find the await record for this job and
* update its status to end status.
*/
// ReSharper disable once PossibleInvalidOperationException
var parent = _jobRepository.Load(job.ParentId.Value);
var @await = parent.Continuation.Find(job);
@await.Status = endStatus;
/*
* After we set the await's status, invoke ContinuationDispatcher to
* ensure any pending await for parent is dispatched.
* If ContinuationDispatcher returns any awaits, that means parent job is not
* ready for completion.
*/
var pendingAwaits = _continuationDispatcher.Dispatch(parent);
if (!pendingAwaits.Any())
EndTree(parent, JobStatus.Completed);
return _jobMutator.Mutate<EndTransition>(job, endStatus);
}
开发者ID:GeeksDiary,项目名称:Molecules,代码行数:30,代码来源:EndTransition.cs
示例7: JobOnThing
public override Job JobOnThing( Pawn pawn, Thing t )
{
var warden = pawn;
var slave = t as Pawn;
if(
( slave == null )||
( slave.guest == null )||
( slave.guest.interactionMode != Data.PIM.FreeSlave )||
( slave.Downed )||
( !slave.Awake() )||
( !warden.CanReserveAndReach(
slave,
PathEndMode.ClosestTouch,
warden.NormalMaxDanger(),
1 )
)
)
{
return null;
}
var collar = slave.WornCollar();
if( collar == null )
{ // Slave isn't wearing a collar, wut?
return null;
}
IntVec3 result;
if( !RCellFinder.TryFindPrisonerReleaseCell( slave, warden, out result ) )
{
return null;
}
var job = new Job( Data.JobDefOf.FreeSlave, slave, collar, result );
job.maxNumToCarry = 1;
return job;
}
开发者ID:ForsakenShell,项目名称:Es-Small-Mods,代码行数:34,代码来源:WorkGiver_Warden_FreeSlave.cs
示例8: TestDontRunAtFirstIfCoresNotAvailable
public void TestDontRunAtFirstIfCoresNotAvailable()
{
BenchmarkSystem Bs = new BenchmarkSystem();
//jobs that needs in all 27 cpus, should execute with no problems.
Job job1 = new Job((string[] arg) => { return arg.Length.ToString(); }, new Owner("morten12"), 9, 10000);
Job job2 = new Job((string[] arg) => { return arg.Length.ToString(); }, new Owner("morten22"), 9, 10000);
Job job3 = new Job((string[] arg) => { return arg.Length.ToString(); }, new Owner("morten32"), 9, 10000);
Bs.Submit(job1);
Bs.Submit(job2);
Bs.Submit(job3);
//this job requires too many cores and should therefore not run immediately
Job job4 = new Job((string[] arg) => { return arg.Length.ToString(); }, new Owner("morten4"), 9, 10000);
Bs.Submit(job4);
Task task = Task.Factory.StartNew(() => Bs.ExecuteAll());
Thread.Sleep(1000);
Assert.AreEqual(State.Running, job1.State);
Assert.AreEqual(State.Running, job2.State);
Assert.AreEqual(State.Running, job3.State);
// this job should not be running as there aren't enough cores for it to run.
Assert.AreEqual(State.Submitted, job4.State);
//it should run after the cores become available
Thread.Sleep(12000);
Assert.AreEqual(State.Running, job4.State);
// NOTE: this test fails because the first three submitted jobs dont run simultaneusly. The factory method of Task should run them in separate threads, but somehow choses to
// run them chronological instead. Maybe you can explain why? Thank you in advance.
}
开发者ID:BDSAMacGyvers,项目名称:AS41,代码行数:28,代码来源:ThreadTester.cs
示例9: Execute
public override void Execute(string filename, bool testModus, Job job) {
Console.WriteLine(" Delete '{0}'", filename);
if (testModus) {
return;
}
File.Delete(filename);
}
开发者ID:slieser,项目名称:sandbox,代码行数:7,代码来源:Delete.cs
示例10: Ctor_ShouldInitializeAllProperties
public void Ctor_ShouldInitializeAllProperties()
{
var job = new Job(_methodData, _arguments);
Assert.Same(_methodData, job.MethodData);
Assert.Same(_arguments, job.Arguments);
}
开发者ID:hahmed,项目名称:HangFire,代码行数:7,代码来源:JobFacts.cs
示例11: nextLevel
public void nextLevel()
{
contractshown = false;
if(currentJob>=jobs.Count){
Application.LoadLevel("End");
}
else{
job = jobs[currentJob];
CVGenerator cvGenerator = new CVGenerator();
cvList = new List<CV>();
int numberOfCVs = Random.Range(4, 7);
for (int num = 0; num < numberOfCVs; num++)
{
Candidate candidate = new Candidate(ref maleSprites, ref femaleSprites);
cvList.Add(cvGenerator.generateCV(candidate));
}
currentCV = 0;
renderCV();
showJob();
refreshHUD();
}
}
开发者ID:Scythus,项目名称:InhumanResources,代码行数:27,代码来源:UIManagerScript.cs
示例12: postprocess
private static LogItem postprocess(MainForm mainForm, Job ajob)
{
if (!(ajob is D2VIndexJob)) return null;
D2VIndexJob job = (D2VIndexJob)ajob;
if (job.PostprocessingProperties != null) return null;
StringBuilder logBuilder = new StringBuilder();
VideoUtil vUtil = new VideoUtil(mainForm);
Dictionary<int, string> audioFiles = vUtil.getAllDemuxedAudio(job.AudioTracks, job.Output, 8);
if (job.LoadSources)
{
if (job.DemuxMode != 0 && audioFiles.Count > 0)
{
string[] files = new string[audioFiles.Values.Count];
audioFiles.Values.CopyTo(files, 0);
Util.ThreadSafeRun(mainForm, new MethodInvoker(
delegate
{
mainForm.Audio.openAudioFile(files);
}));
}
// if the above needed delegation for openAudioFile this needs it for openVideoFile?
// It seems to fix the problem of ASW dissapearing as soon as it appears on a system (Vista X64)
Util.ThreadSafeRun(mainForm, new MethodInvoker(
delegate
{
AviSynthWindow asw = new AviSynthWindow(mainForm, job.Output);
asw.OpenScript += new OpenScriptCallback(mainForm.Video.openVideoFile);
asw.Show();
}));
}
return null;
}
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:34,代码来源:FileIndexerWindow.cs
示例13: UpdateOrder
public async Task<ReplaceOneResult> UpdateOrder(Job job, OrderModel orderModel)
{
if (job.Order.Type != orderModel.Type)
{
throw new InvalidOperationException("Updating with a different ordermodel for this job");
}
// FIXME: Finding a resolver here would help here dude
switch (orderModel.Type)
{
case OrderTypes.Delivery:
case OrderTypes.ClassifiedDelivery:
{
var orderCalculationService = new DefaultOrderCalculationService();
var serviceChargeCalculationService = new DefaultDeliveryServiceChargeCalculationService();
var orderProcessor = new DeliveryOrderProcessor(
orderCalculationService,
serviceChargeCalculationService);
orderProcessor.ProcessOrder(orderModel);
var jobUpdater = new DeliveryJobUpdater(job);
jobUpdater.UpdateJob(orderModel);
job = jobUpdater.Job;
break;
}
}
var result = await UpdateJob(job);
return result;
}
开发者ID:NerdCats,项目名称:TaskCat,代码行数:29,代码来源:JobRepository.cs
示例14: Initialize
public void Initialize()
{
scheduler = Scheduler.getInstance();
job1 = new Job((string[] args) => { foreach (string s in args) { Console.Out.WriteLine(s); } return ""; }, new Owner("owner1"), 2, 3);
job2 = new Job((string[] args) => { foreach (string s in args) { Console.Out.WriteLine(s); } return ""; }, new Owner("owner2"), 2, 45);
job3 = new Job((string[] args) => { foreach (string s in args) { Console.Out.WriteLine(s); } return ""; }, new Owner("owner3"), 2, 200);
}
开发者ID:BDSAMacGyvers,项目名称:AS38,代码行数:7,代码来源:SchedulerTest.cs
示例15: Play
public void Play(float itemRadius) {
D.Assert(itemRadius > Constants.ZeroF);
float currentScale = itemRadius * _radiusToScaleNormalizeFactor;
if (currentScale != _prevScale) {
float relativeScale = currentScale / _prevScale;
ScaleParticleSystem(_primaryParticleSystem, relativeScale);
foreach (ParticleSystem pSystem in _childParticleSystems) {
ScaleParticleSystem(pSystem, relativeScale);
}
_prevScale = currentScale;
}
_primaryParticleSystem.Play(withChildren: true);
D.AssertNull(_waitForExplosionFinishedJob);
bool includeChildren = true;
string jobName = "WaitForExplosionFinishedJob";
_waitForExplosionFinishedJob = _jobMgr.WaitForParticleSystemCompletion(_primaryParticleSystem, includeChildren, jobName, isPausable: true, waitFinished: (jobWasKilled) => {
if (jobWasKilled) {
// 12.12.16 An AssertNull(_jobRef) here can fail as the reference can refer to a new Job, created
// right after the old one was killed due to the 1 frame delay in execution of jobCompleted(). My attempts at allowing
// the AssertNull to occur failed. I believe this is OK as _jobRef is nulled from KillXXXJob() and, if
// the reference is replaced by a new Job, then the old Job is no longer referenced which is the objective. Jobs Kill()ed
// centrally by JobManager won't null the reference, but this only occurs during scene transitions.
}
else {
_waitForExplosionFinishedJob = null;
HandleExplosionFinished();
}
MyPoolManager.Instance.DespawnEffect(transform);
});
}
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:31,代码来源:Explosion.cs
示例16: CreateJob
public async Task<Job> CreateJob(CreateJobInput input)
{
//We can use Logger, it's defined in ApplicationService class.
Logger.Info("Creating a job for input: " + input);
//Creating a new Task entity with given input's properties
var job = new Job { Description = input.Description, Detail = input.Detail, AccountId = input.AccountId, Type = input.Type, AssignedUserId = input.AssignedUserId , PrimaryContactId = input.PrimaryContactId, Source = input.Source, Priority = input.Priority};
job.PrimaryContact = _contactRepository.Get((long)job.PrimaryContactId);
job.Account = _accountRepository.Get((long)job.AccountId);
job.AssignedUser = await _userManager.FindByIdAsync((long)job.AssignedUserId);
//TODO: Complete creating an external Job in SLX
string createdUserId = (await _userManager.FindByIdAsync((long)AbpSession.UserId)).ExternalId;
///Update in External System (Saleslogix if enabled)
String result = CreateExternal(job.Account.ExternalId,job.PrimaryContact.ExternalId,createdUserId,job.AssignedUser.ExternalId,job.Description,job.Detail,"",job.Priority.ToString(),job.Source.ToString());
job.ExternalId = result;
//Saving entity with standard Insert method of repositories.
return await _jobRepository.InsertAsync(job);
}
开发者ID:jonquickqsense,项目名称:projectkorai,代码行数:27,代码来源:JobAppService.cs
示例17: Deserialize
public object Deserialize(JsonValue json, JsonMapper mapper)
{
var job = new Job();
var clientJson = json.GetValue("client");
job.Id = json.GetValueOrDefault<string>("id", "");
job.Title = json.GetValueOrDefault<string>("title", "");
job.Snippet = json.GetValueOrDefault<string>("snippet", "");
job.Skills = deserializeSkills(json.GetValues("skills"));
job.Category = json.GetValueOrDefault<string>("category", "");
job.Subcategory = json.GetValueOrDefault<string>("subcategory", "");
job.JobType = json.GetValueOrDefault<string>("job_type", "");
job.Duration = json.GetValueOrDefault<string>("duration", "");
job.Budget = json.GetValueOrDefault<string>("budget", "");
job.Workload = json.GetValueOrDefault<string>("workload", "");
job.Status = json.GetValueOrDefault<string>("job_status", "");
job.Url = json.GetValueOrDefault<string>("url", "");
job.DateCreated = json.GetValueOrDefault<DateTime>("date_created", DateTime.MinValue);
if (clientJson != null)
{
job.Client.Country = clientJson.GetValueOrDefault<string>("country", "");
job.Client.FeedbackRating = clientJson.GetValueOrDefault<float>("feedback", 0);
job.Client.ReviewCount = clientJson.GetValueOrDefault<int>("reviews_count", 0);
job.Client.JobCount = clientJson.GetValueOrDefault<int>("jobs_posted", 0);
job.Client.HireCount = clientJson.GetValueOrDefault<int>("past_hires", 0);
job.Client.PaymentVerificationStatus = clientJson.GetValueOrDefault<string>("payment_verification_status", "");
}
return job;
}
开发者ID:javaday,项目名称:Spring.Social.oDesk,代码行数:32,代码来源:JobDeserializer.cs
示例18: Main
static void Main(string[] args)
{
Server server = new Server(".");
// Get instance of SQL Agent SMO object
JobServer jobServer = server.JobServer;
Job job = null;
JobStep step = null;
JobSchedule schedule = null;
// Create a schedule
schedule = new JobSchedule(jobServer, "Schedule_1");
schedule.FrequencyTypes = FrequencyTypes.OneTime;
schedule.ActiveStartDate = DateTime.Today;
schedule.ActiveStartTimeOfDay = new TimeSpan(DateTime.Now.Hour, (DateTime.Now.Minute + 2), 0);
schedule.Create();
// Create Job
job = new Job(jobServer, "Job_1");
job.Create();
job.AddSharedSchedule(schedule.ID);
job.ApplyToTargetServer(server.Name);
// Create JobStep
step = new JobStep(job, "Step_1");
step.Command = "SELECT 1";
step.SubSystem = AgentSubSystem.TransactSql;
step.Create();
}
开发者ID:sethusrinivasan,项目名称:SMO,代码行数:29,代码来源:CreateAgentJob.cs
示例19: GenerateButton_Click
private void GenerateButton_Click(object sender, EventArgs e)
{
string filename;
InitialiseSaveDialog();
if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
filename = saveFileDialog.FileName;
string dstLang = destinationLanguage.SelectedItem.ToString();
string queryType = queryTypeComboBox.SelectedItem.ToString();
Job job = new Job(
connectionStringTextBox.Text,
dstTableTextBox.Text,
filename,
sqlTextBox.Text,
() => QueryWriterFactory.Instance.Get(dstLang),
() => QueryFactory.Instance.Get(queryType),
(j,c) => HandleKeysRequired(j,c),
(j, ex) => HandleException(j, ex),
(j) => HandleComplete(j));
StartScriptGeneration();
job.Process();
}
else
{
statusLabel.Text = "Cancelled.";
}
}
开发者ID:harryrose,项目名称:SQLGenerator,代码行数:29,代码来源:MainForm.cs
示例20: JobOnThing
public override Job JobOnThing(Pawn pawn, Thing t)
{
Building_RepairStation rps = ListerDroids.ClosestRepairStationFor(pawn,t);
Job job = new Job(ReactivateDroidJobDef, t, rps);
job.maxNumToCarry = 1;
return job;
}
开发者ID:ProfoundDarkness,项目名称:MD2-Source,代码行数:7,代码来源:WorkGiver_ReactivateDroid.cs
注:本文中的Job类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论