/// <summary> /// Called by the underlying <see cref="SvgElement"/> when an element has been added to the /// 'Children' collection. /// </summary> /// <param name="child">The <see cref="SvgElement"/> that has been added.</param> /// <param name="index">An <see cref="int"/> representing the index where the element was added to the collection.</param> protected override void AddElement(SvgElement child, int index) { if (child is SvgGradientStop) { Stops.Add((SvgGradientStop)child); } base.AddElement(child, index); }
/// <summary> /// Called by the underlying <see cref="SvgElement"/> when an element has been removed from the /// 'Children' collection. /// </summary> /// <param name="child">The <see cref="SvgElement"/> that has been removed.</param> protected override void RemoveElement(SvgElement child) { if (child is SvgGradientStop) { Stops.Remove((SvgGradientStop)child); } base.RemoveElement(child); }
protected void LoadStops(SvgVisualElement parent) { var core = SvgDeferredPaintServer.TryGet <SvgGradientServer>(InheritGradient, parent); if (Stops.Count == 0 && core != null) { Stops.AddRange(core.Stops); } }
public async Task <IActionResult> PutStops([FromRoute] int id, [FromBody] Stops stops) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stops.stopId) { return(BadRequest()); } if (id != stops.stopId) { return(BadRequest()); } var stopid = stops.stopId; try { var conn = _context.Database.GetDbConnection(); if (conn.State == ConnectionState.Closed) { await conn.OpenAsync(); } using (var command = conn.CreateCommand()) { //ConveyanceMode, Stops, Circuit, MonthlyFare, FareFromMonth MySql = " UPDATE Stops SET "; MySql = MySql + " ConveyanceMode = '" + stops.drptext + "',"; MySql = MySql + " Stops = '" + stops.stops1 + "',"; MySql = MySql + " Circuit = '" + stops.circuit + "',"; MySql = MySql + " MonthlyFare = " + stops.monthlyFare + ","; MySql = MySql + " FareFromMonth = " + stops.fareFromMonth.ToOADate(); MySql = MySql + " WHERE StopID = " + stops.stopId; MySql = MySql + " AND Dormant = 0"; MySql = MySql + " AND dBID = " + stops.DBid; command.CommandType = CommandType.Text; command.CommandText = MySql; command.ExecuteNonQuery(); } } catch (DbUpdateConcurrencyException) { if (!StopsExists(stopid)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public RadialGradientBrush(Point relCenter, Size relRadius, Color startColor, Color midColor, Color endColor) { Center = relCenter; Focus = relCenter; Radius = relRadius; Stops.Add(new GradientStop(0, startColor)); Stops.Add(new GradientStop(0.5, midColor)); Stops.Add(new GradientStop(1, endColor)); }
//=============================================================================================================================== protected override void NewBar() { DTime = Bars[Bars.Range.To - 1].Time; ci = Bars.Range.To - 1; var posActiveMineB = Trade.GetActivePositions(mgB, true); if (posActiveMineB != null && posActiveMineB.Length > 0 && posGuidBuy != posActiveMineB[0].Id) { posGuidBuy = posActiveMineB[0].Id; } var posActiveMineS = Trade.GetActivePositions(mgS, true); if (posActiveMineS != null && posActiveMineS.Length > 0 && posGuidSell != posActiveMineS[0].Id) { posGuidSell = posActiveMineS[0].Id; } //=== КОРЕКЦИЯ =========================================================================================================== if (posGuidBuy != Guid.Empty && Trade.GetPosition(posGuidBuy).State == PositionState.Closed) { posGuidBuy = Guid.Empty; k7 = 0; } if (posGuidSell != Guid.Empty && Trade.GetPosition(posGuidSell).State == PositionState.Closed) { posGuidSell = Guid.Empty; k7 = 0; } //=== Трелинг =========================================================================================================== k++; if (k > kf) { TrailActiveOrders(); } //==================================================================================================================================== if (posGuidBuy == Guid.Empty && Buy7) { k = 0; var result107 = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Buy, 0.1, Instrument.Bid, -1, Stops.InPips(SL1, null), null, mgB); if (result107.IsSuccessful) { posGuidBuy = result107.Position.Id; } } if (posGuidSell == Guid.Empty && Sell7) { k = 0; var result207 = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Sell, 0.1, Instrument.Ask, -1, Stops.InPips(SL1, null), null, mgS); if (result207.IsSuccessful) { posGuidSell = result207.Position.Id; } } }
public void PauseContinueTimer() { if (_basicData.MultiPlayer == false) { return; //because multiplayer has no timer. } if (Stops !.IsRunning == true) { Stops.PauseTimer(); }
private static void Transform(Stops stops) { var site = SiteData.GetSites(); var api = CreateApi(site); var transformer = new UploadModelTransformer(site, stops); var uploadModel = transformer.Transform(); var integration = api.Organisations.Current.Routes.Integration(site.SiteId); SubmitRecord(integration, uploadModel); }
public IDictionary <string, DateTime> Dates() { var dates = new Dictionary <string, DateTime> { { "startDate", Stops.Any() ? Stops.Select(s => s.Arrival.Date).Min() : new DateTime() }, { "endDate", Stops.Any() ? Stops.Select(s => s.Departure.Date).Max() : new DateTime() } }; return(dates); }
public ActionResult Edit([Bind(Include = "stop_id,stop_code,stop_name,stop_desc,stop_lat,stop_lon,zone_id,stop_url,location_type,parent_station,wheelchair_boarding")] Stops stops) { if (ModelState.IsValid) { db.Entry(stops).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(stops)); }
public ColorSpectrumGradient(Gradient source) { _source = source; Angle = 270; foreach (var stop in _source.Stops) { Stops.Add(new GradientStopClone(stop)); } }
public override SKShader CreateShader(SKPaint paint, SKImageInfo info) { var(startPoint, endPoint) = GetGradientPoints(info.Width, info.Height, Angle); var orderedStops = Stops.OrderBy(x => x.Offset).ToArray(); var colors = orderedStops.Select(x => x.Color.ToSKColor()).ToArray(); var colorPos = orderedStops.Select(x => x.Offset).ToArray(); var tileMode = SKShaderTileMode.Clamp; return(SKShader.CreateLinearGradient(startPoint, endPoint, colors, colorPos, tileMode)); }
public JsonResult GetStops(string busNumber, string stopName, string endStopName, string days) { //получение времени остановок var result = repository.GetItems(stopName, busNumber, endStopName, days); //получение ближайшего рейса var nearestTime = Stops.GetNearestTime(result); var model = new { stops = result, nearestStop = nearestTime }; return(Json(model, JsonRequestBehavior.AllowGet)); }
//=============================================================================================================================== protected override void NewBar() { DTime = Bars[Bars.Range.To - 1].Time; ci = Bars.Range.To - 1; //=== КОРЕКЦИЯ ======================================================================================================================= if (posGuidBuy != Guid.Empty && Trade.GetPosition(posGuidBuy).State == PositionState.Closed) { posGuidBuy = Guid.Empty; } if (posGuidSell != Guid.Empty && Trade.GetPosition(posGuidSell).State == PositionState.Closed) { posGuidSell = Guid.Empty; } //========= Рисуем линию начала торгов Европы ============================================================================= if (DTime.Hour == 3 && DTime.Minute == 00) { var vl1 = Tools.Create <VerticalLine>(); vl1.Time = Bars[Bars.Range.To - 1].Time.AddHours(4); vl1.Color = Color.Aqua; zAm = Bars[TimeToIndex(Bars[ci].Time.AddHours(-6), Timeframe)].Open; var vl2 = Tools.Create <VerticalLine>(); vl2.Time = Bars[ci].Time.AddHours(-6); vl2.Color = Color.DarkCyan; var toolPolyLine = Tools.Create <PolyLine>(); toolPolyLine.Color = Color.DarkGoldenrod; toolPolyLine.AddPoint(new ChartPoint(vl2.Time = Bars[ci].Time.AddHours(-6), zAm)); toolPolyLine.AddPoint(new ChartPoint(Bars[Bars.Range.To - 1].Time.AddHours(14), zAm)); } //=== Трелинг ======================================================================================================================= TrailActiveOrders(); //==== Торги ========================================================================================================================= if (posGuidBuy == Guid.Empty && Buy7 && torg) { torg = false; var result107 = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Buy, 0.1, Instrument.Bid, -1, Stops.InPips(SL1, null), null, mgB); if (result107.IsSuccessful) { posGuidBuy = result107.Position.Id; } // var vl1 = Tools.Create<VerticalLine>(); vl1.Time=Bars[Bars.Range.To-1].Time; vl1.Color=Color.Red; } if (posGuidSell == Guid.Empty && Sell7 && torg) { torg = false; var result207 = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Sell, 0.1, Instrument.Ask, -1, Stops.InPips(SL1, null), null, mgS); if (result207.IsSuccessful) { posGuidSell = result207.Position.Id; } // var vl1 = Tools.Create<VerticalLine>(); vl1.Time=Bars[Bars.Range.To-1].Time; vl1.Color=Color.Blue; } }
public void RemoveParticipantFromRide(AppUserId participantId) { var stop = Stops.SingleOrDefault(x => x.ParticipantId == participantId); if (stop == default) { throw new Exception("User does not exists in this ride"); } Stops.Remove(stop); }
protected void Sell1() { if (posGuidSell == Guid.Empty) { var result2 = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Sell, 0.1, Instrument.Ask, -1, Stops.InPips(300, null), null, magicNumber); if (result2.IsSuccessful) { posGuidSell = result2.Position.Id; } } }
public void TestingOurOwnIEnumerable() { var stops = new Stops(); foreach (var stop in stops) { Console.WriteLine(stop); } var results = stops.Where(x => x.StopID > 3); }
public void addStop(String key, Stop newStop) { if (!Stops.ContainsKey(key)) { // Console.WriteLine(LongName+"+++++ se agrega la parada"+ newStop.ShortName+ " LLAVE "+key); Stops.Add(key, newStop); } else { // Console.WriteLine(LongName + "----- NO se agrega la parada" + newStop.ShortName); } }
public IEnumerable <Stops> Get(int mdBId) { List <Stops> StopsList = new List <Stops>(); var conn = _context.Database.GetDbConnection(); if (conn.State == ConnectionState.Closed) { conn.Open(); } using (var command = conn.CreateCommand()) { MySql = " SELECT StopID, ConveyanceMode, Stops, Circuit, MonthlyFare, FareFromMonth" + " FROM Stops WITH (NOLOCK)"; MySql = MySql + " WHERE Dormant = 0"; MySql = MySql + " AND dBID = " + mdBId; command.CommandType = CommandType.Text; command.CommandText = MySql; DbDataReader kMyReader = command.ExecuteReader(); if (kMyReader.HasRows) { while (kMyReader.Read()) { Stops stops = new Stops(); if (!kMyReader.IsDBNull(0)) { stops.stopId = kMyReader.GetInt32(0); } if (!kMyReader.IsDBNull(1)) { stops.drptext = kMyReader.GetString(1); } if (!kMyReader.IsDBNull(2)) { stops.stops1 = kMyReader.GetString(2); } if (!kMyReader.IsDBNull(3)) { stops.circuit = kMyReader.GetString(3); } if (!kMyReader.IsDBNull(4)) { stops.monthlyFare = kMyReader.GetDouble(4); } if (!kMyReader.IsDBNull(5)) { stops.fareFromMonth = DateTime.FromOADate(kMyReader.GetDouble(5)); } StopsList.Add(stops); } } } return(StopsList); }
protected void Buy1() { if (posGuidBuy == Guid.Empty) { var result1 = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Buy, 0.1, Instrument.Bid, -1, Stops.InPips(300, null), null, magicNumber); if (result1.IsSuccessful) { posGuidBuy = result1.Position.Id; } } }
protected void SetBuyOrder() { double SL = getSL(1); double TP = 0.0; Stops st = Stops.InPrice(SL, TP); TradeResult r = null; r = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Buy, vol, Instrument.Ask, -1, st, "Buy..", magicNumber); if (r == null) { XXPrint("*!* Can't open Buy position at Price {0}", Instrument.Ask); } }
protected void SetSellOrder() { double SL = getSL(0); double TP = 0.0; Stops st = Stops.InPrice(SL, TP); TradeResult r = null; r = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Sell, vol, Instrument.Bid, -1, st, "Sell.", magicNumber); if (r == null) { XXPrint("*!* Can't open Sell position at Price {0}", Instrument.Bid); } }
public LcColorTheme(string property, Func <double, ComputationUnit, double> selector = null) : base(property, 0, 100) { Stops.Clear(); AddStop(0.0, Colors.Green); AddStop(0.5, Colors.Yellow); AddStop(1.0, Colors.Red); if (selector != null) { _selector = selector; } }
protected void SetBuyOrder() { double SL = getSL(1); double TP = 0.0; Stops st = Stops.InPrice(SL, TP); TradeResult r = null; if (!setbuy) { setbuy = true; r = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Buy, vol, Instrument.Ask, -1, st, "Buy..", magicNumber); } }
protected void SetSellOrder() { double SL = getSL(0); double TP = 0.0; Stops st = Stops.InPrice(SL, TP); TradeResult r = null; if (!setsell) { r = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Sell, vol, Instrument.Bid, -1, st, "Sell.", magicNumber); setsell = true; } }
protected void Sell1() { if (posGuidSell == Guid.Empty) { var result2 = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Sell, 0.1, Instrument.Ask, -1, //Stops.InPrice(max3+0.0003,null), null, null); Stops.InPips(null, null), null, null); if (result2.IsSuccessful) { posGuidSell = result2.Position.Id; } } }
protected void setMarketBuyOrder() { double CurrentAsk = Instrument.Ask; double CurrentBid = Instrument.Bid; double SL = CalculateSL(ExecutionRule.Buy, CurrentAsk); if (SL >= (CurrentAsk - 2 * Instrument.Spread)) { SL = Math.Round(CurrentAsk - staticSL * Instrument.Point, Instrument.PriceScale); } double TP = CalculateTP(ExecutionRule.Buy, CurrentBid); if (TP <= (CurrentBid + 2 * Instrument.Spread)) { TP = Math.Round(CurrentBid + staticTP * Instrument.Point, Instrument.PriceScale); } Stops SLTP = Stops.InPrice( SL, //currOrderSL._SellSL, TP //dblCalculateTP(ExecutionRule.Sell,0) ); int attempt = 0; TradeResult tR = null; do { attempt++; tR = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Buy, vol, Instrument.Bid, -1, SLTP, "sell on bar signal", magicNumber); }while ((tR == null?true:!tR.IsSuccessful) && attempt < 8); if ((tR == null?true:!tR.IsSuccessful)) { Print("[{2}>>]{1} Cann't Send Sell order at Bid: {0} ", Instrument.Bid, DateTime.Now, Instrument.Name); } else { Print("[{3}>>]{2} Sended successfully Sell order for position {0} at Bid: {1} ", tR.Position.Id, tR.Position.OpenPrice, tR.Position.OpenTime, Instrument.Name); } }
// GET: Stop/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Stops stops = db.Stops.Find(id); if (stops == null) { return(HttpNotFound()); } return(View(stops)); }
/// <summary> /// Saves the data into desired folder. /// </summary> /// <param name="basePath">Base path to the folder.</param> /// <param name="folder">Desired folder.</param> public void Save(string basePath = "./") { if (Directory.Exists(basePath + "basic")) { Directory.Delete(basePath + "basic", true); } Directory.CreateDirectory(basePath + "basic"); RoutesInfo.WriteBasic(new StreamWriter(basePath + "basic/routes_info.tfb")); Stops.WriteBasic(new StreamWriter(basePath + "basic/stops.tfb")); Stations.WriteBasic(new StreamWriter(basePath + "basic/stations.tfb")); using (var sw = new StreamWriter(basePath + "basic/.version")) sw.WriteLine(Version); }
protected void Buy1() { if (posGuidBuy == Guid.Empty) { var result1 = Trade.OpenMarketPosition(Instrument.Id, ExecutionRule.Buy, 0.1, Instrument.Bid, -1, //Stops.InPrice(min3-0.0003,null), null, null); Stops.InPips(null, null), null, null); if (result1.IsSuccessful) { posGuidBuy = result1.Position.Id; } } }
public void LoadStopInfo(Stops stop) { string stopJsonData; switch (stop) { case Stops.ToLondon: ToLondon.Clear(); #if WP7 stopJsonData = VariousFunctions.GetStringFromCoreResources("Resources/StopData/TowardsLondon.json"); #elif WP8 stopJsonData = VariousFunctions.GetStringFromResources("Resources/StopData/TowardsLondon.json"); #else stopJsonData = "[]"; #endif ToLondon = JsonConvert.DeserializeObject<ObservableCollection<DataModels.StopInfo>>(stopJsonData); foreach (var t in ToLondon) { t.StopDirection = "tl"; t.StopDirectionFrendly = "Towards: London"; } break; case Stops.ToOxford: ToOxford.Clear(); #if WP7 stopJsonData = VariousFunctions.GetStringFromCoreResources("Resources/StopData/TowardsOxford.json"); #elif WP8 stopJsonData = VariousFunctions.GetStringFromResources("Resources/StopData/TowardsOxford.json"); #else stopJsonData = "[]"; #endif ToOxford = JsonConvert.DeserializeObject<ObservableCollection<DataModels.StopInfo>>(stopJsonData); foreach (var t in ToOxford) { t.StopDirection = "to"; t.StopDirectionFrendly = "Towards: Oxford"; } break; } }