예제 #1
0
        private async void LoadJobs()
        {
            try
            {
                ShowBusyControl();

                Jobs.Clear();

                var jobs = (await _windowsServiceClient.GetJobsAsync())?
                           .Where(x => x != null)
                           .Where(x => SelectedJobState.HasValue ? x.State == SelectedJobState.Value : true)
                           .Where(x => SelectedDocumentType.HasValue ? x.Document.Type == SelectedDocumentType.Value : true)
                           .OrderByDescending(x => x.UpdatedOn);

                if (jobs == null)
                {
                    ShowMessageControl("Jobs cannot be loaded, the AutoPrintr service is not available. Please run the service and try again");
                    HideBusyControl();
                    return;
                }

                foreach (var job in jobs)
                {
                    Jobs.Add(job);
                }
            }
            catch (Exception e)
            {
                _loggingService?.WriteError(e);
            }
            finally
            {
                HideBusyControl();
            }
        }
예제 #2
0
        private void AddJob(string selectedJob)
        {
            IJobSettings job = null;

            //create the jobdetails and add
            if (selectedJob == "Data Update")
            {
                job = new DataUpdateJobSettings {
                    Name = GetJobName("DataUpdateJob"), UseTag = true, Frequency = BarSize.OneDay, Time = new TimeSpan(8, 0, 0), WeekDaysOnly = true
                };
            }
            else if (selectedJob == "Economic Release Update")
            {
                job = new EconomicReleaseUpdateJobSettings {
                    Name = GetJobName("EconomicReleaseUpdateJob"), BusinessDaysBack = 1, BusinessDaysAhead = 7, DataSource = "FXStreet"
                };
            }
            else if (selectedJob == "Dividend Update")
            {
                job = new DividendUpdateJobSettings {
                    Name = GetJobName("DividendUpdateJob"), BusinessDaysBack = 0, BusinessDaysAhead = 3, DataSource = "Nasdaq"
                };
            }
            else if (selectedJob == "Earnings Update")
            {
                job = new EarningsUpdateJobSettings {
                    Name = GetJobName("EarningsUpdateJob"), BusinessDaysBack = 0, BusinessDaysAhead = 3, DataSource = "Nasdaq"
                };
            }

            var jobVm = GetJobViewModel(job);

            Jobs.Add(jobVm);
            SelectedJob = jobVm;
        }
예제 #3
0
        async Task ExecuteLoadJobsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Jobs.Clear();
                var trackers = await DataStore.GetItemsAsync(true);

                foreach (var tracker in trackers)
                {
                    Jobs.Add(tracker);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public static void AddJob(this IScheduler scheduler, Type type)
        {
            //var type = typeof(T);
            object[] objAttrs = type.GetCustomAttributes(typeof(InvokeAttribute), true);
            if (objAttrs.Length > 0)
            {
                if (objAttrs[0] is InvokeAttribute attr)
                {
                    attr.Type = type;
                    Jobs.Add(attr.Name, attr);

                    var stop = ConfigurationManager.AppSettings["Stop"].Split(',');
                    if (stop.Contains(attr.Name))
                    {
                        return;
                    }

                    IJobDetail     job     = JobBuilder.Create(type).WithIdentity(attr.Name).Build();
                    ISimpleTrigger trigger = (ISimpleTrigger)TriggerBuilder.Create()
                                             .StartAt(DateTime.Parse(attr.StartTime))                        //设置任务开始时间
                                             .WithSimpleSchedule(x => x.WithIntervalInSeconds(attr.Interval) //循环的时间
                                                                 .RepeatForever())
                                             .Build();
                    scheduler.ScheduleJob(job, trigger);
                }
            }
        }
        private void Load( )
        {
            try
            {
                Jobs.Clear( );

                using (var cmd = DatabaseManager.CreateCommand("SELECT i.[Id], i.[Timestamp] FROM [dbo].[Lic_Index] i ORDER BY i.[Timestamp] DESC"))
                {
                    using (IDataReader reader = cmd.ExecuteReader( ))
                    {
                        while (reader.Read( ))
                        {
                            Jobs.Add(new IndexData
                            {
                                Id        = reader.GetInt64(0),
                                TimeStamp = reader.GetDateTime(1).ToLocalTime( )
                            });
                        }
                    }
                }
            }
            catch (Exception e)
            {
                PluginSettings.EventLog.WriteException(e);
            }
        }
예제 #6
0
        private async Task ExecuteLoadJobCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Jobs.Clear();
                var items = await JobManager.GetJobsForSingleClient(ClientId);

                if (items != null)
                {
                    foreach (var item in items)
                    {
                        Jobs.Add(item);
                    }
                }
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                IsBusy = false;
            }
        }
        private bool TryHandleNewJenkinsOverview(IEnumerable <JenkinsJob> refreshedJobs, string sourceUrl)
        {
            if (!string.Equals(sourceUrl, SelectedJenkinsServer.Url))
            {
                return(false);
            }

            var prevSelectedJob = SelectedJob;

            var jobsToAdd    = refreshedJobs.Except(Jobs);
            var jobsToUpdate = refreshedJobs.Intersect(Jobs);
            var jobsToRemove = Jobs.Except(refreshedJobs).ToArray();

            UIHelper.InvokeUI(() =>
            {
                foreach (var j in jobsToAdd)
                {
                    Jobs.Add(j);
                }
                foreach (var j in jobsToUpdate)
                {
                    var refreshedJobOriginal = Jobs.Single((ej) => object.Equals(ej, j));
                    MergeUpdatedJenkinsJob(j, refreshedJobOriginal);
                }
                foreach (var j in jobsToRemove)
                {
                    Jobs.Remove(j);
                }

                SelectedJob = Jobs.FirstOrDefault((oj) => object.Equals(oj, prevSelectedJob));
            });

            return(true);
        }
 public void AddAccessory(AccessoryModel accessory)
 {
     if (accessory.Count != 0)
     {
         Jobs.Add(accessory);
     }
 }
예제 #9
0
        public static void RegisterJobs()
        {
            var jobsPath = HttpContext.Current.Server.MapPath("~/Jobs/");

            if (!Directory.Exists(jobsPath))
            {
                return;
            }

            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new DirectoryCatalog(jobsPath));
            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));

            var container = new CompositionContainer(catalog);

            container.ComposeParts();

            var exports = container.GetExportedValues <IJob>();

            foreach (var job in exports)
            {
                Jobs.Add(job);
            }
        }
예제 #10
0
        private async Task LoadJobsAsync(bool clearList = false)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            var result = await JobService.SearchAsync(SearchText, _filter?.Groups[0], _filter?.IsRemote, CurrentPage ++);

            TotalPages = result.Total_Pages;
            Device.BeginInvokeOnMainThread(() =>
            {
                if (clearList)
                {
                    Jobs.Clear();
                }
                foreach (var item in result.Results)
                {
                    Jobs.Add(new JobDetailViewModel(item));
                }
            });

            IsBusy = false;
        }
예제 #11
0
 private void CreateJobs(int numberOfJobs)
 {
     for (int i = 0; i < numberOfJobs; i++)
     {
         Jobs.Add(new OrderAction(Generate10ThousandRandomNumbers()));
     }
 }
예제 #12
0
        /// <summary>
        /// Initializes this scheduler by creating its timer jobs.
        /// </summary>
        protected override void Initialize()
        {
            WorkstationLogger.Instance.WriteLog("Initialize...", LogType.Debug, false);

            // Load plugins from the workstation
            List <IPlugin> loadedPlugins = PluginManager.Instance.LoadAvailablePlugins();

            WorkstationLogger.Instance.WriteLog("loaded Plugins: " + loadedPlugins.Count.ToString(), LogType.Debug, false);

            // Synchronize the plugins with the server
            PluginManager.Instance.UpdatePlugins();


            // Start the schedulers for all indicators
            foreach (IPlugin p in PluginManager.Instance.GetLoadedPlugins())
            {
                foreach (IndicatorSettings indicatorSetting in p.GetIndicatorSettings())
                {
                    TimeSpan updateInterval = new TimeSpan(indicatorSetting.UpdateInterval.Ticks);
                    Jobs.Add(new IndicatorTimerJob(p, indicatorSetting.IndicatorName, updateInterval));
                }
            }

            // Start the main update scheduler
            Jobs.Add(new MainUpdateTimerJob());
        }
예제 #13
0
파일: JobListVM.cs 프로젝트: mehabadi/HPMS
 public JobListVM()
 {
     BasicInfoAppLocalizedResources = new BasicInfoAppLocalizedResources();
     init();
     Jobs.Add(new JobDTOWithActions {
         Id = 4, Name = "Test"
     });
 }
예제 #14
0
 public void AddJobToMachine(Job job)
 {
     Jobs.Add(job);
     for (int i = 0; i < job.Time; i++)
     {
         Chunks.Add(job.Number);
     }
 }
예제 #15
0
        public void ScheduleTask(int miliseconds, Guid taskId, Action func)
        {
            var cts   = new CancellationTokenSource();
            var token = cts.Token;

            Jobs.Add(new Tuple <CancellationTokenSource, Guid>(cts, taskId));
            Task.Delay(miliseconds).ContinueWith(t => { func(); }, token);
        }
예제 #16
0
        public Schedule AndThen <T>() where T : IJob
        {
            //If no job factory has been added to the schedule, use the default.
            var factory = JobManager.JobFactory ?? new JobFactory();

            Jobs.Add(() => factory.GetJobInstance <T>().Execute());
            return(this);
        }
예제 #17
0
        public void Add(string filename)
        {
            var job = new Job {
                FullPath = filename
            };

            Jobs.Add(job);
        }
        public void Save(IJob obj)
        {
            var job = (Job)obj;

            if (!Jobs.Any(j => job.JobId == j.JobId))
            {
                Jobs.Add(job);
            }
        }
예제 #19
0
파일: JobModel.cs 프로젝트: Fox-Alpha/pping
        /// <summary>
        /// Starts a new job
        /// </summary>
        public PingJob StartNew()
        {
            var job = new PingJob(this);

            Jobs.Add(job);
            CurrentJob = job;
            job.Start();
            return(job);
        }
        public JobsOfProtocolStep(string protocolStepName, IEnumerableExpression <IJob> jobs, ITransformationContext context) : this(context)
        {
            _protocolStepName = protocolStepName;

            foreach (var item in jobs)
            {
                Jobs.Add(item);
            }
        }
예제 #21
0
        private void newEntryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var new_entry = new New_Entry())
            {
                new_entry.ShowDialog();

                if (new_entry.DialogResult == DialogResult.OK)
                {
                    Jobs.Add(new_entry.NewJob);

                    int index;
                    if (dataGridView1.Rows.Count == 0)
                    {
                        index = 1;
                    }
                    else
                    {
                        DataGridViewRow LastRow = dataGridView1.Rows[dataGridView1.Rows.Count - 1];
                        index = Convert.ToInt16(LastRow.Cells[0].Value) + 1;
                    }

                    ListOfIds.Add(index);

                    int             num = Jobs.Count();
                    DataGridViewRow row = new DataGridViewRow();
                    row.CreateCells(dataGridView1);
                    row.Cells[0].Value = index.ToString();
                    row.Cells[1].Value = Jobs[num - 1].Started.ToString("yyyy-MM-dd HH:mm:ss");
                    row.Cells[2].Value = Jobs[num - 1].Finished.ToString("yyyy-MM-dd HH:mm:ss");
                    row.Cells[3].Value = Jobs[num - 1].Total;
                    row.Cells[4].Value = Jobs[num - 1].Assigned_by;
                    row.Cells[5].Value = Jobs[num - 1].Comment;

                    dataGridView1.Rows.Add(row);


                    using (var con = new SQLiteConnection(ConnectionString))
                    {
                        con.Open();

                        var sql = "INSERT INTO times(Started,Finished,Total,Assigned_by,Comment) VALUES('" + new_entry.NewJob.Started.ToString("yyyy-MM-dd HH:mm:ss")
                                  + "','" + new_entry.NewJob.Finished.ToString("yyyy-MM-dd HH:mm:ss") + "','" + new_entry.NewJob.Total + "','" + new_entry.NewJob.Assigned_by + "','" + new_entry.NewJob.Comment + "')";


                        var cmd = new SQLiteCommand(sql, con);
                        cmd.ExecuteNonQuery();

                        con.Close();
                    }
                    if (dataGridView1.Rows.Count > 0)
                    {
                        editSelectedToolStripMenuItem.Enabled   = true;
                        deleteSelectedToolStripMenuItem.Enabled = true;
                    }
                }
            }
        }
예제 #22
0
        /// <summary>
        /// Schedules another job to be run with this schedule.
        /// </summary>
        /// <param name="job">Job to run.</param>
        public Schedule AndThen(Action job)
        {
            if (job == null)
            {
                throw new ArgumentNullException("job");
            }

            Jobs.Add(job);
            return(this);
        }
예제 #23
0
        /// <summary>
        /// Schedules another job to be run with this schedule.
        /// </summary>
        /// <param name="job">Job to run.</param>
        public Schedule AndThen(Func <IJob> job)
        {
            if (job == null)
            {
                throw new ArgumentNullException("job");
            }

            Jobs.Add(JobManager.GetJobAction(job));
            return(this);
        }
예제 #24
0
 public void Search(string dir)
 {
     foreach (string file in Directory.EnumerateFiles(dir, "*.xml"))
     {
         var job = new Job {
             FullPath = file
         };
         Jobs.Add(job);
     }
 }
예제 #25
0
        private IEnumerable <Event> Handle(MaintenanceJobPlanned e)
        {
            MaintenanceJob job      = new MaintenanceJob();
            Customer       customer = new Customer(e.CustomerInfo.Id, e.CustomerInfo.Nombre, e.CustomerInfo.Telefono);
            Vehicle        vehicle  = new Vehicle(e.VehicleInfo.Matricula, e.VehicleInfo.Marca, e.VehicleInfo.Modelo, customer.CustomerId);

            job.Plan(e.JobId, e.StartTime, e.EndTime, vehicle, customer, e.Description);
            Jobs.Add(job);
            return(new Event[] { e });
        }
예제 #26
0
        public void LoadJobs()
        {
            var jobs = JobService.GetAllJobs();

            Jobs.Clear();
            foreach (var v in jobs)
            {
                Jobs.Add(v);
            }
        }
예제 #27
0
        private void DoAddJob(Func <IJobViewModel> jobFactory)
        {
            var job = jobFactory();

            job.Name = Jobs.GetUniqueName("Job");
            Jobs.Add(job);
            SelectedJob = job;
            job.Save();
            contentManager.Load(job);
        }
예제 #28
0
        /// <summary>
        /// Add a job to the runner.
        /// </summary>
        /// <param name="job.Name"></param>
        /// <param name="job"></param>
        public void Add(Job job)
        {
            _eventContext.JobRegistered(job);

            // Add the job to the job list.
            Jobs.Add(job.Name, job);

            // Store the event context in the job, so it can also send events.
            job.EventContext = _eventContext;
        }
예제 #29
0
        private IEnumerable <Event> Handle(MaintenanceJobPlanned e)
        {
            MaintenanceJob job      = new MaintenanceJob();
            Customer       customer = new Customer(e.CustomerInfo.Id, e.CustomerInfo.Name, e.CustomerInfo.TelephoneNumber);
            Vehicle        vehicle  = new Vehicle(e.VehicleInfo.LicenseNumber, e.VehicleInfo.Brand, e.VehicleInfo.Type, customer.CustomerId);

            job.Plan(e.JobId, e.StartTime, e.EndTime, vehicle, customer, e.Description);
            Jobs.Add(job);
            return(new Event[] { e });
        }
예제 #30
0
    public CharacterCat()
    {
        Name        = "Kittycat";
        Description = "Kittycat is a sassy cat princess";
        JobPrincess baseJob = new JobPrincess();

        Jobs.Add(baseJob);
        ActiveJobIndex = 0;
        TextureName    = "ac_kitty";
    }