Example #1
0
        private void HandleJobList(NetIncomingMessage msg)
        {
            int byteNum = msg.ReadInt32();
            byte[] compressedXml = msg.ReadBytes(byteNum);

            string jobListXml = ZipString.UnZipStr(compressedXml);

            JobHandler.Singleton.LoadDefinitionsFromString(jobListXml);

            _tabJob._shwDepa.ClearItems();
            _tabJob._shwJobs.ClearItems();

            sortedJobs.Clear();

            foreach (DepartmentDefinition dep in JobHandler.Singleton.JobSettings.DepartmentDefinitions)
            {
                var depJobs = (from x in JobHandler.Singleton.JobSettings.JobDefinitions
                              where x.Department.ToLowerInvariant() == dep.Name.ToLowerInvariant()
                              where x.Available
                              orderby x.Name
                              select x).ToList();

                var newEntry = new KeyValuePair<DepartmentDefinition, List<JobDefinition>>(dep, depJobs);
                sortedJobs.Add(newEntry);

                var newDep = new ImageButton
                {
                    ImageNormal = dep.DepartmentIcon,
                };

                DepartmentInfo newInfo = new DepartmentInfo()
                    {
                        Department = dep,
                        JobDefs = depJobs
                    };

                _tabJob._shwDepa.AddItem(newDep, newInfo);
            }
        }