public override void OnPaintChart(object sender, PaintChartEventArgs args) { args.Graphics.SetClip(CurrentChart.MainWindow.WindowRectangle); var barWidth = CurrentChart.GetChartPoint(CurrentData.Time(), 0).X - CurrentChart.GetChartPoint(CurrentData.Time(1), 0).X; var obj = new object(); lock (obj) { foreach (Marker marker in _markers) { if (CurrentChart.GetTimePrice(args.Rectangle.X, args.Rectangle.Y).Time <= marker.TimePosition && CurrentChart.GetTimePrice(args.Rectangle.X + args.Rectangle.Width, args.Rectangle.Y).Time > marker.TimePosition) { // determina a Cor do Candle de acordo com regra "OnQuote" e cores definidas na configuração // CorBarraCompra, CorBarraVenda // Logica para cor da barra // se estiver dentro da tendencia, colore com as CorBarra, e estiver fora da tendencia colore com as CorBarraPadrao // var pen = new Pen(new SolidBrush(marker.side == Side.Sell ? CorBarraVenda : CorBarraCompra), barWidth / 20); linha original var pen = new Pen(new SolidBrush(marker.side == Side.Sell ? CorBarraVenda : (marker.side == Side.Buy ? CorBarraCompra : CorBarraCompraPadrao)), barWidth / 20); var startPos = CurrentChart.GetChartPoint(marker.TimePosition, marker.Close >= marker.Open ? marker.Open : marker.Close); var finishPos = CurrentChart.GetChartPoint(marker.TimePosition, marker.Close >= marker.Open ? marker.Close : marker.Open); var height = Math.Abs(startPos.Y - finishPos.Y + 1); //var rect = new RectangleF(startPos.X + barWidth / 20, finishPos.Y - 1, barWidth - barWidth / 10, height); original //var rect = new RectangleF(startPos.X + barWidth / 4, finishPos.Y - 1, barWidth-4, height); var rect = new RectangleF(startPos.X + barWidth / 5, finishPos.Y - 1, barWidth - 5, height); args.Graphics.FillRectangle(pen.Brush, rect); var highPos = CurrentChart.GetChartPoint(marker.TimePosition, marker.High); var lowPos = CurrentChart.GetChartPoint(marker.TimePosition, marker.Low); args.Graphics.DrawLine(pen, new PointF(rect.X + rect.Width / 2, highPos.Y - 1), new PointF(rect.X + rect.Width / 2, lowPos.Y)); } } base.OnPaintChart(sender, args); } }
protected override void Data_Refresh(object sender, StoreRefreshDataEventArgs e) { string pid = e.Parameters["ParentID"]; Store1.DataSource = CurrentData.Where(p => p.ParentID == pid); Store1.DataBind(); }
protected override void ProcessRecord() { Profile checkProfile = null; if (!string.IsNullOrEmpty(Name) && Name.Length > 0) { checkProfile = CurrentData.GetProfile(Name); } else if (InputObject != null) { checkProfile = InputObject; } /* * if (this.Name != null && * this.Name != string.Empty && * this.Name.Length > 0) { * checkProfile = * CurrentData.GetProfile(this.Name); * } else if (this.InputObject != null && * this.InputObject is Profile) { * checkProfile = * this.InputObject; * } */ WriteObject(this, checkProfile); }
private void unregisterButton_Click(object sender, EventArgs e) { var user = Current.QueryUserID(); realSenseProgram.Paush(); if (MessageBox.Show( $"本操作將清除該使用者({user} - {UserTable[user]})的所有臉部資料,您確定要進行此操作?", "解除註冊確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { realSenseProgram.UnPaush(); return; } Current.UnregisterUser(); FaceData = CurrentData.QueryRecognitionModule() .GetDatabase(); /*if (FaceData.Where(x => x.ForeignKey == user).Count() == 0) { * UserTable.Remove(user); * }*/ realSenseProgram.UnPaush(); }
/// <summary> /// Entry point. This function is called when new quote comes /// </summary> public override void OnQuote() { // traça linha lenta SetValue(0, TMA10_.GetValue()); _markers[0].SetParams(CurrentData.GetPrice(PriceType.High), CurrentData.GetPrice(PriceType.Low), CurrentData.GetPrice(PriceType.Close)); if ((CurrentData.GetPrice(PriceType.Low) > TMA10_.GetValue()) && (CurrentData.GetPrice(PriceType.High) > TMA10_.GetValue())) { SetMarker(0, 0, Color.Green); _markers[0].side = Side.Buy; } else if ((CurrentData.GetPrice(PriceType.Low) < TMA10_.GetValue()) && (CurrentData.GetPrice(PriceType.High) < TMA10_.GetValue())) { SetMarker(0, 0, Color.Red); _markers[0].side = Side.Sell; } else { SetMarker(0, 0, Color.Yellow); _markers[0].side = Side.None; // colorir candles } SetValue(0, TMA10_.GetValue()); // traça linha media if ((CurrentData.GetPrice(PriceType.Close) > TMA20_.GetValue()) && (CurrentData.GetPrice(PriceType.Open) > TMA20_.GetValue())) { SetMarker(1, 1, Color.Green); } else if ((CurrentData.GetPrice(PriceType.Close) < TMA20_.GetValue()) && (CurrentData.GetPrice(PriceType.Open) < TMA20_.GetValue())) { SetMarker(1, 1, Color.Red); } else { SetMarker(1, 1, Color.Yellow); } SetValue(1, TMA20_.GetValue()); // traça linha lenta if ((CurrentData.GetPrice(PriceType.Close) > TMA200_.GetValue()) && (CurrentData.GetPrice(PriceType.Open) > TMA200_.GetValue())) { SetMarker(2, 2, Color.Green); } else if ((CurrentData.GetPrice(PriceType.Close) < TMA200_.GetValue()) && (CurrentData.GetPrice(PriceType.Open) < TMA200_.GetValue())) { SetMarker(2, 2, Color.Red); } else { SetMarker(2, 2, Color.Yellow); } SetValue(2, TMA200_.GetValue()); }
/// <summary> /// ページ冒頭の初期化 /// </summary> /// <param name="scenarioName">シナリオラベル</param> /// <param name="pageNo">ページ名</param> public void BeginPage(AdvScenarioPageData currentPageData) { this.LastInputSendMessage = false; this.CurrentData = currentPageData; this.CurrentTextLength = 0; this.CurrentTextLengthMax = 0; this.deltaTimeSendMessage = 0; this.Contoller.Clear(); this.TextData = new TextData(CurrentData.MakeText()); this.SaveDataTitle = CurrentData.ScenarioLabelData.SaveTitle; if (string.IsNullOrEmpty(this.SaveDataTitle)) { this.SaveDataTitle = TextData.NoneMetaString; } UpdateText(); this.OnBeginPage.Invoke(this); Engine.UiManager.OnBeginPage(); Engine.MessageWindowManager.ChangeCurrentWindow(currentPageData.MessageWindowName); if (!currentPageData.IsEmptyText) { //バックログを追加 Engine.BacklogManager.AddPage(); } }
public static void PrepareUnitTestDataStore() { try { WebDriverFactory.Container.Resolve <StartSeChromeCommand>(); } catch { CommonCmdletBase.ModuleAlreadyLoaded = false; } if (!CommonCmdletBase.ModuleAlreadyLoaded) { WebDriverFactory.AutofacModule = new FakeWebDriverModule(); WebDriverFactory.Init(); CommonCmdletBase.ModuleAlreadyLoaded = true; } CurrentData.InitUnconditional(); PSCmdletBase.UnitTestMode = true; if (0 < UnitTestOutput.Count) { UnitTestOutput.Clear(); } IWebDriver webDriver = new FakeWebDriver(); CurrentData.CurrentWebDriver = webDriver; }
/// <summary> /// ページ冒頭の初期化 /// </summary> /// <param name="scenarioName">シナリオラベル</param> /// <param name="pageNo">ページ名</param> public void BeginPage(AdvScenarioPageData cuurentPageData) { this.CurrentData = cuurentPageData; this.CurrentTextLength = 0; this.CurrentTextLengthMax = 0; this.deltaTimeSendMessage = 0; this.Contoller.Clear(); this.TextData = new TextData(CurrentData.MakeText()); this.SaveDataTitle = CurrentData.ScenarioLabelData.SaveTitle; if (string.IsNullOrEmpty(this.SaveDataTitle)) { this.SaveDataTitle = TextData.NoneMetaString; } UpdateText(); this.OnBeginPage.Invoke(this); Engine.UiManager.OnBeginPage(); Engine.MessageWindowManager.ChangeCurrentWindow(cuurentPageData.MessageWindowName); if (!cuurentPageData.IsEmptyText) { Engine.BacklogManager.AddPage(); } //ページ冒頭の状態をセーブデータとして記憶 Engine.SaveManager.UpdateAutoSaveData(engine); //パラメーターの変更があった場合にシステムセーブデータとして記憶 if (Engine.Param.HasChangedSystemParam) { Engine.Param.HasChangedSystemParam = false; Engine.SystemSaveData.Write(); } }
public void RemakeText() { if (CurrentData == null) { return; } //エンティティ処理の場合は内容が変わっている可能性があるので再作成が必要 this.TextData = new TextData(CurrentData.MakeText()); string currentText = CurrentData.MakeText(CurrentTextDataInPage); CurrentTextLengthMax = new TextData(currentText).Length; this.Status = PageStatus.SendChar; if (CurrentTextLength == 0) { this.OnBeginText.Invoke(this); } if (IsNoWaitAllText || CheckSkip() || LastInputSendMessage) { EndSendChar(); } this.OnChangeText.Invoke(this); Engine.MessageWindowManager.OnPageTextChange(this); Engine.OnPageTextChange.Invoke(Engine); }
/// <summary> /// 获取电流数据 /// </summary> /// <param name="data"></param> /// <returns></returns> public static List<CurrentData> GetCurrentData(MeterList data) { List<CurrentData> currentDataList = new List<CurrentData>(); foreach (var item in data.Meters) { CurrentData current = new CurrentData(); current.BuildID = data.BuildId; current.MeterCode = item.MeterId; current.Time = data.CollectTime; MeterParam i = item.MeterParams.Find(m => m.ParamName.ToLower() == "I".ToLower()); MeterParam ia = item.MeterParams.Find(m => m.ParamName.ToLower() == "Ia".ToLower()); MeterParam ib = item.MeterParams.Find(m => m.ParamName.ToLower() == "Ib".ToLower()); MeterParam ic = item.MeterParams.Find(m => m.ParamName.ToLower() == "Ic".ToLower()); if (i != null) current.I = i.ParamValue; if (ia != null) current.Ia = ia.ParamValue; if (ib != null) current.Ib = ib.ParamValue; if (ic != null) current.Ic = ic.ParamValue; currentDataList.Add(current); } return currentDataList; }
//Call this method to update public void Update() { while (Empty == false) //Note - opportunity for efficiency... >:) { //step 1: Remove old data from the collections. lock (coinLock) { if (CurrentData != null && CurrentData.Count > 0) { //Step 1: Remove old data from the collections. CurrentData.TakeAndBreak(x => x.LastUpdate > DateTime.UtcNow.AddMinutes(-MinuteInterval)); //Step 2: Get new data from the database and add it to the collections. DataCalls.GetRecentCurrentData(Instrument.InstrumentID, MinuteInterval, CurrentDataIndex).ForEach(x => CurrentData.Add(x)); CurrentDataIndex = this.CurrentData.Max(x => x.CurrentID); } } lock (coinAggLock) { if (CurrentAggData != null && CurrentAggData.Count > 0) { CurrentAggData.TakeAndBreak(x => x.LastUpdate > DateTime.UtcNow.AddMinutes(-MinuteInterval)); DataCalls.GetRecentCurrentAggData(Instrument.InstrumentID, MinuteInterval, CurrentAggDataIndex).ForEach(x => CurrentAggData.Add(x)); CurrentAggDataIndex = this.CurrentAggData.Max(x => x.CurrentAggID); } } Thread.Sleep(50000); } }
protected override void BeginProcessing() { Profile profile = new Profile(Name); Profile checkProfile = CurrentData.GetProfile(profile.Name); if (checkProfile == null) { CurrentData.Profiles.Add(profile); WriteObject(this, profile); } else { // 20130323 // ErrorRecord err = // new ErrorRecord( // new Exception("The profile already exists"), // "ProfileAlreadyExists", // ErrorCategory.InvalidArgument, // profile); // err.ErrorDetails = // new ErrorDetails("The profile already exists"); // WriteError(this, err, true); WriteError( this, "The profile already exists", "ProfileAlreadyExists", ErrorCategory.InvalidArgument, true); } }
/// <summary> /// 增加一个 /// </summary> /// <param name="time"></param> /// <param name="rawRange"></param> /// <param name="rawPhaseRange"></param> public SmoothRangeWindowOld Add(Time time, double rawRange, double rawPhaseRange, double ionoDiffer) { //通过是否相等,判断是否重复设值 if (CurrentData.PseudoRange == rawRange && this.CurrentData.PhaseRange == rawPhaseRange) { return(this); } this.CurrentData = new RangePhasePair(rawRange, rawPhaseRange, ionoDiffer) { Time = time }; this.Add(time, CurrentData); //电离层改正数据 if (IsDeltaIonoCorrect && SmoothRangeType == SmoothRangeSuperpositionType.快速更新算法) { double y = CurrentData.GetRawIonoAndHalfAmbiValue();//.RangeMinusPhase / 2; IonoWindow.Add(time, y); // BigIonoWindow.Add(time, y); } if (IsDeltaIonoCorrect) { var fit = IonoWindow.GetPolyFitValue(CurrentData.Time, OrderOfDeltaIonoPolyFit, IonoFitDataCount); if (fit != null) { CurrentData.FittedIonoAndAmbiValue = fit.Value; } else { CurrentData.FittedIonoAndAmbiValue = CurrentData.GetRawIonoAndHalfAmbiValue(); } } return(this); }
public int GetSize() { int size = 1 // IsNewEntity + 8 // LastGetDate + 4 // GetCount + 4 // SaveCount + 8 // LastSaveDate + 8 // LastChangeDate + 8 // Generation + 8 // _lockObj + 1 // Unloaded + 32 // Request + 8 // LastSavedData + 8; // CurrentData if (CurrentData != null) { size += CurrentData.GetCacheSize(); } if (LastSavedData != null && ReferenceEquals(LastSavedData, CurrentData) == false) { size += LastSavedData.GetCacheSize(); } return(size); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); var catalogSystem = Locate.Advanced.GetInstance <ICatalogSystem>(); var currentMarket = _currentMarketService.GetCurrentMarket(); // we need to use Variations responsegroup to get prices var entry = CurrentData.LoadEntry(CatalogEntryResponseGroup.ResponseGroup.Variations); var salePrice = StoreHelper.GetSalePrice(entry, 1); if (entry.IsAvailableInMarket(currentMarket.MarketId) && (salePrice != null)) { var basePrice = salePrice.Money; var discount = StoreHelper.GetDiscountPrice(entry).Money; if (discount.Amount == -1) { discount = basePrice; } var saved = basePrice.Subtract(discount); ListPrice.Text = basePrice.ToString(); DiscountPricing.Text = discount.ToString(); Savings.Text = saved.ToString(); return; } ListPrice.Text = "Not available"; DiscountPricing.Text = "Not available"; Savings.Text = "Not available"; }
protected override void OnDestroy() { base.OnDestroy(); foreach (var state in _stateInstances) { state.Value.OnTermination(); } _stateInstances.Clear(); if (CurrentData != null) { CurrentData.OnTermination(); } if (_isAutomate && _isSupportedDataDriver) { AutomaticTask.ClearDataBinding(CurrentData); } if (Main.m_FSM.IsExistFSM(Name)) { Main.m_FSM.UnRegisterFSM(this); } }
private GenericResult HandleCommand( OrderStateMachine.Trigger trigger, ITriggerContext context, IOrderEditableData editableData = null, IOrderDealingData dealingData = null, IOrderCoreData coreData = null, TriggerStatus status = TriggerStatus.Done) { Contract.Requires(context != null, "context != null"); _workingData = CurrentData.Clone() .SetRoutingData(dealingData) .SetEditableData(editableData) .SetTrigger(trigger) .SetPendingTrigger(status.IsPendingReply() && this.PendingTrigger == trigger ? null : this.PendingTrigger); var result = EnforceTriggerStatus(trigger, ref status); if (result.IsFailure()) { return(result); } if (status == TriggerStatus.Rejected) { result = GenericResult.Success(); } else { var triggerSucceeded = status == TriggerStatus.Pending ? _stateMachine.CanFireTrigger(trigger) : _stateMachine.TryFireTrigger(trigger); result = triggerSucceeded ? GenericResult.Success() : GenericResult.Failure(string.Concat(_workingData.StateMachineErrorMessage, String.Format("The commmand {0} is not allowed when the order is in {1} state", trigger, OrderState))); } if (result.IsSuccess()) { _workingData.SetOrderState(_stateMachine.GetState); if (editableData != null) { if (coreData != null) { this.InsertDataFrom(coreData); } EventLogs.Add(new OrderParameterEventLog <IOrderEditableData>(context, trigger, status, _workingData.OrderState, this, editableData)); } else if (dealingData != null) { EventLogs.Add(new OrderParameterEventLog <IOrderDealingData>(context, trigger, status, _workingData.OrderState, this, dealingData)); if (dealingData.Trade != null) { _workingData.SetExecutionQuantity(ComputeExecutionQuantity(_workingData.Side)); } } else { EventLogs.Add(new OrderEventLog(context, trigger, status, _workingData.OrderState, this)); } _workingData.SetOrderStatus(ComputeOrderStatus(_workingData)); RefreshCurrentData(_workingData); } _workingData = null; return(result); }
public SpecNode ParseSpecNode(string funcname) { if (Current == TokenType.SpecIdent && CurrentData.Substring(1) == funcname) { return(ParseSpecNode()); } return(null); }
protected void Page_Load(object sender, EventArgs e) { if (!PageReference.IsNullOrEmpty(CurrentData)) { Contact = CurrentData.GetPage() as ContactPage; DataBind(); } }
/// <summary> /// 重生,状态机恢复为初始状态 /// </summary> public void Renewal() { if (CurrentData != null) { CurrentData.OnRenewal(); } SwitchState(_defaultState); }
/// <summary> /// 完结,状态机进入最终状态 /// </summary> public void Final() { if (CurrentData != null) { CurrentData.OnFinal(); } SwitchState(_finalState); }
public CandleChart GetCandles(DateTime startTime, int timeInterval) { //Create a list of CandleSticks List <CandleStick> candles = new List <CandleStick>(); DateTime currentTime = startTime; DateTime endInterval = startTime.AddMinutes(timeInterval); TimeSpan span = DateTime.Now.Subtract(startTime); int maxIntervals = Convert.ToInt32(Math.Ceiling(((decimal)span.Minutes / (decimal)timeInterval))); int currentIndex = 0; //int lastIndex = 0; int currentDataCount = CurrentData.Count; //Generate the data for each candle stick for (int i = 0; i < maxIntervals;) { if (currentIndex >= currentDataCount) { break; } List <CandleStickDataPoint> candleStickDataPoints = new List <CandleStickDataPoint>(); for (int ii = currentIndex; ii < currentDataCount; ii++) { CurrentData data = CurrentData.ElementAt <CurrentData>(ii); if (data != null) { if (data.LastUpdate >= startTime && data.LastUpdate < endInterval) { candleStickDataPoints.Add(new CandleStickDataPoint() { Price = data.Price, Time = data.LastUpdate }); } if (data.LastUpdate >= endInterval) { break; } } currentIndex++; } if (candleStickDataPoints != null && candleStickDataPoints.Count > 0) { candles.Add(new CandleStick(candleStickDataPoints) { Index = i }); i++; } } return(new CandleChart(candles, this.Instrument)); }
// Navigeren naar een nieuwe viewmodel en toevoegen aan de navigatie geschiedenis public void NavigateTo(ViewModelBase viewModel) { if (CurrentData.GetType() != viewModel.GetType()) { var index = NavigationHistoryItems.Count; NavigationHistoryItems.Add(viewModel); CurrentData = NavigationHistoryItems[index]; AdjustSelectedItem(); AdjustBackButtonVisibility(); } }
public void OnCallBack(CurrentData latestData) { Console.WriteLine("----------------------------------------------"); Console.WriteLine("Cofee Shop Name :" + latestData.RegisterMyCofeeShop); Console.WriteLine("Number of Cofees Sold :" + latestData.CofeesSold.ToString()); Console.WriteLine("Total Sales on Cofee Rs:" + latestData.TotalSaleonCofee.ToString()); Console.WriteLine("Executed on :" + latestData.DateWhenExecuted.ToString()); Console.WriteLine("Thread ID :" + latestData.ThreadID); Console.WriteLine("Instance Number :" + latestData.InstanceNumber.ToString()); Console.WriteLine("----------------------------------------------"); }
public static void PrepareUnitTestDataStore() { PSCmdletBase.UnitTestMode = true; if (0 < UnitTestOutput.Count) { UnitTestOutput.Clear(); } CurrentData.ResetData(); }
public override void NextBar() { // colocar as cores do grafico padrão igual ao fundo, assim o gráfico não é mostrado CurrentChart.BodyBottomColor = CurrentChart.BackgroundBottomColor; CurrentChart.BodyUpColor = CurrentChart.BackgroundBottomColor; // mostra o novo candle com o padrão de cores tabajara _markers.Insert(0, new Marker(CurrentData.Time(), CurrentData.GetPrice(PriceType.Open))); }
public object Clone() { return(new Session() { InitialData = (SessionData)InitialData?.Clone(), DifferenceData = (SessionData)DifferenceData?.Clone(), CurrentData = (SessionData)CurrentData?.Clone(), SessionDate = SessionDate, Username = Username, GainedPlays = new List <OsuApiHelper.OsuPlay>(GainedPlays) }); }
void Awake() { if (instance == null) { DontDestroyOnLoad(this); instance = this; } else if (instance != this) { Destroy(gameObject); } }
public ActionResult FileNull() { try { currentData = (CurrentData)Session["currentData"]; } catch { return(View(new Error("Неопознанная ошибка"))); } return(View(new Error(currentData.errortext))); }
/// <summary> /// Send usage data specified mail address /// </summary> public static void SendUsageData() { if (DataSender == null) { throw new InvalidOperationException("DataSender must be set before sending data"); } lock (OperationLock) { DataSender.SendData(CurrentData.ToString(SaveOptions.DisableFormatting)); } }
/** **************************************************************************************** * Imports values from the given substring by parsing it. The numbers in the string have * to be separated by ' ' characters (space). * * @param source The Substring that is parsed for the numbers * @param session If \c CurrentData::Clear, which is the default, the current values * are taken from the last session stored and the sessions data is set to 0. * If \c CurrentData::Keep, both, current values and * session values are taken from the string. ******************************************************************************************/ public void Import( Substring source, CurrentData session = CurrentData.Clear ) { Reset(); length= 0; for(;;) { int actStart= source.Start; int value; source.ConsumeInteger( out value ); int lastSession; source.ConsumeInteger( out lastSession ); if ( actStart == source.Start ) break; ensureArraySize( length + 1 ); values [length]= session == CurrentData.Clear ? lastSession : value; sessionValues[length]= session == CurrentData.Clear ? 0 : lastSession; length++; } }
/** **************************************************************************************** * Imports values from the given AString by parsing it using #Export. * * @param source The AString that is parsed for the numbers * @param session If \c CurrentData.Keep the current values are stored to be the last * sessions' data and current values are set to 0. * If \c CurrentData.Clear, which is the default, both, current values and * session values are taken from the string. ******************************************************************************************/ public void Import( AString source, CurrentData session = CurrentData.Clear ) { Import( new Substring( source ), session ); }