public async void Initialize(ViewRequest viewRequest) { model.GetConfiguration((viewRequest as KanbanViewRequest)?.ConfigurtaionName); var filtersData = await Task .Run(() => model.LoadFiltersData()) .ConfigureAwait(true); Projects.Clear(); foreach (var project in filtersData.Projects) { Projects.Add(project); } Priorities.Clear(); foreach (var priority in filtersData.Priorities) { Priorities.Add(priority); } if (model.Configuration != null && model.Configuration.ProjectId.HasValue) { CurrentProject = Projects.FirstOrDefault(x => x.Id == model.Configuration.ProjectId); } await DoRefresh(); }
public IUnitDef WhatShouldIBuild(UnitDefArrayList constructordef, int constructorid, Float3 pos) { Priorities.Add( 1.0, tanks, 5 ) Priorities.Add( 0.8, radar, position ) if (isfactory) { if (numbertanks < 5 || numberscouts >= 2 ) { if (haveenergy(buildtank)) { if (havemetal(buildtank)) { buildtank(); } } else { buildenergy(); } } else { if (numberscouts < 1) { if( } } } if( isconstructor ) { } }
static SyntaxNodeReader() { var priorities = new List <TokType[]>(7) { new[] { TokType.ArrOBr, TokType.Dot, TokType.Obr }, new[] { TokType.Pow }, new[] { TokType.Mult, TokType.Div, TokType.Rema }, new[] { TokType.Plus, TokType.Minus, TokType.BitShiftLeft, TokType.BitShiftRight }, new[] { TokType.BitAnd, TokType.BitXor, TokType.In, TokType.Equal, TokType.NotEqual, TokType.More, TokType.Less, TokType.MoreOrEqual, TokType.LessOrEqual }, new[] { TokType.And, TokType.ArrConcat }, new[] { TokType.Or, TokType.Xor, TokType.BitOr } }; for (byte i = 0; i < priorities.Count; i++) { foreach (var tokType in priorities[i]) { Priorities.Add(tokType, i); } } MaxPriority = priorities.Count - 1; }
private PriorityData(long id, string displayName, string iconName) { ID = id; DisplayName = displayName; bitmapImage = WazeraUtils.GetResource(iconName); Priorities.Add(this); PriorityMap.Add(ID, this); }
public usrMessageView() { InitializeComponent(); Priorities.Add(new ImageListItem <MessagePriority>(Strings.MessagePriority_Normal, "PriorityNormal.png".ToResourceString(), MessagePriority.Normal)); Priorities.Add(new ImageListItem <MessagePriority>(Strings.MessagePriority_Low, "PriorityLow.png".ToResourceString(), MessagePriority.Low)); Priorities.Add(new ImageListItem <MessagePriority>(Strings.MessagePriority_High, "PriorityHigh.png".ToResourceString(), MessagePriority.High)); Priorities.Add(new ImageListItem <MessagePriority>(Strings.MessagePriority_System, "PrioritySystem.png".ToResourceString(), MessagePriority.System)); }
protected void ReadListsOfValues() { Types.Clear(); foreach (var issueType in jira.IssueTypes.GetIssueTypesAsync().Result) { Types.Add(issueType.Id, new JiraIssueTypeModelService(issueType).Read()); } Priorities.Clear(); foreach (var prio in jira.Priorities.GetPrioritiesAsync().Result) { Priorities.Add(new JiraPriorityModelService(prio).Read()); } }
public void Enqueue(TItem resourcePackage, RequestPriority priority) { Priorities.Add(resourcePackage, priority); if (Packages.Count == 0) { Packages.Add(resourcePackage); return; } int insertIndex = 0; for (; insertIndex < Packages.Count; insertIndex++) { var currentPriority = Priorities[Packages[insertIndex]]; if (priority > currentPriority) { break; } } Packages.Insert(insertIndex, resourcePackage); }
// Use this for initialization void Start() { anm = GetComponent <Animator>(); player = GameObject.FindGameObjectWithTag("Player"); ChillRES = 10; rb = GetComponent <Rigidbody>(); nma = GetComponent <NavMeshAgent>(); //CURRENTACTION = StartCoroutine(RunTowardsPlayer()); // ADD ALL POSSIBLE ACTIONS UNDER UI HERE Priorities.Add("Attack1", 0f); Priorities.Add("Attack2", 0f); Priorities.Add("Attack3", 0f); Priorities.Add("NoAction", 0f); HBContainer = Instantiate(Resources.Load("UI/HB")) as GameObject; HBContainer.transform.SetParent(UICanvas.transform); HBContainer.transform.position = Camera.main.WorldToScreenPoint(HBPOS.position); HB = HBContainer.transform.GetChild(0).gameObject.GetComponent <RectTransform>(); }
// update constants in User database to current version defined in EntityConstants public bool VersionConstants(string me) { try { bool updateDB = false; if (Versions.Any(v => v.VersionType == DatabaseVersion.Constants && v.VersionString == UserConstants.ConstantsVersion) == false) { // no database - create and lock the new version entry TraceLog.TraceInfo(String.Format("User database version {0} not found", UserConstants.ConstantsVersion)); // remove an existing database version (there should never be more than one) foreach (var existingVersion in Versions.Where(v => v.VersionType == DatabaseVersion.Constants).ToList()) { Versions.Remove(existingVersion); } SaveChanges(); // create the new version entry DatabaseVersion ver = new DatabaseVersion() { VersionType = DatabaseVersion.Constants, VersionString = UserConstants.ConstantsVersion, Status = me }; Versions.Add(ver); SaveChanges(); updateDB = true; } else { var dbVersion = Versions.Single(v => v.VersionType == DatabaseVersion.Constants && v.VersionString == UserConstants.ConstantsVersion); if (dbVersion.Status == DatabaseVersion.Corrupted) { // try to update the database again - take a lock TraceLog.TraceInfo("User database corrupted"); dbVersion.Status = me; SaveChanges(); updateDB = true; } } if (updateDB == false) { TraceLog.TraceInfo(String.Format("User database version {0} is up to date", UserConstants.ConstantsVersion)); return(true); } } catch (Exception ex) { TraceLog.TraceException("Could not find database version", ex); return(false); } // update the default database values DatabaseVersion version = null; UserStorageContext versionContext = Storage.NewUserContext; try { // verify that this unit of execution owns the update lock for the database version version = versionContext.Versions.Single(v => v.VersionType == DatabaseVersion.Constants && v.VersionString == UserConstants.ConstantsVersion); if (version.Status != me) { return(true); } TraceLog.TraceInfo(String.Format("{0} updating User datatbase to version {1}", me, UserConstants.ConstantsVersion)); // update existing action types, add new action types foreach (var entity in UserConstants.DefaultActionTypes()) { if (ActionTypes.Any(e => e.ActionTypeID == entity.ActionTypeID)) { ActionTypes.Single(e => e.ActionTypeID == entity.ActionTypeID).Copy(entity); } else { ActionTypes.Add(entity); } } SaveChanges(); TraceLog.TraceInfo("Replaced action types"); // update existing colors, add new colors foreach (var entity in UserConstants.DefaultColors()) { if (Colors.Any(e => e.ColorID == entity.ColorID)) { Colors.Single(e => e.ColorID == entity.ColorID).Copy(entity); } else { Colors.Add(entity); } } SaveChanges(); TraceLog.TraceInfo("Replaced colors"); // update existing permissions, add new permissions foreach (var entity in UserConstants.DefaultPermissions()) { if (Permissions.Any(e => e.PermissionID == entity.PermissionID)) { Permissions.Single(e => e.PermissionID == entity.PermissionID).Copy(entity); } else { Permissions.Add(entity); } } SaveChanges(); TraceLog.TraceInfo("Replaced permissions"); // update existing priorities, add new priorities foreach (var entity in UserConstants.DefaultPriorities()) { if (Priorities.Any(e => e.PriorityID == entity.PriorityID)) { Priorities.Single(e => e.PriorityID == entity.PriorityID).Copy(entity); } else { Priorities.Add(entity); } } SaveChanges(); TraceLog.TraceInfo("Replaced priorities"); // update existing or add new built-in users foreach (var user in UserConstants.DefaultUsers()) { if (Users.Any(u => u.ID == user.ID)) { var existing = Users.Single(u => u.ID == user.ID); existing.Name = user.Name; existing.Email = user.Email; existing.CreateDate = user.CreateDate; } else { Users.Add(user); } } SaveChanges(); TraceLog.TraceInfo("Replaced users"); // update existing or add new built-in itemtypes and fields foreach (var itemType in UserConstants.DefaultItemTypes()) { if (ItemTypes.Any(it => it.ID == itemType.ID)) { var existing = ItemTypes.Include("Fields").Single(it => it.ID == itemType.ID); existing.Copy(itemType); if (itemType.Fields == null) { continue; } foreach (var field in itemType.Fields) { if (existing.Fields.Any(f => f.ID == field.ID)) { var existingField = existing.Fields.Single(f => f.ID == field.ID); existingField.Copy(field); } else { existing.Fields.Add(field); } } } else { ItemTypes.Add(itemType); } } SaveChanges(); TraceLog.TraceInfo("Replaced item types and fields"); // save the new version number version.Status = DatabaseVersion.OK; versionContext.SaveChanges(); return(true); } catch (Exception ex) { TraceLog.TraceException("VersionConstants failed", ex); // mark the version as corrupted version.Status = DatabaseVersion.Corrupted; versionContext.SaveChanges(); return(false); } }