C# Countdown Timer to chosen date from now - c#

SharpDevelope / WPF Application
For now i got a working program.
What does it do?
It‘s a gridlistview with several entries for reminders.
Columns as followed:
Entry time / date / time / case / description / priority / name who entered / case closed? (as combobox)
So my actual problem:
I want to implement a countdown timer function to the given date and time.
So if someone check the combobox(to create a countdown) while making an entry, the program should create a timer.
I searched several threads here and on other sites, but cant find a good solution.
What should it do when button „add entry to list“ is pressed and the „create timer“ combobox is checked?
Create timer from the date.textbox and time.textbox combined (i cant get it right for a valid datetime). So for me it would be "dd.MM.yyyy HH:mm:ss".
Then substract the combined date from timeNow() and display the remaining time till 0 in a textbox beside the gridview.
I don't know if it would be to much if there are xxx amounts of timers created by entries.

Related

Coded ui Test Unable to find a DateTime picker in an Hierarchy

I’ve 3 Date Time Pickers in a form. I want to select the 2nd Date Time Picker but on playback it always selects the 1st Date Time picker in the hierarchy. I’ve tried giving all the search properties but no success.
Is there a work around for this?

DateTimePicker - Which subfield has focus?

I have a class that derives from DateTimePicker. The picker control has format set to DateTimePickerFormat.Custom and custom format string set to yyyy.MM.dd HH:mm in order to display dates in the format 2013.01.25 21:45. Here, 2013 is the year subfield that gets highlited when the users clicks on it with the mouse cursor or tabs to it using the TAB key. Once highlited, the user can use UP/DOWN keys to increment / decrement the year, or manually enter a new year value. The same holds true for the month, day, hour and minute subfields.
For my application, certain dates or time values are forbidden. For instance, consider the following rule:
An appointment can only be scheduled at a time rounded to the nearest 10 minutes. For instance, you can schedule one at either 21:10 or 21:20, not at 21:13.
For this, I need to know which subfield currently has focus. The problem is I don't know how to determine this. If I know which subfield has focus, I could devise the following set of rules in code.
If the minute subfield is selected, and the user presses the UP key, increment the time by 10 minutes.
If the minute subfield is selected, and the user presses the DOWN key, decrement the time by 10 minutes.
If the minute subfield has lost focus, round the minutes up or down to the nearest 10 minutes.
The only problem that remains.. HOW DO I FIND WHICH SUBFIELD CURRENTLY HAS FOCUS?
NOTE: Yes I can make validation checks in OnLeave event but the my application requires that invalid datetime values be skipped altogether. Also, I have checked out the solution given here. But I am inclined to find the active subfield as an exercise as well. Finally, if its of any use, I'm using C# 4.0 on Windows 7 x86.

Displaying entire year in C# WinForm application

Is it possible to display the entire year (not month by month) in MonthCalendar control. If not is there another option or do I have to make my own control. I need to graphically display some events that happen on certain dates or in certain intervals, and I need to display them for entire year so the standard MonthCalendar's display is not applicable in this case.
Yes you can display a maximum of 12 months. Sincerly I've not worked a lot with this control but looking in the msdn in MonthCalendar Members I found the MonthCalendar.SetCalendarDimensions Method that:
Sets the number of columns and rows of months to display.
So you need to do this:
myMonthCalendarControl.SetCalendarDimensions(4, 3);
//I used 4 columns and 3 rows because the product should be not greater than 12

c# datagrid time information

The User inputs the time information in three different textboxes: hours/mins/seconds.
The time information is stored as total in an xml file in seconds.
The user can edit this value within a datagrid. In the datagrid the time information is shown as seconds. How can I achive that the value stored in seconds shows up in the datagrid in a more human readable format and so that the user can edit it in this way?
e.g. 4205 seconds = 1h 10m 5s
IS there a control or something similar?
You could always build a converter to take the bound value of seconds and spit out a desired string.

Configuring the Date Popup on the WPF DatePicker Control

I have a date picker control that I use for a data collection application. It is using MvvM data binding. When going through a list of dates (see fig1) it will populate the date picker correctly. Whenever I hit new, the date pickers are nulled out. When I pull up the popup, it selects the month and year from the previous date that was set to. (fig 2) Is there anyway to default the pop up show the current month in the current year?
Note : I would like to keep the selected date to null on a new entry to force some validation.
Fig 1
Fig 2
The following image is to show what happens when I set the DisplayDateStart.
(original answer was horribly wrong, sorry about that)
Okay, lets try this again.
Have you tried setting the fallback to today's date?
SelectedDate="{Binding TehDate, FallbackValue={x:Static sys:DateTime.Now}}"

Categories