public RealResult GetRealData(string pnt) { int nret = 0; double dval = 0; DateTime timestamp = DateTime.Now; string status = ""; string desc = ""; string units = ""; RealResult realVal = new RealResult(); RealResult fallbackRes = new RealResult(); try { nret = RealTime.DNAGetRTAll(pnt, out dval, out timestamp, out status, out desc, out units);//get RT value if (nret == 0) { realVal = new RealResult { dval = dval, timestamp = timestamp, status = status, units = units }; return(realVal); } } catch (Exception ex) { Console.WriteLine("Error while fetching realtime result " + ex.Message); return(fallbackRes); } return(fallbackRes); }
void OnDestroy() { if (inst == this) { inst = null; } }
static int Run() { RealTime.Config cfg = new RealTime.Config(); RealTime.Run(cfg, CreateStralet); return(0); }
private static void Spawn() { GameObject target = new GameObject("_RealTime"); UnityEngine.Object.DontDestroyOnLoad(target); mInst = target.AddComponent<RealTime>(); mInst.mRealTime = Time.realtimeSinceStartup; }
public void addRealTimeInfo(IEnumerable <RealTimeInfoDeserialize> realTimeInfoSource) { _db.ExecuteCommand("TRUNCATE TABLE RealTime"); foreach (RealTimeInfoDeserialize item in realTimeInfoSource) { var newRealTime = new RealTime { region = item.region, srcdetail = item.srcdetail, areaNm = item.areaNm, UID = item.UID, direction = item.direction, y1 = item.y1, x1 = item.x1, happendate = item.happendate, roadtype = item.roadtype, road = item.road, modDttm = item.modDttm, comment = item.comment, happentime = item.happentime, }; _db.RealTime.InsertOnSubmit(newRealTime); } _db.SubmitChanges(); }
public RealTime Index() { var result = new RealTime(); try { bool enableSearch = Configuration.GetValue <bool>("ApiFlag:EnableSearch"); if (!enableSearch) { result.Succeed = false; result.ErrorMsg = "Currently the system is set off."; return(result); } var item = new TimeList(); item.Refresh(); result.TimeList = item; result.Succeed = true; } catch (Exception ex) { result.ErrorMsg = ex.Message + " - " + ex.InnerException; } return(result); }
public RTValue FetchRealTimeData(string pnt) { int nret = 0; double dval = 0; DateTime timestamp = DateTime.Now; string status = ""; string desc = ""; string units = ""; RTValue rtVal; try { nret = RealTime.DNAGetRTAll(pnt, out dval, out timestamp, out status, out desc, out units);//get RT value if (nret == 0) { rtVal = new RTValue { Dval = dval, Timestamp = timestamp, Status = status, Units = units }; return(rtVal); } } catch (Exception ex) { Console.WriteLine("Error while fetching realtime result " + ex.Message); return(null); } return(null); }
static void Spawn () { GameObject go = new GameObject("_RealTime"); DontDestroyOnLoad(go); mInst = go.AddComponent<RealTime>(); mInst.mRealTime = Time.realtimeSinceStartup; }
public static void Shutdown() { if (mInst != null) { Object.Destroy(mInst.gameObject); mInst = null; } }
private static void Spawn() { GameObject gameObject = new GameObject("_RealTime"); UnityEngine.Object.DontDestroyOnLoad(gameObject); RealTime.mInst = gameObject.AddComponent <RealTime>(); RealTime.mInst.mRealTime = Time.realtimeSinceStartup; }
static void Spawn() { GameObject go = new GameObject("_RealTime"); DontDestroyOnLoad(go); mInst = go.AddComponent <RealTime>(); mInst.mRealTime = Time.realtimeSinceStartup; }
public DynamicJsonObject ToJson() { dynamic json = new DynamicJsonObject(); json.realTime = RealTime.ToString(); json.gameTime = GameTime.ToString(); return(json); }
/// <summary> /// Triggered when game is won /// </summary> public void Victory() { RealTime.Stop(); BurningPoints.Start(); newhighscore newscore = new newhighscore(yourScore); newscore.ShowDialog(); Switcher.Switch(new highscores()); }
public static async Task Main(string[] args) { configService.Init(); ConfigOptions options = configService.GetConfig(); Console.WriteLine("# SMART Led Lights Controller"); Console.WriteLine(" - Base URL: " + options.LightsUrl); Console.WriteLine(); // Login Authentication auth = new Authentication(options.LightsUrl); LoginResponse authResponse = auth.Login(); if (!auth.Verify(authResponse)) { Console.WriteLine(Environment.NewLine + "Press Any Key to exit!"); Console.Read(); } // Setup Mode Mode modeService = new Mode(options.LightsUrl); modeService.GetMode(authResponse); modeService.SetMode(authResponse, "rt"); RealTime realTimeMode = new RealTime(options.LightsUrl, 7777, options.LedCount, options.IsRGBWSet); // Setup Brightness Brightness brightness = new Brightness(options.LightsUrl); brightness.GetBrightness(authResponse); brightness.SetBrightness(authResponse, 100); switch (options.Mode) { case 1: // A Demo Mode CarolDemoMode carolDemoMode = new CarolDemoMode(options.LedCount, options.IsRGBWSet, realTimeMode); Console.Read(); Task t = carolDemoMode.Run(authResponse); t.Wait(); break; case 2: // Flash each LED to allow mapping MapLinesMode mapTreeLightsMode = new MapLinesMode(options.LedCount, realTimeMode); Console.Read(); Task t2 = mapTreeLightsMode.Run(authResponse); t2.Wait(); break; } // Reset when done. modeService.SetMode(authResponse, "movie"); brightness.SetBrightness(authResponse, 80); Console.WriteLine(Environment.NewLine + "Press Any Key to exit!"); Console.Read(); }
public void OnExitPressed() { Debug.Log("Mini Games - OnExitPressed"); ClassicMiniGames.RotateToPortrait(delegate { Debug.Log("Mini Games - Finsihed waiting for screen rotation... exiting mini games now"); MinigameManager.Instance.Shutdown(); InputManager.Instance.Shutdown(); RealTime.Shutdown(); ClassicMiniGames.ReturnToWorld(); }); }
static void Spawn() { // 2014/6/12 dandanshih 防止產生二個 _RealTime 物件 if (GameObject.Find("_RealTime") != null) { return; } GameObject go = new GameObject("_RealTime"); DontDestroyOnLoad(go); mInst = go.AddComponent <RealTime>(); mInst.mRealTime = Time.realtimeSinceStartup; }
public static RealTime GetInstance() { if (_instance == null) { _instance = (RealTime)FindObjectOfType(typeof(RealTime)); if ( FindObjectsOfType(typeof(RealTime)).Length > 1 ) { Debug.LogError("[Singleton] Something went really wrong " + " - there should never be more than 1 singleton!" + " Reopenning the scene might fix it."); } } return _instance; }
public void GetRealTime( ) { var realTime = new RealTime("time.windows.com"); try { var now = realTime.Now; var nowInMyTimeZone = realTime.NowInMyTimeZone; Warn.If(realTime.TheAnswerIsReliable, Is.False); Console.WriteLine($"Current UTC time from {realTime.NtpServer} is: {now}."); Console.WriteLine($"Current time from {realTime.NtpServer} in the system time zone is: {nowInMyTimeZone}."); } catch (Exception e) { Assert.Fail($"The operation has failed with the following message: {e.Message}"); } }
public void Run() { Contract.Requires <InvalidOperationException>(!Ended); Contract.Requires <InvalidOperationException>(!double.IsPositiveInfinity(Peek)); Contract.Ensures(Ended); // Real-time management. if (RealTime.Enabled) { // Set the base UNIX time, used to computed the "wall clock" time of timeout events. RealTime.SetCurrentUnixTime(); } this.Timeout(double.MaxValue).Callbacks.Add(e => EndSimulation()); DoSimulate(); }
public void Run(int until) { Contract.Requires <InvalidOperationException>(!Ended); Contract.Requires <InvalidOperationException>(!double.IsPositiveInfinity(Peek)); Contract.Requires <ArgumentOutOfRangeException>(IsValidDelay(until), ErrorMessages.InvalidDelay); Contract.Ensures(Ended); // Real-time management. if (RealTime.Enabled) { // Set the base UNIX time, used to computed the "wall clock" time of timeout events. RealTime.SetCurrentUnixTime(); } this.Timeout(until).Callbacks.Add(e => EndSimulation()); DoSimulate(); }
public ScadaPointResult FetchCurrentPointData(ScadaDataPoint point) { // Fetch a realtime value of the point DateTime timestamp = DateTime.Now; //get Realtime value int nret = RealTime.DNAGetRTAll(point.Id_, out double dval, out timestamp, out string status, out string desc, out string units); ScadaPointResult scadaPointResult; if (nret == 0) { scadaPointResult = new ScadaPointResult(dval, status, timestamp, units); return(scadaPointResult); } return(null); }
public XmlElement ToXml(XmlDocument document, string name = "Time") { var parent = document.CreateElement(name); if (RealTime != null) { var realTime = document.CreateElement("RealTime"); realTime.InnerText = RealTime.ToString(); parent.AppendChild(realTime); } if (GameTime != null) { var gameTime = document.CreateElement("GameTime"); gameTime.InnerText = GameTime.ToString(); parent.AppendChild(gameTime); } return(parent); }
public void Run(SimEvent until) { Contract.Requires <InvalidOperationException>(!Ended); Contract.Requires <InvalidOperationException>(!double.IsPositiveInfinity(Peek)); Contract.Requires <ArgumentNullException>(until != null, ErrorMessages.NullEvent); Contract.Requires <ArgumentException>(ReferenceEquals(this, until.Env), ErrorMessages.DifferentEnvironment); Contract.Requires <ArgumentException>(!until.Failed); Contract.Ensures(Ended); // Real-time management. if (RealTime.Enabled) { // Set the base UNIX time, used to computed the "wall clock" time of timeout events. RealTime.SetCurrentUnixTime(); } // TODO Fix this, since when until is triggered UntilProcess is not immediately triggered. Process(UntilProcess(until)); DoSimulate(); }
public static async Task <ReturnDTO <RealTime> > GetTimeAsync(object activity, string path) { var result = new ReturnDTO <RealTime>(); var aux = new RealTime(); try { if (UtilAccessibility.VerifyInternetAccess(activity)) { using (var httpClient = new HttpClient()) { var content = await httpClient.GetStringAsync(path); DataContractJsonSerializer serializer2 = new DataContractJsonSerializer(typeof(RealTime)); using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(content))) { aux = (RealTime)serializer2.ReadObject(ms); result.Value = aux; result.Return = aux.succeed; } } } else { result.SetarMsgErro("Turn on your internet to update the information."); } } catch (System.Net.WebException) { result.SetarMsgErro("Sorry, there is a problem to connect with our services."); } catch (Exception) { result.SetarMsgErro("Error."); } return(result); }
/// <summary> /// Sets the simulation time. /// </summary> /// <param name="nextNow">The new simulation time.</param> /// <param name="nextWallClock">The new wall clock, used in real-time mode.</param> internal void SetNow(double nextNow, double nextWallClock) { _prevNow = _now; _now = nextNow; // Real-time management. if (RealTime.Enabled) { double delay; if (nextNow < double.MaxValue && (delay = (nextWallClock - RealTime.WallClock.UnixTime)) > 0.0) { // "delay" is measured in seconds, it must be converted into milliseconds. #if NET40 System.Threading.Thread.Sleep((int)(delay * 1000.0)); #else System.Threading.Tasks.Task.Delay((int)(delay * 1000.0)).Wait(); #endif } // Update the base UNIX time after having waited. RealTime.SetCurrentUnixTime(); } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { RealTime = new RealTime(); Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); } }
public override int GetHashCode() { var hashCode = -1519320215; hashCode = hashCode * -1521134295 + IsStarted.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(TickerID); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Ticker); hashCode = hashCode * -1521134295 + Type.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FullName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Prefix); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Currency); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ISIN); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ShortName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ChartName); hashCode = hashCode * -1521134295 + Decimals.GetHashCode(); hashCode = hashCode * -1521134295 + ForgDecimals.GetHashCode(); hashCode = hashCode * -1521134295 + Open.GetHashCode(); hashCode = hashCode * -1521134295 + Close.GetHashCode(); hashCode = hashCode * -1521134295 + Last.GetHashCode(); hashCode = hashCode * -1521134295 + LastHTML.GetHashCode(); hashCode = hashCode * -1521134295 + LastSize.GetHashCode(); hashCode = hashCode * -1521134295 + LastTime.GetHashCode(); hashCode = hashCode * -1521134295 + LastHtmlTime.GetHashCode(); hashCode = hashCode * -1521134295 + Change.GetHashCode(); hashCode = hashCode * -1521134295 + ChangePercentage.GetHashCode(); hashCode = hashCode * -1521134295 + Min.GetHashCode(); hashCode = hashCode * -1521134295 + Max.GetHashCode(); hashCode = hashCode * -1521134295 + DealsCount.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <List <StockDeal> > .Default.GetHashCode(Deals); hashCode = hashCode * -1521134295 + Traffic.GetHashCode(); hashCode = hashCode * -1521134295 + TrafficCount.GetHashCode(); hashCode = hashCode * -1521134295 + OpenInterest.GetHashCode(); hashCode = hashCode * -1521134295 + Status.GetHashCode(); hashCode = hashCode * -1521134295 + PanelJS.GetHashCode(); hashCode = hashCode * -1521134295 + ID.GetHashCode(); hashCode = hashCode * -1521134295 + RealTime.GetHashCode(); hashCode = hashCode * -1521134295 + Pe2000.GetHashCode(); hashCode = hashCode * -1521134295 + Pe2001.GetHashCode(); hashCode = hashCode * -1521134295 + CloseOneMonth.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <TimeSpan> .Default.GetHashCode(CloseOneMonthInterval); hashCode = hashCode * -1521134295 + CloseThreeMonth.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <TimeSpan> .Default.GetHashCode(CloseThreeMonthInterval); hashCode = hashCode * -1521134295 + CloseOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <TimeSpan> .Default.GetHashCode(CloseOneYearInterval); hashCode = hashCode * -1521134295 + OneMonthVolatility.GetHashCode(); hashCode = hashCode * -1521134295 + ThreeMonthVolatility.GetHashCode(); hashCode = hashCode * -1521134295 + OneYearVolatility.GetHashCode(); hashCode = hashCode * -1521134295 + Eps2000.GetHashCode(); hashCode = hashCode * -1521134295 + Eps2001.GetHashCode(); hashCode = hashCode * -1521134295 + MinOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + MinOneYearAt.GetHashCode(); hashCode = hashCode * -1521134295 + MaxOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + MaxOneYearAt.GetHashCode(); hashCode = hashCode * -1521134295 + MinOfAllTime.GetHashCode(); hashCode = hashCode * -1521134295 + MinOfAllTimeAt.GetHashCode(); hashCode = hashCode * -1521134295 + MaxOfAllTime.GetHashCode(); hashCode = hashCode * -1521134295 + MaxOfAllTimeAt.GetHashCode(); hashCode = hashCode * -1521134295 + CloseMinOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + CloseMinOneYearAt.GetHashCode(); hashCode = hashCode * -1521134295 + CloseMaxOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + CloseMaxOneYearAt.GetHashCode(); hashCode = hashCode * -1521134295 + CloseMinAllTime.GetHashCode(); hashCode = hashCode * -1521134295 + CloseMinAllTimeAt.GetHashCode(); hashCode = hashCode * -1521134295 + CloseMaxOfAllTime.GetHashCode(); hashCode = hashCode * -1521134295 + CloseMaxAllTimeAt.GetHashCode(); hashCode = hashCode * -1521134295 + TrafficAvgInSixMonth.GetHashCode(); hashCode = hashCode * -1521134295 + TrafficAvgInOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + StartCount.GetHashCode(); hashCode = hashCode * -1521134295 + Kapit.GetHashCode(); hashCode = hashCode * -1521134295 + BuxKapit.GetHashCode(); hashCode = hashCode * -1521134295 + ChangeInOneMonth.GetHashCode(); hashCode = hashCode * -1521134295 + ChangeInThreeMonth.GetHashCode(); hashCode = hashCode * -1521134295 + ChangeInOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + StartPrice.GetHashCode(); hashCode = hashCode * -1521134295 + MinInOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + MaxInOneYear.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <ChartData> .Default.GetHashCode(ImageData); return(hashCode); }
void Awake() { inst = this; prevTime = Time.realtimeSinceStartup; deltaTime = 0f; }
public override void OnCreate() { base.OnCreate(); RealTime = new RealTime(); }
/// <summary> /// Starting move, copies cards to tempcards /// </summary> /// <param name="card">Card which is clicked</param> /// <param name="fromdeck">int of deck where the cards are from</param> public void StartMove(int index, int fromdeck) { if (timerIsStarted == false) { RealTime.Start(); BurningPoints.Start(); timerIsStarted = true; } if (movedCards.IsEmpty() == true) { if (fromdeck == 0) { movedCards.SetCard(pakka.GetCard(fromdeck), 14); pakka.RemoveLastCard(); fromdecknum = fromdeck; } else if (fromdeck == 1) { movedCards.SetCard(flipdeck.GetCard(fromdeck), 14); flipdeck.RemoveLastCard(); fromdecknum = fromdeck; } else if (fromdeck == 2) { movedCards.SetCard(home1.GetCard(fromdeck), 14); home1.RemoveLastCard(); fromdecknum = fromdeck; if (home1isFull == true) { home1isFull = false; } } else if (fromdeck == 3) { movedCards.SetCard(home2.GetCard(fromdeck), 14); home2.RemoveLastCard(); fromdecknum = fromdeck; if (home2isFull == true) { home2isFull = false; } } else if (fromdeck == 4) { movedCards.SetCard(home3.GetCard(fromdeck), 14); home3.RemoveLastCard(); fromdecknum = fromdeck; if (home3isFull == true) { home3isFull = false; } } else if (fromdeck == 5) { movedCards.SetCard(home4.GetCard(fromdeck), 14); home4.RemoveLastCard(); fromdecknum = fromdeck; if (home4isFull == true) { home4isFull = false; } } // playfield decks else if (fromdeck == 6) { movedCards.SetDeck(plfld1.GetDeck(index, fromdeck), 14); fromdecknum = fromdeck; } else if (fromdeck == 7) { movedCards.SetDeck(plfld2.GetDeck(index, fromdeck), 14); fromdecknum = fromdeck; } else if (fromdeck == 8) { movedCards.SetDeck(plfld3.GetDeck(index, fromdeck), 14); fromdecknum = fromdeck; } else if (fromdeck == 9) { movedCards.SetDeck(plfld4.GetDeck(index, fromdeck), 14); fromdecknum = fromdeck; } else if (fromdeck == 10) { movedCards.SetDeck(plfld5.GetDeck(index, fromdeck), 14); fromdecknum = fromdeck; } else if (fromdeck == 11) { movedCards.SetDeck(plfld6.GetDeck(index, fromdeck), 14); fromdecknum = fromdeck; } else if (fromdeck == 12) { movedCards.SetDeck(plfld7.GetDeck(index, fromdeck), 14); fromdecknum = fromdeck; } else { fromdecknum = fromdeck; ReverseMove(index, fromdeck); } fromdecknum = fromdeck; } else { fromdecknum = fromdeck; ReverseMove(index, fromdeck); } }
protected async Task DrawAvailabilityCardAsync( RealTime data) { //Random rnd = new Random(); string LineName = data.LineName; string OperationName = data.OpName; double Availability = 0.75; string TimeToRepair; if (data.Available) { TimeToRepair = "00:00:00"; } else { TimeToRepair = CalculateDowntimeTimer(data.LastEventTime); } string TotalDowntime = "00:00:00"; bool Available = data.Available; // Canvas margin await this._context.RectAsync(0, 0, 250, 200); // Timer Labels await this._context.SetFontAsync(TimerLabelsFont); await this._context.SetFillStyleAsync(TimerLabelsColor); await this._context.FillTextAsync("Downtime", 5, 18); await this._context.FillTextAsync("Total Downtime", 130, 18); // Time counters await this._context.MoveToAsync(2, 20); await this._context.RectAsync(5, 20, 118, 30); await this._context.MoveToAsync(127, 25); await this._context.RectAsync(127, 20, 118, 30); await this._context.StrokeAsync(); // Counter Numbers await this._context.SetFontAsync(TimerCountersFont); await this._context.FillTextAsync(TimeToRepair, 20, 45); await this._context.FillTextAsync(TotalDowntime, 140, 45); // Reporter Area await this._context.MoveToAsync(0, 60); await this._context.RectAsync(5, 55, 240, 140); await this._context.StrokeAsync(); // Real Time Visual Block await this._context.MoveToAsync(7, 57); await this._context.BeginPathAsync(); await this._context.RectAsync(7, 57, 236, 136); await this._context.ClosePathAsync(); switch (Available) { case true: await this._context.SetFillStyleAsync(RealTimeSecondaryGreen); break; case false: await this._context.SetFillStyleAsync(RealTimeSecondaryRed); break; } await this._context.FillAsync(); // Real Time second Layer await this._context.MoveToAsync(9, 59); await this._context.BeginPathAsync(); await this._context.RectAsync(9, 59, 230, 130); await this._context.ClosePathAsync(); switch (Available) { case true: await this._context.SetFillStyleAsync(RealTimePrimaryGreen); break; case false: await this._context.SetFillStyleAsync(RealTimePrimaryRed); break; } await this._context.FillAsync(); // Operation Data await this._context.SetFontAsync(RealTimeLabesFont); await this._context.SetFillStyleAsync(RealTimeFontColor); await this._context.FillTextAsync(LineName, 10, 85); await this._context.FillTextAsync(OperationName, 10, 110); // Arc representation of availability await this._context.BeginPathAsync(); await this._context.MoveToAsync(65, 180); await this._context.SetFillStyleAsync(FillBackgroundColor); await this._context.ArcAsync(125, 180, 60, Math.PI, 0, false); await this._context.ArcAsync(125, 180, 40, 0, Math.PI, true); await this._context.ClosePathAsync(); await this._context.StrokeAsync(); await this._context.FillAsync(); // Select colors for graph depending on Availability if (Availability < 0.60) { await this._context.SetFillStyleAsync(FillRed); } else if (Availability < 0.85) { await this._context.SetFillStyleAsync(FillYellow); } else { await this._context.SetFillStyleAsync(FillGreen); } // fill the arc with availability await this._context.BeginPathAsync(); await this._context.MoveToAsync(65, 180); await this._context.ArcAsync(125, 180, 60, Math.PI, (Math.PI + Math.PI *Availability), false); await this._context.ArcAsync(125, 180, 40, (Math.PI + Math.PI *Availability), Math.PI, true); await this._context.ClosePathAsync(); await this._context.FillAsync(); // Text representation of availability await this._context.SetFillStyleAsync(RealTimeFontColor); await this._context.SetFontAsync(AvailabilityLabelFont); await this._context.FillTextAsync("A = ", 15, 160); await this._context.FillTextAsync((Availability * 100).ToString() + " %", 98, 175); }
// GET api/values/history?type=snap&pnt=something&strtime=30/11/2016/00:00:00&endtime=30/11/2016/23:59:00&secs=60 // GET api/values/real?pnt=something public object Get(string id, [FromUri] string pnt = "WRLDC.PHASOR.WRDC0783", [FromUri] string strtime = "30/11/2016/00:00:00", [FromUri] string endtime = "30/11/2016/23:59:00", [FromUri] int secs = 60, [FromUri] string type = "snap", [FromUri] string service = "WRDCMP.SCADA1") { //testing the function /* * int nret = 1440; * dynamic jsonObject = new JObject(); * jsonObject.data = new JArray { }; * //testing the function * while (nret >= 0) * { * dynamic resultObj = new JObject(); * resultObj.dval = "val1"; * resultObj.timestamp = "val2"; * resultObj.status = "val3"; * jsonObject.data.Add(resultObj); * * nret = nret - 1; * } * return jsonObject; */ //testing the function int nret = 0; string format = "dd/MM/yyyy/HH:mm:ss"; if (id == "history") { /* * string r = @"(\d{2})/(\d{2})/(\d{4})/(\d{2}):(\d{2}):(\d{2})"; * MatchCollection matches = Regex.Matches(strtime, r); * foreach (Match match in matches) * { * Console.WriteLine(match.Groups[1].Value); * Console.WriteLine(match.Groups[2].Value); * Console.WriteLine(match.Groups[3].Value); * Console.WriteLine(match.Groups[4].Value); * Console.WriteLine(match.Groups[5].Value); * Console.WriteLine(match.Groups[6].Value); * } */ //get history values ArrayList historyResults = new ArrayList(); try { uint s = 0; double dval = 0; DateTime timestamp = DateTime.Now; string status = ""; TimeSpan period = TimeSpan.FromSeconds(secs); //history request initiation if (type == "raw") { nret = History.DnaGetHistRaw(pnt, DateTime.ParseExact(strtime, format, CultureInfo.InvariantCulture), DateTime.ParseExact(endtime, format, CultureInfo.InvariantCulture), out s); } else if (type == "snap") { nret = History.DnaGetHistSnap(pnt, DateTime.ParseExact(strtime, format, CultureInfo.InvariantCulture), DateTime.ParseExact(endtime, format, CultureInfo.InvariantCulture), period, out s); } else if (type == "average") { nret = History.DnaGetHistAvg(pnt, DateTime.ParseExact(strtime, format, CultureInfo.InvariantCulture), DateTime.ParseExact(endtime, format, CultureInfo.InvariantCulture), period, out s); } else if (type == "min") { nret = History.DnaGetHistMin(pnt, DateTime.ParseExact(strtime, format, CultureInfo.InvariantCulture), DateTime.ParseExact(endtime, format, CultureInfo.InvariantCulture), period, out s); } else if (type == "max") { nret = History.DnaGetHistMax(pnt, DateTime.ParseExact(strtime, format, CultureInfo.InvariantCulture), DateTime.ParseExact(endtime, format, CultureInfo.InvariantCulture), period, out s); } while (nret == 0) { nret = History.DnaGetNextHist(s, out dval, out timestamp, out status); if (status != null) { historyResults.Add(new histResult { dval = dval, timestamp = timestamp, status = status }); } } } catch (Exception ex) { Console.WriteLine("Error while fetching history results " + ex.Message); historyResults = new ArrayList(); } return(historyResults); } else if (id == "real") { double dval = 0; DateTime timestamp = DateTime.Now; string status = ""; string desc = ""; string units = ""; realResult realVal; try { nret = RealTime.DNAGetRTAll(pnt, out dval, out timestamp, out status, out desc, out units);//get RT value if (nret == 0) { realVal = new realResult { dval = dval, timestamp = timestamp, status = status, units = units }; return(realVal); } } catch (Exception ex) { Console.WriteLine("Error while fetching realtime result " + ex.Message); return(null); } return(null); } else if (id == "longtoshort") { string shortId = ""; try { InStep.eDNA.EzDNAApiNet.Configuration.ShortIdFromLongId(service, pnt, out shortId); } catch (Exception ex) { Console.WriteLine("Error while fetching longtoshort result " + ex.Message); shortId = ""; } return(new { shortId = shortId }); } else { return(null); } }
public MapLinesMode(int ledCount, RealTime realTime) { this.ledCount = ledCount; this.realTime = realTime; }