//METHODS******************************************************************************* //this add the new investigation group in the file and GroupList public void RegisterGroup(string[] groupAttributes) { InvestigationGroup group = new InvestigationGroup(groupAttributes); GroupList.Add(group); ListUpdated = true; }
public static IEnumerable <GroupList <TripEvent> > GetEventsGrouped(this Trip trip) { var eventList = new ObservableCollection <GroupList <TripEvent> >(); var queryEventsByDate = from ev in trip.TripEvents group ev by ev.Date.Day into newGroup orderby newGroup.Key select newGroup; foreach (var nameGroup in queryEventsByDate) { var tripEvent = new GroupList <TripEvent>(); foreach (var TripEvent in nameGroup) { tripEvent.Add(TripEvent); } tripEvent.Heading = tripEvent[0].Date.ToString("dd/MM/yyyy"); eventList.Add(tripEvent); } return(eventList); }
public bool GetGangRemoveList(int gangId, int rank, out List <int> gangRemoveList) { gangRemoveList = new GroupList(); GetGangAddList(gangId, rank, out var gangAddList); if (!gangTableEfficient.ContainsKey(gangId)) { return(false); } foreach (var gangTable in gangTableEfficient[gangId]) { foreach (var groupId in gangTable.Value) { if (gangAddList.Contains(groupId)) { continue; } if (!gangRemoveList.Contains(groupId)) { gangRemoveList.Add(groupId); } } } return(gangRemoveList.Any()); }
public bool GetCompanyRemoveList(int companyId, int rank, out List <int> companyRemoveList) { companyRemoveList = new GroupList(); GetCompanyAddList(companyId, rank, out var companyAddList); if (!companyTableEfficient.ContainsKey(companyId)) { return(false); } foreach (var companyTable in companyTableEfficient[companyId]) { foreach (var groupId in companyTable.Value) { if (companyAddList.Contains(groupId)) { continue; } if (!companyRemoveList.Contains(groupId)) { companyRemoveList.Add(groupId); } } } return(companyRemoveList.Any()); }
public bool GetFactionRemoveList(int factionId, int rank, out List <int> factionRemoveList) { factionRemoveList = new GroupList(); GetFactionAddList(factionId, rank, out var factionAddList); if (!factionTableEfficient.ContainsKey(factionId)) { return(false); } foreach (var factionTable in factionTableEfficient[factionId]) { foreach (var groupId in factionTable.Value) { if (factionAddList.Contains(groupId)) { continue; } if (!factionRemoveList.Contains(groupId)) { factionRemoveList.Add(groupId); } } } return(factionRemoveList.Any()); }
public void inicilizarDataBase() { string line; System.IO.StreamReader file = new System.IO.StreamReader (@"C:\Users\Sara\Source\Repos\GMaps-.NET\WindowsFormsApp1\WindowsFormsApp1\Datos\datos.txt"); int c = 0; while ((line = file.ReadLine()) != null) { c++; String[] info = line.Split(';'); try { InvestigationGroup ig = new InvestigationGroup(info); GroupList.Add(ig); }catch (Exception e) { e.ToString(); //MessageBox.Show("Error en la fila: " + c ); } } file.Close(); }
public void AddEntity(EntityShotBase entity, out ShotModelData data) { if (!IsUpdated) { Update(); } int hash = GetPropertyHashCode(entity.Property, entity.Parent); ShotGroup group = null; if (ReusableGroupDict.ContainsKey(hash)) { var groupList = ReusableGroupDict[hash]; group = groupList.FirstOrDefault(); if (groupList.Count == 1) { ReusableGroupDict.Remove(hash); } else { groupList.RemoveAt(0); } } group = group ?? new ShotGroup(entity); group.SetEntity(entity); data = group.Data; GroupList.Add(group); }
public void Add(Group group) { group.Id = Interlocked.Increment(ref this.counter); Groups.Add(group.Id, group); GroupList.Add(group); group.Framework = this.framework; this.framework.EventServer.OnLog(group); }
protected override void Add() { GroupList.Add(new GroupViewModel { GroupId = 0 }); CurrentGroup = GroupList.Last(); IsAdding = true; }
/// <summary> /// 构造函数 /// </summary> public ModelMain() { ModelGroup group = new ModelGroup(); group.GroupID = 1; group.GroupName = "默认群组"; LastGroupId++; GroupList.Add(group); }
public void Init() { if (helpBacking.Count == 0) { foreach (var item in wvp.HelpItems) { helpBacking.Add(item); } foreach (var item in wvp.ReadingList.HelpItems) { helpBacking.Add(item); } ListView.ItemsSource = helpBacking; App.Database.GetVariableEvents("LogFontSizeUI").Updated += LogFontSizeUI_Updated; } }
public ShotModelData CreateGroup(EntityShot entity) { ShotGroup group = new ShotGroup(entity, World); group.AddEntity(entity); GroupList.Add(group); return(group.Data); }
public StudentCollectionViewModel() { GroupList.Add(new Group { Name = "BPI" }); GroupList.Add(new Group { Name = "BIS" }); GroupList.Add(new Group { Name = "BIK" }); }
public static GroupList GetList(IWhere whereClause, IOrderBy orderByClause) { SqlDataReader dataReader = GetListReader(DatabaseEnum.ORDERDB, TABLE, whereClause, orderByClause, true); GroupList list = new GroupList(); while (dataReader.Read()) { list.Add(GetDataObjectFromReader(dataReader)); } dataReader.Close(); return(list); }
public DefaultGroup() { Name = "Default"; //IsDefaultGroup = true; CanBuild = true; Prefix = ""; Suffix = ""; GroupColor = Color.Gray; this.PermissionList.Add("*"); GroupList.Add(this); Group.DefaultGroup = this; }
/// <summary> /// 设置全校有效的组、有课的班级和有课的教师(GroupList、SquadList、TeacherList) /// </summary> private void SetDataList() { GroupList.Clear(); SquadList.Clear(); TeacherList.Clear(); foreach (EnClsLesson clsLsn in DataRule.Lsn.eachClsLesson()) { if (clsLsn.SharedTime > 0) { if (!SquadList.Contains(clsLsn.Squad)) { SquadList.Add(clsLsn.Squad); } if (clsLsn.Teacher != null && !TeacherList.Contains(clsLsn.Teacher)) { TeacherList.Add(clsLsn.Teacher); } } } GroupList.Add(AllMember); GroupList.Add(AllSquad); GroupList.Add(AllTeacher); foreach (EnSquad sqd in SquadList) { foreach (EnSquadGroup grp in DataRule.Sqd.GetGroups(sqd)) { if (!GroupList.Contains(grp)) { GroupList.Add(grp); } } } foreach (EnTeacher tch in TeacherList) { foreach (EnTeacherGroup grp in DataRule.Tch.GetGroups(tch)) { if (!GroupList.Contains(grp)) { GroupList.Add(grp); } } } }
private void BindGroups() { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); GroupList g1 = prmManager.GetGroupsByOwner(Context.User.Identity.Name); GroupList g2 = prmManager.GetGroupsByAdministrator(Context.User.Identity.Name); foreach (UserGroup g in g2) { g1.Add(g); } CurrentUserGroups.DataSource = g1; CurrentUserGroups.DataBind(); UsersPerGroup.DataSource = new List <String>(); UsersPerGroup.DataBind(); prmManager.Dispose(); }
private void FileToDatas(string filename) { for (int dayHour = 0; dayHour < 24; dayHour++) { string monday = null; string tuesday = null; string wednesday = null; string thursday = null; string friday = null; string saturday = null; string sunday = null; Week week = new Week((dayHour + " - " + (dayHour + 1)), monday, tuesday, wednesday, thursday, friday, saturday, sunday); this.WeekGrid.RemoveAt(dayHour); this.WeekGrid.Insert(dayHour, week); } StudentList.Clear(); GroupStudentList.Clear(); GroupList.Clear(); using (var readFromFile = new StreamReader(filename)) { var deserializer = new XmlSerializer(typeof(ObservableCollection <Student>)); ObservableCollection <Student> tmpStudentList = (ObservableCollection <Student>)deserializer.Deserialize(readFromFile); foreach (var item in tmpStudentList) { StudentList.Add(item); } deserializer = new XmlSerializer(typeof(ObservableCollection <Student>)); foreach (var item in tmpStudentList) { GroupStudentList.Add(item); } deserializer = new XmlSerializer(typeof(ObservableCollection <Group>)); ObservableCollection <Group> tmpGroupList = (ObservableCollection <Group>)deserializer.Deserialize(readFromFile); foreach (var item in tmpGroupList) { GroupList.Add(item); } deserializer = new XmlSerializer(typeof(ObservableCollection <Week>)); ObservableCollection <Week> tmpWeekGrid = (ObservableCollection <Week>)deserializer.Deserialize(readFromFile); foreach (var item in tmpWeekGrid) { WeekGrid.Add(item); } } }
PivotTableGroup GetOrCreateGroup(IGroup group) { if (group.Key == null) { if (NullKeyGroup == null) { NullKeyGroup = new PivotTableGroup(group, Aggregators, group.SortOrder); GroupList.Add(NullKeyGroup); } return(NullKeyGroup); } PivotTableGroup result; if (GroupMap.TryGetValue(group.Key, out result)) { return(result); } result = new PivotTableGroup(group, Aggregators, group.SortOrder); GroupList.Add(result); GroupMap[group.Key] = result; return(result); }
public void getListOfGroups(ObservableCollection <Model.FlashCard> flashCards) // used to display the group names in to the listview { ListOfGroups = new ObservableCollection <string>(flashCards.Select(f => f.Group).Distinct()); // locate all the unique group names if (GroupList != null) // if the listview is full already clear it { GroupList.Clear(); } foreach (string groupName in ListOfGroups) // loop through all the unique groupname to forge them into objects and add to a new list that will be shown on screen { ListOfUniqueGroups tempGroup = new ListOfUniqueGroups(groupName); if (GroupList == null) { GroupList = new ObservableCollection <ListOfUniqueGroups>() { new ListOfUniqueGroups(groupName) }; } GroupList.Add(tempGroup); } _ = UpdateCloudStorage(); }
private void button1_Click(object sender, EventArgs e) { // Group-un adinin hec bir boshluq buraxmadan yazilmasi // ve groupName-e verilmesi string groupName = txtGroupName.Text.Trim(); // eger null veya boshdursa if (string.IsNullOrEmpty(groupName)) { // ERROR mesajinin verilmersi MessageBox.Show("Group name is not valid", "Failed!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // eger GroupListde bu ad varsa if (GroupList.ContainsGroupName(groupName)) { // ERROR mesaji verilir MessageBox.Show("Group name is duplicate", "Failed!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //user uyqun qrup adini daxil etdi ve bu addan yoxdur //bu halda yeni group-un Grouplist-e elave edilmesi GroupList.Add(new Group(groupName)); // Elave edildikden sonra setrin bosh gorsedilmesi txtGroupName.Text = ""; // Melumat mesajinin verilmesi MessageBox.Show("New Group was successfully added", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void AddEntity(IStoryEntityObject obj) { if (obj == null) { return; } if ((obj as IActor) != null) { ActorList.Add(obj as IActor); return; } if ((obj as IEvent) != null) { EventList.Add(obj as IEvent); return; } if ((obj as IStuff) != null) { StuffList.Add(obj as IStuff); return; } if ((obj as IGroup) != null) { GroupList.Add(obj as IGroup); return; } if ((obj as ITask) != null) { TaskList.Add(obj as ITask); return; } if ((obj as ILocation) != null) { LocationList.Add(obj as ILocation); return; } }
private void CreateDevData() { GroupList.Add(new GroupVm() { ID = 1, Name = "Pastors", Description = "All pastors" }); GroupList.Add(new GroupVm() { ID = 2, Name = "Lay Pastors", Description = "All lay pastors" }); GroupList.Add(new GroupVm() { ID = 3, Name = "Team Leaders", Description = "All team leaders" }); GroupList.Add(new GroupVm() { ID = 4, Name = "Soulwinners", Description = "All soulwinners" }); CorrespondenceList.Add(new CorrespondenceVm() { ID = 1, Name = "Gary Lima" }); CorrespondenceList.Add(new CorrespondenceVm() { ID = 2, Name = "J.P. Malone" }); CorrespondenceList.Add(new CorrespondenceVm() { ID = 3, Name = "M.C. Kekel" }); CorrespondenceList.Add(new CorrespondenceVm() { ID = 4, Name = "Elliot Gesang" }); CorrespondenceList.Add(new CorrespondenceVm() { ID = 5, Name = "Jim Connor" }); MessageList.Add(new MessageVm() { MemberID = 1, MemberName = "Gary Lima" , MessageType = MessageType.TextMessage, Direction = MessageDirection.Received, MessageDate = DateTime.Now , Subject = "Msg Subject", Body = "Here's a messaage from Gary with new content!" }); MessageList.Add(new MessageVm() { MemberID = 2, MemberName = "Phil Kinson" , MessageType = MessageType.TextMessage, Direction = MessageDirection.Sent, MessageDate = DateTime.Now.Subtract(new TimeSpan(0, 10, 0)) , Subject = "Msg Subject", Body = "Here's a messaage from Phil" }); MessageList.Add(new MessageVm() { MemberID = 3, MemberName = "Gary Lima" , MessageType = MessageType.TextMessage, Direction = MessageDirection.Received, MessageDate = DateTime.Now.Subtract(new TimeSpan(0, 15, 0)) , Subject = "Msg Subject", Body = "Here's a messaage from Gary" }); MessageList.Add(new MessageVm() { MemberID = 4, MemberName = "Phil Kinson" , MessageType = MessageType.TextMessage, Direction = MessageDirection.Sent, MessageDate = DateTime.Now.Subtract(new TimeSpan(0, 20, 0)) , Subject = "Msg Subject", Body = "Here's a messaage from Phil" }); MessageList.Add(new MessageVm() { MemberID = 5, MemberName = "Gary Lima" , MessageType = MessageType.TextMessage, Direction = MessageDirection.Received, MessageDate = DateTime.Now.Subtract(new TimeSpan(0, 25, 0)) , Subject = "Msg Subject", Body = "Here's a messaage from Gary" }); }
async Task LoadDropDownData() { List <string> liYeaNo = new List <string>(); liYeaNo.Add("Yes"); liYeaNo.Add("No"); DomicileUksList = liYeaNo; FreedomFightersList = liYeaNo; DefencePersonalList = liYeaNo; PhysicallyChallengesList = liYeaNo; PunishedByCourtList = liYeaNo; DabarredCollegeList = liYeaNo; EWS = liYeaNo; ExamCenterList.Add("Almora"); ExamCenterList.Add("Bageshwar"); ExamCenterList.Add("Haldwani"); ExamCenterList.Add("Kashipur"); ExamCenterList.Add("Nainital"); ExamCenterList.Add("Pithoragarh"); ExamCenterList.Add("Ram Nagar"); ExamCenterList.Add("Rudrapur"); ExamCenterList.Add("Ranikhet"); ExamCenterList.Add("Khatima"); ExamCenterList.Add("Dwarahat"); ExamCenterList.Add("Lohaghat"); ExamCenterList.Add("Kichha"); ExamCenterList.Add("Berinag"); GroupList.Add("Arts"); GroupList.Add("Commerce"); GroupList.Add("Science"); MaritalStatusList.Add("Single"); MaritalStatusList.Add("Married"); NationalityList.Add("Indian"); NationalityList.Add("Others"); CategoryList.Add("Unreserved General"); CategoryList.Add("Schedule Cast (SC)"); CategoryList.Add("Schedule Tribe (ST)"); CategoryList.Add("Other Backward Class (OBC) - Creamy"); CategoryList.Add("Other Backward Class (OBC) - Non Creamy"); PhysicallyChallengesTypeList.Add("Physically Challenged"); PhysicallyChallengesTypeList.Add("Visually Challenged"); PhysicallyChallengesTypeList.Add("None"); GendersList.Add("Male"); GendersList.Add("Female"); GendersList.Add("Transgender"); StreamList.Add("Humanities/Arts"); StreamList.Add("Commerce"); StreamList.Add("Science"); CoursesList.Add("Bachelor of Education"); CoursesList.Add("Master of Education"); PassingYearList.Add("Appearing"); PassingYearList.Add("2020"); PassingYearList.Add("2019"); PassingYearList.Add("2018"); PassingYearList.Add("2017"); PassingYearList.Add("2016"); PassingYearList.Add("2015"); PassingYearList.Add("2014"); PassingYearList.Add("2013"); PassingYearList.Add("2012"); PassingYearList.Add("2011"); PassingYearList.Add("2010"); M_EdGraducationRequired.Add("B.Ed. Theory"); M_EdGraducationRequired.Add("B.T. Theory"); M_EdGraducationRequired.Add("L.T. Theory"); M_EdGraducationRequired.Add("B.EI.Ed. Theory"); M_EdGraducationRequired.Add("D.EI.Ed. Theory"); M_EdGraducationRequired.Add("B.A B.Ed. Theory"); M_EdGraducationRequired.Add("B.Sc. B.Ed. Theory"); var response = await _httpClient.GetAsync("https://api.covidindiatracker.com/state_data.json"); if (response.IsSuccessStatusCode) { var result = Newtonsoft.Json.JsonConvert.DeserializeObject <IEnumerable <StateData> >( await response.Content.ReadAsStringAsync()); foreach (var state in result) { StateList.Add(state.state); } } }
{ public StudentCollectionViewModel() { GroupList.Add(new Model.Group()); }
private void GroupsCallback() { var web = (HttpWebRequest)WebRequest.Create(string.Format("https://api.vkontakte.ru/method/groups.get?uid={0}&extended=1&access_token={1}", _uid, Client.Instance.Access_token.token)); web.Method = "POST"; web.ContentType = "application/x-www-form-urlencoded"; web.BeginGetResponse(delegate(IAsyncResult e) { var request = (HttpWebRequest)e.AsyncState; var response = (HttpWebResponse)request.EndGetResponse(e); var responseReader = new StreamReader(response.GetResponseStream()); _gl = new GroupList(); try { var responseString = responseReader.ReadToEnd(); var o = JObject.Parse(responseString); try { var responseArray = (JArray)o["response"]; for (int i = 1; i < responseArray.Count; i++) { _gl.Add(new GroupItem( (int)responseArray[i]["gid"], (string)responseArray[i]["name"], (string)responseArray[i]["screen_name"], (int)responseArray[i]["is_closed"], (string)responseArray[i]["type"], (string)responseArray[i]["photo"], (string)responseArray[i]["photo_medium"], (string)responseArray[i]["photo_big"] )); } Dispatcher.BeginInvoke(() => { GroupsPanel.DataContext = _gl; if (!progressBar1.IsIndeterminate) return; progressBar1.IsIndeterminate = false; }); } catch { if ((int)o["error"]["error_code"] == 260) { Dispatcher.BeginInvoke(() => { NoGroups.Text = "пользователь закрыл доступ к списку групп"; progressBar1.IsIndeterminate = false; }); } } } catch (Exception ex) { Dispatcher.BeginInvoke(() => { MessageBox.Show(ex.Message); progressBar1.IsIndeterminate = false; }); } }, web); if (progressBar1.IsIndeterminate == false) { progressBar1.IsIndeterminate = true; } }
private void CreateGroupList() { List <AnniversaryModel> finalList = new List <AnniversaryModel>(); try { var nestedGroups = from p in Products.OrderByDescending(x => DateTime.Parse(x.merrageAnyver)) group p by DateTime.Parse(p.merrageAnyver).Month into yg select new { Year = yg.Key, Months = from o in yg group o by DateTime.Parse(o.merrageAnyver).Month into mg select new { Month = mg.Key, Items = mg.Select(x => x) } }; foreach (var groupedYear in nestedGroups) { var listMonth = groupedYear.Months.ToList(); for (int i = 0; i < listMonth.Count; i++) { var datesList = new List <DatesModel>(); string month = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(listMonth[i].Month); int _date = listMonth[i].Month; //finalList[i] = new ItemModel{Text=month}; var listDates = listMonth[i].Items.ToList(); for (int j = 0; j < listDates.Count; j++) { string date = listDates[j].merrageAnyver.ToString(); string name = listDates[j].memName.ToString(); string mobile = listDates[j].memMobile.ToString(); //finalList[i].Dates[j] = new DatesModel {Text= name.ToString()}; datesList.Add(new DatesModel { merrageAnyver = DateTime.Parse(date).ToString("M"), memName = name, memMobile = mobile }); datesList = datesList.OrderBy(d => DateTime.Parse(d.merrageAnyver).Date) .Select(x => x).ToList(); } finalList.Add(new AnniversaryModel { month = month, date = _date, Dates = datesList, ListHeight = datesList.Count * 60 }); } } if (!ReferenceEquals(finalList, null)) { var sorted = finalList.OrderBy(d => d.date) .Select(x => x).ToList(); foreach (var item in sorted) { //item.merrageAnyver = DateTime.Parse(item.merrageAnyver).ToString("M"); GroupList.Add(item); } } } catch (Exception ex) { } }
public void Execute(HttpRequest httpRequest, JsonPacket jsonRequest, SessionComponent session) { // Connect NetworkChannel channel = new NetworkChannel(Connection); // Request JsonJoinRequestMessage jsonRequestMessage = JsonJoinRequestMessage.Parse(jsonRequest.Message); // Data JsonEntity jsonEntity = jsonRequestMessage.Entity; Entity entity = EntityMap.Get(jsonEntity.Id); if (entity != null) { entity.Shutdown(); } entity = session.Owner; entity.Id = jsonEntity.Id; EntityMap.Add(entity.Id, entity); Server.Entities = EntityMap.Count; JsonGroup jsonGroup = jsonRequestMessage.Group; if (jsonGroup == null) { jsonGroup = JsonGroup.Default; } JsonClient jsonClient = jsonRequestMessage.Client; ClientComponent client = new ClientComponent(jsonClient.Id, jsonClient.Name); entity.Add(client); ClientMap.Add(client.Id, entity); Server.Clients = ClientMap.Count; GroupComponent group = new GroupComponent(jsonGroup.Id); entity.Add(group); GroupList.Add(group.Id, entity); Server.Groups = GroupList.Count; SearchListComponent download = new SearchListComponent(); entity.Add(download); // Response JsonJoinResponseMessage jsonResponseMessage = new JsonJoinResponseMessage() { Entities = Server.Entities, Sessions = Server.Sessions, Clients = Server.Clients, Groups = Server.Groups }; JsonPacket jsonResponse = new JsonPacket(jsonResponseMessage); HttpResponse httpResponse = new HttpResponse() { Data = session.Encrypt(jsonResponse) }; channel.Send(httpResponse); #if DEBUG Log.Add(httpRequest, httpResponse, jsonRequest, jsonResponse); #endif }
private void CreateGroupList() { List <BloodGroupModel> finalList = new List <BloodGroupModel>(); try { var nestedGroups = from p in MemberList.OrderByDescending(x => x.memBG) group p by p.memBG into yg select new { Year = yg.Key, BloodGroups = from o in yg group o by o.memBG into mg select new { bloodGroup = mg.Key, Items = mg.Select(x => x) } }; foreach (var groupedYear in nestedGroups) { var listMonth = groupedYear.BloodGroups.ToList(); for (int i = 0; i < listMonth.Count; i++) { var datesList = new List <DatesModel>(); string _group = listMonth[i].bloodGroup; //finalList[i] = new ItemModel{Text=month}; var listDates = listMonth[i].Items.ToList(); for (int j = 0; j < listDates.Count; j++) { string name = listDates[j].memName.ToString(); string mobile = listDates[j].memMobile.ToString(); //finalList[i].Dates[j] = new DatesModel {Text= name.ToString()}; datesList.Add(new DatesModel { memName = name, memMobile = mobile }); datesList = datesList.OrderBy(d => d.memName) .Select(x => x).ToList(); } finalList.Add(new BloodGroupModel { BloodGroup = _group, groupList = datesList, ListHeight = datesList.Count * 60 }); } } if (!ReferenceEquals(finalList, null)) { var sorted = finalList.OrderBy(d => d.BloodGroup) .Select(x => x).ToList(); foreach (var item in sorted) { //item.merrageAnyver = DateTime.Parse(item.merrageAnyver).ToString("M"); GroupList.Add(item); } } } catch (Exception ex) { } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Publish the service, allowing everything to use the spriteBatch Services.AddService(typeof(SpriteBatch), spriteBatch); // Player classes. player1 = new Player(this, Pallet.PlayerNumber.PlayerOne); player1.Name = "Player 1"; player2 = new Player(this, Pallet.PlayerNumber.PlayerTwo); player2.Name = "Player 2"; // Ball classes. ball = new Ball(this); // Collision groups collisionGroup = new Group("Collisions"); playerGroup = new Group("Players"); playerGroup.Add(player1.Pallet); playerGroup.Add(player2.Pallet); // Groups GroupList GameGroups = new GroupList(); GameGroups.Add(collisionGroup); GameGroups.Add(playerGroup); //Add the list of groups into the services so objects can retrieve info about items in specific groups Services.AddService(typeof(GroupList), GameGroups); // Blocks BlockList = new BlockManager(this); // Will initialize the basic graphical objects. base.Initialize(); // Goes to LoadContent() // Placed after general initialisation so the texture is already loaded and its size initialized player1.Pallet.placeInDefaultPosition(); player2.Pallet.placeInDefaultPosition(); /* Define the block safe zone, it's meant to restrict where the blocks can appear so they don't get on top of the pallet * or behind it. */ BlockList.BlocksSafeZone = new Rectangle((int)player1.Pallet.Position.X + 1, 0, (int)player2.Pallet.Position.X + (int)player2.Pallet.ObjectRectangle.Width - (int)player1.Pallet.ObjectRectangle.X - BlockList.MaxBlockSize, Window.ClientBounds.Height - BlockList.MaxBlockSize); // Places the ball in the center position and give it a random angle. ball.placeInDefaultPosition(); }