public void ProcessTrack(LocationEnum stationLocation) { switch (stationLocation) { case LocationEnum.West: if (TrackPosition.X < -10) { OnOutOfZone(new COutofZoneArgs(OutOfZoneEnum.OutOfStrait, this)); } else if (TrackPosition.X > 0) { OnOutOfZone(new COutofZoneArgs(OutOfZoneEnum.OutOfAor, this)); } break; case LocationEnum.East: if (TrackPosition.X > 10) { OnOutOfZone(new COutofZoneArgs(OutOfZoneEnum.OutOfStrait, this)); } else if (TrackPosition.X < 0) { OnOutOfZone(new COutofZoneArgs(OutOfZoneEnum.OutOfAor, this)); } break; } }
private async Task <List <HSLRoute> > GetRouteFromHsl(LocationEnum from, LocationEnum to) { var routeResponse = await _connector.GetRoute(HslCoordinateBank.GetCoordinatesFor(@from), HslCoordinateBank.GetCoordinatesFor(to)); var listOfRoutes = ParseRouteInformationFromJSON(@from, to, routeResponse); if (listOfRoutes != null && listOfRoutes.Any()) { var tasks = new List <Task>(); listOfRoutes.ForEach(x => { //Launch all the retriaval tasks right after another... //And await with WhenAll a little down further tasks.Add(SetShortCodesForRoute(x)); }); //option 2: //listOfRoutes.ForEach(async x => { // await SetShortCodesForRoute(x); //}); //option 3: //Parallel.ForEach(listOfRoutes, async singleRoute => // { // await SetShortCodesForRoute(singleRoute); // }); await Task.WhenAll(tasks); } return(listOfRoutes ?? new List <HSLRoute>()); }
public Person(ClockTower tower) { tower.ClockTick += (ObjRef, e) => { var eventObj = (ClockEventArgs)e; switch (eventObj.Time.Hour) { case 8: Location = LocationEnum.OnWay; break; case 9: Location = LocationEnum.InOffice; break; case 18: Location = LocationEnum.OnWay; break; case 13: Location = LocationEnum.InCafe; break; case 14: Location = LocationEnum.InOffice; break; case 19: Location = LocationEnum.AtHome; break; } }; }
public void AddHoliday(DateTime holidayDate, LocationEnum location) { SortedDictionary <DateTime, DateTime> holidaysInLocation; if (BankHolidays.TryGetValue(location, out holidaysInLocation)) { if (!holidaysInLocation.ContainsKey(holidayDate)) { holidaysInLocation[holidayDate] = holidayDate; } } else { BankHolidays.Add(location, new SortedDictionary <DateTime, DateTime>() { { holidayDate, holidayDate } }); } // Publish event for other observer view models... eventAggregator.GetEvent <NewBankHolidayEvent>().Publish(new NewBankHolidayEventPayload() { NewBankHolidayDate = holidayDate, Location = location }); }
public CORelease(User creator, LocationEnum origin, PriorityEnum priority, params string[] controlobjects) : this(creator, origin, priority) { foreach (var co in controlobjects) { ControlObjects.Add(new ControlObject(co)); } }
public void SetLocationInt(int count) { locationInt = locationInt + count; Debug.Log(locationInt); locations = (LocationEnum)locationInt; InstantiateWorld(); }
public static void Add(LocationEnum location, string friendlyName) { Locations.Add(location, new Location() { FriendlyName = friendlyName, LocationId = (int)location, }); }
public CORelease(User creator, LocationEnum origin, string module = null, string area = null, string section = null) : this() { CreatedBy = creator; OriginLocation = origin; Module = module; Area = area; Section = section; }
public void Put( TransactionContext transactionContext, byte[] BkHash, Types.Block block, LocationEnum location, double totalWork) { var txs = block.transactions.Select(t => { return(new KeyValuePair <byte[], Types.Transaction>(Merkle.transactionHasher.Invoke(t), t)); }); Put(transactionContext, BkHash, new Block { BlockHeader = block.header, TxHashes = txs.Select(t => t.Key).ToList() }); //children var children = new HashSet <byte[]>(); children.Add(BkHash); transactionContext.Transaction.InsertHashSet <byte[], byte[]>( CHILDREN, block.header.parent, children, 0, false ); //location transactionContext.Transaction.Insert <byte[], int>(LOCATIONS, BkHash, (int)location); //total work transactionContext.Transaction.Insert <byte[], double>(TOTAL_WORK, BkHash, totalWork); //transactions var isFirstTx = true; foreach (var tx in txs) { if (!TxStore.ContainsKey(transactionContext, tx.Key)) { TxStore.Put(transactionContext, tx.Key, new Transaction { Tx = tx.Value, InMainChain = false }); if (isFirstTx) { transactionContext.Transaction.Insert <byte[], byte[]>(COINBASETX_BLOCK, tx.Key, BkHash); isFirstTx = false; } } } }
public bool SaveToDatabase(DateTime holidayDate, LocationEnum location) { if (holidayDate == null) { throw new ArgumentException("holidayDate"); } return(holidayControllerProxy.save(location.ToString(), holidayDate.ToShortDateString(), configManager.CurrentUser)); }
//public bool IsZoneTransferRequested = false; // Switching between area of responsibilities //public bool RequestTransfer = false; public CShip() { Callsign = ""; Position = new PositionType { X = 10, Y = 0 }; Heading = LocationEnum.West; Speed = SpeedEnum.Fast; }
public async Task <List <HSLRoute> > GetRoute(LocationEnum from, LocationEnum to) { if (!_cache.TryGetValue(CacheKeyFor(from, to), out List <HSLRoute> listOfRoutes)) { listOfRoutes = await GetRouteFromHsl(from, to); _cache.Set(CacheKeyFor(from, to), listOfRoutes, new MemoryCacheEntryOptions()); // Define options } return(listOfRoutes); }
public bool IsHoliday(DateTime dateToValidate, LocationEnum location) { SortedDictionary <DateTime, DateTime> holidaysInLocation; if (BankHolidays.TryGetValue(location, out holidaysInLocation)) { return(holidaysInLocation.ContainsKey(dateToValidate)); } return(false); }
public Position(int xCoordinate, int yCoordinate, LocationEnum location, String commands, int xMarsCoordinate, int yMarsCoordinate, CommandEnum command = 0) { this.xCoordinate = xCoordinate; this.yCoordinate = yCoordinate; this.location = location; this.command = command; this.commands = commands; this.xMarsCoordinate = xMarsCoordinate; this.yMarsCoordinate = yMarsCoordinate; }
/// <summary> /// Construct the Http client and set it depending /// on the League of legends server location /// </summary> /// <param name="location">League of legends server location</param> private protected ApiService(LocationEnum location) { Client = new HttpClient() { BaseAddress = new Uri(string.Format(BaseAdressTemplate, location.ToString().ToLower())) }; Client.DefaultRequestHeaders.Add("X-Riot-Token", Environment.GetEnvironmentVariable("RIOTGAMES_API_TOKEN")); Client.DefaultRequestHeaders.Add("Accept", "application/json"); }
public async Task <IActionResult> Index(LocationEnum from, LocationEnum to) { var routes = _hslRouteSolver.GetRoute(from, to); var resultPage = new RouteResultPage { Layout = _layoutFactory.Create() }; resultPage.Routes = await routes; return(View("~/Views/Pages/RouteResult.cshtml", resultPage)); }
public static double estimationDepens(double valeurLitigieuse, LocationEnum location) { switch (location) { case LocationEnum.Vaud: return(estimationDepensVD(valeurLitigieuse)); default: throw new NotImplementedException("Pas d'estimateur des dépens pour cette localisation"); } }
public void SetLocation(TransactionContext transactionContext, byte[] item, LocationEnum location) { transactionContext.Transaction.Insert <byte[], int>(LOCATIONS, item, (int)location); var block = Get(transactionContext, item).Value; foreach (var txHash in block.TxHashes) { var tx = TxStore.Get(transactionContext, txHash); TxStore.Put(transactionContext, txHash, tx.Value.Tx, false); } }
public float[] GetLocation(LocationEnum loc) { float[] gpsCords = new float[gpsData.GetLength(1)]; int locInt = (int)loc; for (int i = 0; i < gpsCords.Length; i++) { gpsCords[i] = gpsData[locInt, i]; } return(gpsCords); }
public static double estimateCourtCost(double valeurLitigieuse, LocationEnum location) { switch (location) { case LocationEnum.Vaud: return(estimateFeeVD(valeurLitigieuse)); case LocationEnum.Neuchatel: return(estimateFeeNE(valeurLitigieuse)); default: throw new NotImplementedException("Pas de valeur litigieuse pour cette localisation"); } }
/// <summary> /// Adds the user to the collection of users maintained by the user manager. /// Publishes details of this user to all listeners. /// </summary> /// <param name="userId"> the userId of the user that will be added.</param> /// <param name="firstName"> the first name of the user that will be added.</param> /// <param name="lastName"> the last name of the user that will be added.</param> /// <param name="emailAddress"> the email address of the user that will be added.</param> /// <param name="locationName"> the location of the user that will be added.</param> /// <param name="groupId"> the group of the user that will be added.</param> /// <param name="isValid"> the validity of the user that will be added.</param> /// <exception cref="ArgumentException"> thrown if any of the string parameters are null or empty.</exception> public void AddUser(string userId, string firstName, string lastName, string emailAddress, string locationName, int groupId, bool isValid) { if (String.IsNullOrEmpty(userId)) { throw new ArgumentException("userId"); } if (String.IsNullOrEmpty(firstName)) { throw new ArgumentException("firstName"); } if (String.IsNullOrEmpty(lastName)) { throw new ArgumentException("lastName"); } if (String.IsNullOrEmpty(emailAddress)) { throw new ArgumentException("emailAddress"); } LocationEnum parsedLocation = LocationEnum.HONG_KONG; if (String.IsNullOrEmpty(locationName) || !Enum.TryParse(locationName, true, out parsedLocation)) { throw new ArgumentException("locationName"); } var newUser = new UserImpl() { UserId = userId, FirstName = firstName, LastName = lastName, EmailAddress = emailAddress, LocationName = parsedLocation, GroupId = groupId, IsValid = isValid }; Users.Add(newUser); eventAggregator.GetEvent <NewUserEvent>().Publish(new NewUserEventPayload() { NewUser = newUser }); }
public List <IBankHoliday> GetHolidaysInLocation(LocationEnum location) { var holidaysInLocation = new List <IBankHoliday>(); if (BankHolidays.ContainsKey(location)) { foreach (var holiday in BankHolidays[location]) { holidaysInLocation.Add(new BankHolidayImpl() { HolidayDate = holiday.Key, Location = location }); } } return(holidaysInLocation); }
public SQLiteDB(LocationEnum dbLocation, string connStr) { mDatabase = new SQLiteAsyncConnection(connStr); switch (dbLocation) { case LocationEnum.Inner: initInnerDB(); break; case LocationEnum.External: initExternalDB(); break; default: initInnerDB(); break; } }
//[HttpPost("save")] public JsonResult CreateLocation([FromBody] LocationModel locationModel) { Position newPosition = null; try { if (ModelState.IsValid) { LocationEnum location = (LocationEnum)Enum.Parse(typeof(LocationEnum), locationModel.StPosition); Position position = new Position(locationModel.StStartX, locationModel.StStartY, location, locationModel.StCommand, locationModel.StMarsX, locationModel.StMarsY); newPosition = _locationManager.SetLocation(position); return(Json((object)new { data = "[" + newPosition.xCoordinate + "," + newPosition.yCoordinate + "] " + newPosition.location, message = newPosition == null ? "işlme başarısız!" : "işlme başarılı", success = newPosition == null ? "false" : "true", redirectUrl = "", })); } } catch (Exception ex) { if (ex.Message == "Coordinate_Out_bounds") { return(Json((object)new { data = "[Coordinate_Out_bounds]", message = "Başlangıç koordinatların büyük koordinat girildi.", success = "false", redirectUrl = "", })); } } return(Json((object)new { data = "NULL", message = "işlme başarısız! alanları kontorl ediniz", success = "false", redirectUrl = "", })); }
private List <HSLRoute> ParseRouteInformationFromJSON(LocationEnum from, LocationEnum to, string response) { List <HSLRoute> listOfRoutes = null; try { if (!string.IsNullOrEmpty(response)) { var fullReturnedStack = JsonConvert.DeserializeObject <List <List <HSLRoute> > >(response); if (fullReturnedStack.Any()) { listOfRoutes = fullReturnedStack.Select(x => x.First()).ToList(); } } return(listOfRoutes); } catch (Exception ex) { throw new Exception("Kutsu Reittioppaaseen onnistui, mutta vastaus oli odottamatonta formaattia", ex); } }
// Copy constructor - used in callbacks public CStationHlaObject(HlaObject _obj) : base(_obj) { // TODO: Instantiate local data here StationName = ""; Location = LocationEnum.West; }
/// <summary> /// Setup service /// </summary> /// <param name="location">League of legends server location</param> public ChampionMasteryService(LocationEnum location) : base(location) { }
//Declare a DevsMessages class and instantiate it in the constructor public override void ChangeLocation(LocationEnum LocationToGoTo) { throw new NotImplementedException(); }
public string GetTagName(TagTypeEnum expectedType, LocationEnum location) { return(Tags.FirstOrDefault(el => el.Type == expectedType && el.Location == location).Name); }
/// <summary> /// Setup service /// </summary> /// <param name="location">League of legends server location</param> public TournamentStubService(LocationEnum location) : base(location) { }