/// <summary> /// Päivittää kalenteri järsejtelmän aikaa, päivää ja seasonia /// jos komponentti on enabloitu. /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { if (Enabled) { elapsed += gameTime.ElapsedGameTime.TotalSeconds; // Jos ollaan mitattu tarpeeksi aikaa, lisätään // se kelloon laukaistaan eventti. if (elapsed >= clockTickFrequency) { CurrentTime = CurrentTime.AddMinutes(elapsed); elapsed = 0; if (OnClockTick != null) { OnClockTick(this, new CalendarEventArgs()); } } // Jos päivä on muuttunut, päivitetään kalenterin arvot. if (CurrentTime.Day == 2) { UpdateDay(); UpdateMonth(); UpdateSeason(); } base.Update(gameTime); } }
protected void gvAdvisorSchedule_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton _singleClickButton = (LinkButton)e.Row.Cells[0].Controls[0]; string _jsSingle = ClientScript.GetPostBackClientHyperlink(_singleClickButton, ""); if (Page.Validators.Count > 0) { _jsSingle = _jsSingle.Insert(11, "if(Page_ClientValidate())"); } for (int columnIndex = _FirstEditCellIndex; columnIndex < e.Row.Cells.Count; columnIndex++) { string js = _jsSingle.Insert(_jsSingle.Length - 2, columnIndex.ToString()); e.Row.Cells[columnIndex].Attributes["onclick"] = js; e.Row.Cells[columnIndex].Attributes["style"] += "cursor:pointer;cursor:hand;"; string DayAvailable = (string)DataBinder.Eval(e.Row.DataItem, "Day"); if (!(String.IsNullOrEmpty(DayAvailable.Trim()))) { e.Row.BackColor = System.Drawing.Color.Gray; e.Row.Cells[1].Text = DayAvailable; e.Row.Cells[1].BackColor = System.Drawing.Color.White; double MinutesPerSlot = 30; DataRow[] AvailableDays = AdvisorWeekSchedulesData.Select("Day='" + DayAvailable + "'"); if (AvailableDays != null) { DateTime StartTime, EndTime, CurrentTime; int TimeSlotTableIndex = 0; foreach (DataRow days in AvailableDays) { StartTime = Convert.ToDateTime(days["StartTime"].ToString()); EndTime = Convert.ToDateTime(days["EndTime"].ToString()).AddMinutes(-MinutesPerSlot); CurrentTime = StartTime; while (CurrentTime <= EndTime) { TimeSlotTableIndex = SlotsInDay.IndexOf(CurrentTime.ToShortTimeString()); if (TimeSlotTableIndex != -1) { e.Row.Cells[TimeSlotTableIndex + 2].BackColor = System.Drawing.Color.Green; } else { e.Row.Cells[TimeSlotTableIndex + 2].BackColor = System.Drawing.Color.Gray; } CurrentTime = CurrentTime.AddMinutes(MinutesPerSlot); } } } } } } }
private IEnumerator _localUpdateTimeCoroutine() { while (true) { yield return(new WaitForSeconds(60f)); CurrentTime = CurrentTime.AddMinutes(1); _timeText.text = CurrentTime.TimeOfDay.ToString().Substring(0, 5) + _region; } }
public string BuildUrl(string baseUrl) { var accessId = _credentials["ID"]; var secret = _credentials["Secret"]; var expiration = CurrentTime.AddMinutes(5).ToUnixTime(); var bytesToHash = Encoding.ASCII.GetBytes($"{accessId}\n{expiration}"); var signatureCode = GetSignatureCode(bytesToHash, secret); return($"http://lsapi.seomoz.com/linkscape/url-metrics/{baseUrl}?Cols=288230376151711743&AccessID={accessId}&Expires={expiration}&Signature={signatureCode}"); }
//timer där 5 minuter passerar varje sekund private void currentTimeChange(object sender, EventArgs e) { var second = CurrentTime.AddMinutes(1); CurrentTime = second; currentTime.Text = CurrentTime.ToShortTimeString(); if (SelectedTime != null) { CheckIfParkingIsOver(); } }
/* * The method randomizes the sequence textboxes. * New start time: (current simulation time) + (random amount of minutes between 5 and 120) * New end time: (New start time) + (random amount of minutes between 5 and 120) * New room and activity: random selection from database where the new room and activity are compatible with each other */ public void RandomizeSequence() { try { int randomIndex; NewStartTime = CurrentTime.AddMinutes(rnd.Next(5, 120)); NewEndTime = NewStartTime.AddMinutes(rnd.Next(5, 120)); List <DataTypes> RoomActivityList = new List <DataTypes>(); RoomActivityList = dbHandler.GetRoomActivityCombo(); randomIndex = rnd.Next(RoomActivityList.Count); NewRoom = RoomActivityList[randomIndex].Room; NewActivity = RoomActivityList[randomIndex].Activity; } catch (ArgumentOutOfRangeException) { ActivityViewModel.ShowMessageBox("Simulator must be running", "Error"); } }
public void Update(GameTime gameTime) { _accumulator += gameTime.ElapsedGameTime.TotalMilliseconds; if (_accumulator > OneMinutePassesEveryXMilliseconds) { CurrentTime = CurrentTime.AddMinutes(1); if (CurrentTime.Hour >= 19) { var minuteChange = 255d / (5d * 60d); int minute = CurrentTime.Minute + (CurrentTime.Hour - 19) * 60; int calculatedAmbientColor = 255 - (int)(minute * minuteChange); _penumbra.AmbientColor = Color.FromNonPremultiplied(calculatedAmbientColor, calculatedAmbientColor, calculatedAmbientColor, calculatedAmbientColor); } else if (CurrentTime.Hour >= 4) { var minuteChange = 255d / (2d * 60d); int minute = CurrentTime.Minute + (CurrentTime.Hour - 4) * 60; int calculatedAmbientColor = (int)(minute * minuteChange); if (calculatedAmbientColor >= 255) { calculatedAmbientColor = 255; } _penumbra.AmbientColor = Color.FromNonPremultiplied(calculatedAmbientColor, calculatedAmbientColor, calculatedAmbientColor, calculatedAmbientColor); } _accumulator = 0; } }
protected void btnNewSchedule_Click(object sender, EventArgs e) { Button btnNewSchedule = sender as Button; GridViewRow row = (GridViewRow)btnNewSchedule.NamingContainer; gvUniqueID = row.UniqueID; GridViewRow gvMasterRow = (GridViewRow)row.Parent.Parent; string DaySelected = ((Label)(gvAdvisorSetSchedule.Rows[row.RowIndex].FindControl("lblDay"))).Text; double MinutesPerSlot = 30; DateTime CurrentTime; DataRow[] AvailableDays = AdvisorWeekSchedulesData.Copy().Select("Day='" + DaySelected + "'"); List <String> lstAdvisorTimeSlots = new List <string>(); foreach (DataRow days in AvailableDays) { DateTime StartTime = Convert.ToDateTime(days["StartTime"].ToString()); DateTime EndTime = Convert.ToDateTime(days["EndTime"].ToString()).AddMinutes(-MinutesPerSlot); CurrentTime = StartTime; while (CurrentTime <= EndTime) { lstAdvisorTimeSlots.Add(CurrentTime.ToString("hh:mm tt")); CurrentTime = CurrentTime.AddMinutes(MinutesPerSlot); } } DateTime DayStartTime = Convert.ToDateTime("8:00 AM"); DateTime DayEndTime = Convert.ToDateTime("5:00 PM"); DayEndTime = DayEndTime.AddMinutes(-MinutesPerSlot); CurrentTime = DayStartTime; ddlStartTime.Items.Clear(); ddlEndTime.Items.Clear(); while (CurrentTime <= DayEndTime) { if ((lstAdvisorTimeSlots.IndexOf(CurrentTime.ToShortTimeString())) == -1) { ListItem timeSlot = new ListItem(CurrentTime.ToString("hh:mm tt")); ListItem timeEndSlot = new ListItem(CurrentTime.ToString("hh:mm tt")); if (!(ddlStartTime.Items.Contains(timeSlot))) { ddlStartTime.Items.Add(timeSlot); ddlEndTime.Items.Add(timeEndSlot); } } CurrentTime = CurrentTime.AddMinutes(MinutesPerSlot); } this.lbAdvisorScheduleID.Text = "-1";; lblDayName.Text = DaySelected; this.lblDate.Text = GetSchedule.DayInWeekDate(DaySelected, Convert.ToInt32(ddlWeek.Text.ToString()), Convert.ToInt32(ddlYear.Text.ToString())).ToString("dd-MMM-yyyy"); this.btnSave.Visible = (Convert.ToInt32(GetSchedule.WeekNumber(DateTime.Now).ToString()) > Convert.ToInt32(this.ddlWeek.SelectedValue.ToString().Trim())) ? false: true; if (this.btnSave.Visible == true) { this.btnSave.Visible = (DateTime.Now.Year >= Convert.ToInt32(this.ddlYear.SelectedValue.ToString().Trim())) ? true: false; } mpeScheduleMaintenance.Show(); //show the modal popup extender }
private void OnTimerTick(object sender, EventArgs e) { CurrentTime = CurrentTime.AddMinutes(1); OnOneMinuteIsOver(CurrentTime); }
private void MinutesDownButton_OnClick(object sender, RoutedEventArgs e) { CurrentTime = CurrentTime.AddMinutes(-1); SelectedTime = CurrentTime.ToLocalTime().ToString("t"); }