Exemplo n.º 1
0
        public override void Pulse()
        {
            if (_waitTime == TimeSpan.FromTicks(0))
            {
                _waitTime = TimeSpan.FromMinutes(Minutes + Utility.Rand.Next(-RandomMinutes, RandomMinutes));
                Profile.Log("Waiting for {0} minutes before executing next task", _waitTime.TotalMinutes);
                _timeStamp = DateTime.Now;
            }

            BMTask nextTask = NextTask;

            if (nextTask != null)
            {
                ToolTip = string.Format(
                    "Running {0} task in {1} minutes",
                    nextTask,
                    (int)((_waitTime - (DateTime.Now - _timeStamp)).TotalMinutes));
            }


            if (DateTime.Now - _timeStamp >= _waitTime)
            {
                IsDone = true;
                Profile.Log("Wait complete");
                ToolTip = string.Format("Wait: {0} minutes", Minutes);
            }
        }
Exemplo n.º 2
0
 void ICustomTaskEditControlDataBound.SetBinding(BMTask source, string path)
 {
     _task = (ChangeProfileTask)source;
     // binding issues.. so just hooking an event.
     // Binding binding = new Binding(path);
     // binding.Source = source;
     // SetBinding(FileNameProperty, binding);
 }
Exemplo n.º 3
0
 void ICustomTaskEditControlDataBound.SetBinding(BMTask source, string path)
 {
     _task = (LogonTask)source;
     // binding issues.. so just hooking an event.
     // Binding binding = new Binding(path);
     // binding.Source = source;
     // SetBinding(FileNameProperty, binding);
 }
Exemplo n.º 4
0
	    private void PulseTasks()
	    {
		    if (!Tasks.Any())
			    return;

			// reset tasks if they're all complete
			if (Tasks.All(t => t.IsDone))
			{
				foreach (var task in Tasks)
					task.Reset();
			}

			// get the 1st task that isn't done and pulse it.
			CurrentTask = Tasks.FirstOrDefault(t => !t.IsDone);
			if (CurrentTask != null)
			{
				if (!CurrentTask.IsRunning)
					CurrentTask.Start();
				CurrentTask.Pulse();
				if (CurrentTask is WaitTask && CurrentTask.IsRunning)
					Profile.TaskTooltip = CurrentTask.ToolTip;
				else if (!string.IsNullOrEmpty(Profile.TaskTooltip))
					Profile.TaskTooltip = null;
			}
	    }