示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        var json = PlayerPrefs.GetString("SCORE");

        time          = JsonUtility.FromJson <ResultTime>(json);
        timeText.text = timeText.text = time.minute.ToString("00") + ":" + ((int)time.second).ToString("00") + ":" + ((int)time.milis).ToString("000");;
    }
示例#2
0
        public void OnResultExecuted(ResultExecutedContext context)
        {
            var resultTime = new ResultTime <object>()
            {
                ServerTime = DateTime.Now,
                Result     = _result.ToList()
            };

            ResultTimeHelper.SaveResultTimeInDb(resultTime);

            new ObjectResult(resultTime);
        }
示例#3
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat($"Name: {Name}").AppendLine();
            sb.AppendFormat($"Status: {Status}").AppendLine();
            sb.AppendFormat($"HealthType: {HealthType}").AppendLine();
            sb.AppendFormat($"Result Time: {ResultTime.ToString("yyyy-MM-dd HH:mm")}").AppendLine();
            sb.AppendFormat($"UTC Time: {ResultTime.ToString("U")}").AppendLine();
            sb.AppendFormat($"Message: {Message}").AppendLine();

            return(MessageBuilder.ToString());
        }
        public async Task<IEnumerable<Message>> SearchAsync(
            IEnumerable<string> values,
            ResultType resultType,
            ResultTime resultTime,
            int count,
            long id)
        {
            var additionalParam = resultTime == ResultTime.SinceId 
                ? $"&since_id={id}" 
                : $"&max_id={id}";

            return await SearchAsync(values, resultType, count, additionalParam);
        }
示例#5
0
        private void TimeTextbox_TextChanged(object sender, EventArgs e)
        {
            int ResultTime;

            if (!int.TryParse(TimeTextbox.Text, out ResultTime))
            {
                TimeTextbox.BackColor = Color.LightPink;
                StartButton.Enabled   = false;
            }
            else
            {
                TimeTextbox.BackColor = Color.White;
                Properties.Settings.Default.TimeDefault = ResultTime.ToString();
                StartButton.Enabled = true;
            }
        }
示例#6
0
 //Сравнение времен сегментов для сортировки
 public bool Less(Segment s)
 {
     if (!Begin.EqulasToMilliSeconds(s.Begin))
     {
         return(Begin.Minus(s.Begin) < 0);
     }
     if (!End.EqulasToMilliSeconds(s.End))
     {
         return(End.Minus(s.End) < 0);
     }
     if (IsResultTime && s.IsResultTime)
     {
         return(ResultTime.Minus(s.ResultTime) < 0);
     }
     return(false);
 }
        public ResultTime ComparePerformance()
        {
            Stopwatch timeSQL  = new Stopwatch();
            Stopwatch timeLinq = new Stopwatch();

            ResultTime result = new ResultTime();

            timeLinq.Start();

            _dbContext.Employees.Include(h => h.HiringHistories).ThenInclude(a => a.Achievements).ToList();

            timeLinq.Stop();
            result.TimeLinq = timeLinq.ElapsedMilliseconds.ToString();

            timeSQL.Start();
            //var sql = string.Format(@"SELECT E.Id, E.Name, E.Surname,
            //        H.Id, H.Name, H.EmployeesId,
            //        A.Id, A.Description, A.HiringHistoriesId
            //    FROM Employees as E
            //    JOIN HiringHistories as H ON H.EmployeesId = E.Id
            //    JOIN Achievements as A ON A.HiringHistoriesId = H.Id
            //    ");
            _dbContext.Employees.FromSqlRaw("SELECT * FROM Employees").ToList();

            /*
             * Я не пойму почему этот запрос работает в Microsoft SQL Server Management Studio, а тут выбивает ошибку
             * SELECT E.Id, E.Name, E.Surname,
             *              H.Id, H.Name, H.EmployeesId,
             *              A.Id, A.Description, A.HiringHistoriesId
             *  FROM Employees as E
             *  JOIN HiringHistories as H ON H.EmployeesId = E.Id
             *  JOIN Achievements as A ON A.HiringHistoriesId = H.Id
             */

            timeSQL.Stop();
            result.TimeSql = timeSQL.ElapsedMilliseconds.ToString();

            return(result);
        }
示例#8
0
 /// <summary>
 /// Called when the engine service user gets the result time information(stamp).
 /// </summary>
 /// <remarks>
 /// In this function, the engine service user's callback delegate 'ResultTime' is invoked repeatedly for sending the time information to the engine service user
 /// and user_data must be transferred to 'ResultTime'. If 'ResultTime' returns false, it should be stopped to call 'ResultTime'.
 /// timeInfo is transferred from SendResult. The type of timeInfo is up to the Stt engine developer.
 /// </remarks>
 /// <param name="timeInfo">The time information</param>
 /// <param name="callback">The callback function</param>
 /// <param name="userData">The user data which must be passed to the callback function ResultTime</param>
 /// <returns>
 /// Following Error Codes can be returned
 /// 1. None
 /// 2. InvalidState
 /// 3. InvalidParameter
 /// </returns>
 /// <precondition>
 /// SendResult will invoke this function
 /// </precondition>
 /// <postcondition>
 /// This function invokes ResultTime repeatedly for getting result time information.
 /// </postcondition>
 /// <since_tizen> 4 </since_tizen>
 public abstract Error ForEachResultTime(IntPtr timeInfo, ResultTime callback, IntPtr userData);
示例#9
0
        private async void AnalyzePage(object s, LoadingStateChangedEventArgs e)
        {
            var wb = s as ChromiumWebBrowser;

            if (await IsPageLoading(wb, e))
            {
                return;
            }
            Logger.Info(ReportName + " Webpage Loaded, Start Analyzing, Finding Report:" + ReportName);
            JavascriptResponse scriptTask = await wb.EvaluateXPathScriptAsync("//button[contains(., 'I Accept')]", ".innerHTML");

            if (scriptTask.Result != null && scriptTask.Result.ToString() == "I Accept")
            {
                await wb.EvaluateXPathScriptAsync("//button[contains(., 'I Accept')]", ".click()");
            }
            Logger.Info("Loading Login Page");
            do
            {
                scriptTask = await wb.EvaluateXPathScriptAsync("//button[contains(., 'I Accept')]", ".innerHTML");
            }while (scriptTask.Result != null && scriptTask.Result.ToString() == "I Accept");
            Logger.Info("Loading Report Options");
            do
            {
                scriptTask = await wb.EvaluateScriptAsync("document.getElementById(\"report-content\").className");
            }while (scriptTask.Result.ToString().Contains("is-loading"));

            Logger.Info("Cleaning Up Selection");
            do
            {
                await wb.EvaluateXPathScriptAsync("//div/select/option[@selected='selected']", ".removeAttribute('selected')");

                scriptTask = await wb.EvaluateXPathScriptAsync("//div/select/option[@selected='selected']", "");
            }while (scriptTask.Result != null);
            Logger.Info("Selecting Report");
            do
            {
                await wb.EvaluateXPathScriptAsync("//div/select/option[contains(.,'" + ReportName + "')]", ".setAttribute('selected', 'selected')");

                Thread.Sleep(100);
                scriptTask = await wb.EvaluateXPathScriptAsync("//div/select/option[@selected='selected']", ".innerHTML");
            }while (scriptTask.Result == null || scriptTask.Result.ToString() != ReportName);

            await wb.EvaluateXPathScriptAsync("//form/input[@value='Submit']", ".click()");

            Logger.Info("Loading Report Content");
            do
            {
                scriptTask = await wb.EvaluateScriptAsync("document.getElementById(\"report-content\").className");

                Thread.Sleep(100);
            }while (scriptTask.Result == null || scriptTask.Result.ToString().Contains("is-loading"));
            Logger.Info("Loading Report Content Table");
            do
            {
                scriptTask = await wb.EvaluateXPathScriptAsync("//div/div/div/table", ".className");

                Thread.Sleep(100);
            }while (scriptTask.Result == null || scriptTask.Result.ToString() != "table table-data table-responsive");
            Logger.Info("Loading Report Content Table Rows");
            do
            {
                scriptTask = await wb.EvaluateXPathScriptAsync("//div/div/div/table/tbody/tr/td", ".innerHTML");

                Thread.Sleep(100);
            }while (scriptTask.Result == null || scriptTask.Result.ToString() == string.Empty);
            await wb.EvaluateXPathScriptAsync("//div/div/div/table/tbody/tr", ".innerHTML");

            string resultToBeFound = FormatDate(ReportToBeFound);

            scriptTask = await wb.EvaluateXPathScriptAsync(string.Format("//div/div/div/table/tbody/tr/td[contains(., '{0}')]", resultToBeFound), ".innerHTML");

            if (scriptTask.Result != null && scriptTask.Result.ToString().Contains(resultToBeFound))
            {
                ResultTime     = FormatDateWithTime(DateTimeHelper.ZoneNow);
                AttachmentPath = System.IO.Path.GetFullPath(ConfigurationManager.AppSettings["TempFolderPath"]) + string.Format("WebpageScreenshot_{0}_{1}.png", ResultTime.Replace(':', '-'), ReportName);
                Thread.Sleep(2000); //allow page to render, JS rendering cannot detected by code
                Logger.Info(ReportName + " Report Found, Generation Time approx to " + ResultTime);
                IsFound = true;
                Logger.Info(ReportName + " Saving Screenshot...");
                await wb.SavePageScreenShot(AttachmentPath);
            }
            else
            {
                Logger.Info(ReportName + " Report is not Ready Yet");
                IsFound = false;
            }
            _pageAnalyzeFinished.Set();
        }
示例#10
0
 public static void SaveResultTimeInDb(ResultTime <object> resultTime)
 {
     _database.Add(resultTime);
     _database.SaveChanges();
 }