예제 #1
0
        /// <summary>
        /// 获取结束回调
        /// </summary>
        /// <param name="users"></param>
        private void GetJobListEnd(ICollection <Job> jobs)
        {
            //GalaSoft.MvvmLight.Threading.DispatcherHelper
            //            .CheckBeginInvokeOnUI(() =>

            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                JobsList.Clear();
                foreach (Job job in jobs)
                {
                    //Boolean flag = false;
                    //foreach(CollectJob cjob in CollectJobList)
                    //    if (cjob.JobId.Equals(job.Id))
                    //    {
                    //        flag = true;
                    //        break;
                    //    }
                    // if(!flag)
                    job.Color = JobsList.Count % 3 + "";
                    JobsList.Add(job);
                }

                if (JobsList.Count == 0)
                {
                    Messenger.Default.Send <string>("", "JobEmpty");
                }
                else
                {
                    Messenger.Default.Send <string>("", "JobRefreshCompleted");
                }
            });
        }
        public static void Main()
        {
            var jobs      = new JobsList();
            var employees = new List <Employee>();

            while (true)
            {
                var input = Console.ReadLine().Split();
                if (input[0] == "End")
                {
                    break;
                }

                switch (input[0])
                {
                case "Job":
                    var name     = input[1];
                    var hours    = int.Parse(input[2]);
                    var employee = employees.FirstOrDefault(e => e.Name == input[3]);
                    Job job      = new Job(name, hours, employee);

                    job.JobDone += job.OnJobDone;
                    jobs.Add(job);
                    break;

                case "StandardEmployee":
                    name = input[1];
                    employees.Add(new StandartEmployee(name));
                    break;

                case "PartTimeEmployee":
                    name = input[1];
                    employees.Add(new PartTimeEmployee(name));
                    break;

                case "Pass":
                    jobs.ForEach(j => j.Update());
                    break;

                case "Status":
                    foreach (var j in jobs)
                    {
                        if (!j.IsDone)
                        {
                            Console.WriteLine(j.ToString());
                        }
                    }
                    break;
                }
            }
        }
    public static void Main()
    {
        var jobs      = new JobsList();
        var employees = new List <IEmployee>();

        var input = Console.ReadLine().Split();

        while (!input[0].Equals("End"))
        {
            switch (input[0])
            {
            case "Job":
                var currentJob = new Job(input[1], int.Parse(input[2]), employees.FirstOrDefault(e => e.Name.Equals(input[3])));
                jobs.Add(currentJob);
                currentJob.JobDone += jobs.OnJobDone;
                break;

            case "StandartEmployee":
                var standartEmployee = new StandartEmployee(input[1]);
                employees.Add(standartEmployee);
                break;

            case "PartTimeEmployee":
                var parttimeEmployee = new PartTimeEmployee(input[1]);
                employees.Add(parttimeEmployee);
                break;

            case "Pass":

                foreach (Job job in jobs.ToArray())
                {
                    job.Update();
                }

                break;

            case "Status":

                foreach (Job job in jobs)
                {
                    Console.WriteLine(job);
                }

                break;
            }

            input = Console.ReadLine().Split();
        }
    }
예제 #4
0
    static void Main(string[] args)
    {
        JobsList            jobs      = new JobsList();
        List <BaseEmployee> employees = new List <BaseEmployee>();

        string[] input = Console.ReadLine().Split();
        while (input[0] != "End")
        {
            switch (input[0])
            {
            case "Job":
                Job realJob = new Job(input[1], int.Parse(input[2]), employees.FirstOrDefault(e => e.Name == input[3]));
                realJob.JobDone += realJob.OnJobDone;
                realJob.JobDone += jobs.OnJobDone;
                jobs.Add(realJob);
                break;

            case "StandartEmployee":
                employees.Add(new StandartEmployee(input[1]));
                break;

            case "PartTimeEmployee":
                employees.Add(new PartTimeEmployee(input[1]));
                break;

            case "Pass":
                foreach (var job in jobs)
                {
                    job.Update();
                }
                break;

            case "Status":
                foreach (var job in jobs)
                {
                    if (!job.IsDone)
                    {
                        Console.WriteLine(jobs.ToString());
                    }
                }
                break;

            default:
                break;
            }

            input = Console.ReadLine().Split();
        }
    }
예제 #5
0
    public static void Main()
    {
        JobsList           jobs      = new JobsList();
        List <BaseEmploee> employees = new List <BaseEmploee>();

        string input = Console.ReadLine();

        while (input != "End")
        {
            string[] args = input.Split();
            switch (args[0])
            {
            case "Job":
                Job job = new Job(args[1], int.Parse(args[2]), employees.First(e => e.Name == args[3]));
                jobs.Add(job);
                break;

            case "StandartBaseEmploee":
                BaseEmploee standartBaseEmploee = new StandartBaseEmploee(args[1]);
                employees.Add(standartBaseEmploee);
                break;

            case "PartTimeBaseEmploee":
                BaseEmploee parttimeBaseEmploee = new PartTimeBaseEmploee(args[1]);
                employees.Add(parttimeBaseEmploee);
                break;

            case "Pass":
                foreach (var jobInProgress in jobs)
                {
                    jobInProgress.Update();
                }
                break;

            case "Status":
                foreach (var jobb in jobs)
                {
                    Console.WriteLine(jobb.ToString());
                }
                break;
            }
            input = Console.ReadLine();
        }
    }
예제 #6
0
        ////public override void Cleanup()
        ////{
        ////    // Clean up if needed

        ////    base.Cleanup();
        ////}

        /// <summary>
        /// 获取结束回调
        /// </summary>
        /// <param name="users"></param>
        private void GetAddJobListEnd(ICollection <Job> jobs)
        {
            //GalaSoft.MvvmLight.Threading.DispatcherHelper
            //            .CheckBeginInvokeOnUI(() =>

            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                Messenger.Default.Send <int>(JobsList.Count, "JobLoadCompleted");
                foreach (Job job in jobs)
                {
                    job.Color = JobsList.Count % 3 + "";
                    JobsList.Add(job);
                }
                if (JobsList.Count == 0)
                {
                    Messenger.Default.Send <string>("", "JobEmpty");
                }
            });
        }
예제 #7
0
        public async Task GetInfintyData(int pagenumber)
        {
            try
            {
                // IsBusy = true;

                if (JobsList.Count == 0)
                {
                    pagenumber = 0;
                    var newresult = await GetData(pagenumber);

                    //JobsList = new InfiniteScrollCollection<JobEmployerDataModel>(newresult);

                    foreach (var item in newresult)
                    {
                        JobsList.Add(item);
                    }
                }
                JobsList.OnLoadMore = async() =>
                {
                    IsLoadingIndicator = true;
                    pagenumber        += 5;
                    var list = await GetData(pagenumber);



                    IsLoadingIndicator = false;

                    return(list);
                };
            }
            catch (Exception e)
            {
                throw e;
            }
        }