void DiffTime(int minutes) { const string DIGIT = @"\d+"; Regex r = new Regex(DIGIT); int NewTime; if (minutes > Properties.Settings.Default.RealtimeTimerGoalMinutes) { throw new InvalidOperationException("do not substract equal or bigger minute value"); } else if (minutes == Properties.Settings.Default.RealtimeTimerGoalMinutes) { NewTime = 1; } else { NewTime = Properties.Settings.Default.RealtimeTimerGoalMinutes - minutes; } Match m = r.Match(textBox1.Lines[0]); if (m.Success) { string NewLine = r.Replace(textBox1.Lines[0], NewTime.ToString()); textBox1.Select(0, textBox1.Lines[0].Length); textBox1.SelectedText = NewLine; } else { textBox1.Select(0, textBox1.Lines[0].Length); textBox1.SelectedText = textBox1.Lines[0] + " " + NewTime.ToString(); } }
private void Update(EvaluationContext context) { var previousTime = context.TimeInBars; context.TimeInBars = NewTime.GetValue(context); // Execute subtree //SubTree.DirtyFlag.Invalidate(); Result.Value = SubTree.GetValue(context); //Log.Debug($"old:{previousTime} / new:{context.TimeInBars}"); context.TimeInBars = previousTime; //SubTree.DirtyFlag.Clear(); }
private void Update(EvaluationContext context) { var previousKeyframeTime = context.LocalTime; var previousEffectTime = context.LocalFxTime; var newTime = NewTime.GetValue(context); context.LocalTime = newTime; context.LocalFxTime = newTime; // Execute subtree Result.Value = SubTree.GetValue(context); context.LocalTime = previousKeyframeTime; context.LocalFxTime = previousEffectTime; }
// will take time and add 1/2 hour to out time, or remove 1/2 hour from output time private string updateTime(string Update, string strTime) { TimeSpan NewTime; if (Update == "out") { NewTime = Convert.ToDateTime(strTime).AddMinutes(60).TimeOfDay; } else { NewTime = Convert.ToDateTime(strTime).AddMinutes(-60).TimeOfDay; } string strOutput = NewTime.ToString("hh\\:mm"); strOutput = DateTime.ParseExact(strOutput, "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")); return(strOutput); }
protected void ModifyDateTime_Click(object sender, EventArgs e) { //EKKI NOTAÐ LENGUR - Var notað í GridViw3 bool RefreshPage = false; AthleticCompetitionCRUD AthlCRUD = new AthleticCompetitionCRUD(); Athl_CompetitionEvents AthlEvent = new Athl_CompetitionEvents(); AthleticsEntities1 AthlEnt = new AthleticsEntities1(); Global gl = new Global(); string CompCode = gl.GetCompetitionCode(); string NewDateText = ""; string NewTimeText = ""; Int32 CurrentRowNo = 0; Int32 CurrentEventLineNo = 0; Int32 NoOfEvents = GridView3.Rows.Count; DateTime NewDate; DateTime NewTime; DateTime EmptyDateTime = DateTime.ParseExact("17530101 00:00:00", "yyyyMMdd HH:mm:ss", DateTimeFormatInfo.InvariantInfo); for (CurrentRowNo = 0; CurrentRowNo < NoOfEvents; CurrentRowNo++) { CurrentEventLineNo = (Int32)this.GridView3.DataKeys[CurrentRowNo]["greinnumer"]; TextBox EventDateTextBox = (TextBox)GridView3.Rows[CurrentRowNo].FindControl("DagsGreinar"); NewDateText = EventDateTextBox.Text; TextBox EventTimeTextBox = (TextBox)GridView3.Rows[CurrentRowNo].FindControl("TimiGreinar"); NewTimeText = EventTimeTextBox.Text; NewDate = gl.TryConvertStringToDate(NewDateText); NewTime = gl.TryConvertStringToTime(NewTimeText); if ((NewDate > EmptyDateTime) && (NewTime > EmptyDateTime)) { AthlEvent = AthlCRUD.GetCompetitionEvent(CompCode, CurrentEventLineNo); if ((NewDate.ToString("d") != AthlEvent.dagsetning.ToString("d")) || (NewTime.ToShortTimeString() != AthlEvent.timi.ToShortTimeString())) { AthlEvent.dagsetning = NewDate; AthlEvent.timi = NewTime; AthlEnt.UpdateEventDateTimeAndStatus(CompCode, CurrentEventLineNo, NewDate, NewTime, AthlEvent.stadakeppni, AthlEvent.tilkynnaverdlaunaafhendingu); RefreshPage = true; } } } if (RefreshPage == true) { Response.Redirect("NyttMot.aspx" + "?Comp=" + CompCode); } }
public override string ToString() => NewTime.ToString();