WPF schedule control - wpf

I'm looking for a very simple schedule control for WPF.
What I need is something like daypilot or the Outlook scheduler but with minimal functionality.
I simply want to show a day separated in 24 interval (one for each hour). Inside these 24 hours, the user has to define events/task, non-overlapping each other. That's for theory.
Practically, I want to write a control where the user can define inside a day and for each day a week, how much a kWh of electricity costs.
I found a lot of samples, but most of them are very complex, or simply doesn't work!

Here is my original CodeProject article
http://www.codeproject.com/KB/WPF/WPFOutlookCalendar.aspx
http://www.codeproject.com/KB/WPF/WPFOutlookCalendar2.aspx
And here is my remake
http://rudigroblerwp.wordpress.com/2011/09/27/timeslotpanel/
http://rudigroblerwp.wordpress.com/2011/09/27/who%E2%80%99s-the-boss/

codeplex has open source schedule control, see http://wpfschedule.codeplex.com/ But it has only daily view.

Related

How to let ViewModel trigger View update

I need real time charting (100-200ms updates) of a maximum of 20 series. After some research I settled on syncfusion because I can use the community license and at first sight it seems performant. The only drawback seems to be the sometimes lacky MVVM support.
To get a good realtime performance I found this blog post:
https://www.syncfusion.com/blogs/post/Deliver-high-performance-charts-with-Syncfusions-WPF-chart-control.aspx
I'm especially interested in the 'batch update' section because all 20 series will get updated at the same time, there's no need to rerender the chart 20 times.
An alternative seems to be this: http://help.syncfusion.com/wpf/sfchart/how-to/add-range-of-points-dynamically
I have yet to investigate the differences.
But how can I make this MVVM friendly.
Thanks for your advice!
This requirement can be achieved by accessing the SfChart control from its view(UserControl) which was initialized in the ViewModel class, to have access on SuspendNotification and ResumeNotification methods in SfChart.
Real time updates can be achieved in two ways.
By using auto-scrolling feature, to maintain a fixed amount point in view while real time update and also there is a provision to view old data through scrolling.
By removing the first record from the collection while adding new record at the end.
Demo Samples : Real_Update_Samples

WPF AutoCompleteText - Solution that doesn't lag / lock UI on popup generation

I have tried about 4-5 different WPF solutions so far, including the WPF Toolkit and gradonz.actb (my favorite option) but every single one seems to be lagging when creating the dropdown. Once the dropdown is there, the data loads extremely fast, but on initial creation it is lagged and locks my UI. And this is not just a one time thing, each time it is created it appears to have a second or two lag / UI locking (I am assuming while it creates the object in my tree).
In advance I do know it is not my datasource as I have traced it and it never takes under 10 milliseconds to return to the search providers. I am also returning just 20 items max to the provider, so there is no reason that I can see for this delay. The problem is when it generates the list to show, and it happens on all of the solutions I have found.
Even if you know a licensed one that works well, I am willing to spend to solve this.
I appreciate any help
Anthony Greco
The issue was the popup class was lagging on show and it popped it up each time a new result started. A hack around this was popup on load, and when we don't need it, set the height to 0. Not ideal, but after 4 hours, at least it works.

Adding controls to winform while allowing user to enter input

I have a WinForms data entry form that will have upwards of 1500 questions. I have the questions broken into sections, and each section will have an unkown number of questions. Each section is its own user control and has rows (2 panels, 2 labels, a textbox, and another user control) created and added dynamically for each question. The section controls are then added to the form.
My problem is that the process takes a lot of time, even with using TPL (Task Parallel Library). I would ultimately like to create/add the controls and allow the user to start entering data at the same time. The controls are going into a scrollable panel. While the user is entering data, that data will need processed on a local database...so more threading could be necessary.
I have tried working with TPL, which I am new to, by having all the controls added to a list during processing and then sorted and added to the form after the Parallel.ForEach was complete...takes about 20 seconds for over 1200 questions.
I also tried utilizing a BackgroundWorker component. Using the BWC seems to be the faster of the two, but there is a race condition for the ProgressChanged() eventhandler and not all controls get added...not to mention the way the form looks with all the rerendering.
Am i just using TPL wrong? What's the best way to go about this? Is there another way or do I just make the user stick out the wait?
Thanks
Am i just using TPL wrong? What's the best way to go about this? Is there another way or do I just make the user stick out the wait?
Most likely, you can use TPL, and get the same response time as BW, but a nicer API for this type of operation.
The trick here is to get a TaskScheduler setup for UI interaction, and then use the Task class to push the controls back onto the UI thread as they're ready. I have a blog post on this specific subject which shows how to get a TaskScheduler setup to use with UI threads.
However, I would recommend keeping these in memory and pushing them in batches, to avoid constantly re-rendering the UI. This is likely to be an issue no matter what you're doing.
That being said - I'd question your overall visual design here - if you're trying to display over 1200 questions to the user, some form of paging is probably a much nicer approach than a huge scrollable container. If you page these, you could load and process the first few (which is probably near instantaneous, since you mentioned you can process about 50 questions/second), and then continue loading the others after the first few questions have been displayed.

WPF Newbie question

I'm trying to learn WPF animations and am currently confused by quite a few things:
I used tools like processing, where you have a simple method which is called n times per minute, where n is the frame rate.
The way to do animations in WPF is to modify a property. If i use for example DoubleAnimation then a double is increased as the animation proceeds. But this is not exactly what I want. I want that in every cycle some properties are increased, some are modified by random and some are modified by user interaction. How can I do this in WPF?
What is also confusing me is the fact that WPF supports multiple animations at the same time. How does this work? Is there a thread for every animation or just one for all animations.
I used gdi with c# some time ago. I even could use multiple threads for drawing; As far as I remember I just had to insert all the drawing commands in some queue and then windows took care of them.. I have no idea how this is handled with WPF.
On a basic level, WPF animations are just the same as any other kind of animation: internally a timer ticks and some properties are modified which lead to a different picture when drawn to the screen.
WPF does all the leg work for you to be able to specify animations relative to wall-clock time, like "move that box at 3mm per second to the left". For more complex scenarios you might want to code up your own Animation, see the Custom Animation Overview article on the MSDN.
Regarding threading, WPF works the same as GDI: There is one Thread that handles all the interaction with the WPF model and you can only talk to WPF Controls if you're running on this thread. You can use the Dispatcher to "send" code to this thread if you are free threading. Actual drawing to DirectX is done in a separate thread, but that is of no concern to casual users of the API.
You can run several animations at the same time by putting them into a StoryBoard.
You can use the animation's BeginTime to get one animation to start after another.
You can use the key frames version (DoubleAnimationUsingKeyFrames) or the path version (DoubleAnimationUsingPath) to create complex non-linear animations.

What is the most intuitive, usable way of entering a time of day or a duration?

I'm building a line-of-business application in Silverlight and need to get the user to edit two .NET TimeSpan values. One is a time of day (relative to midnight) and the other is a duration. Currently I'm using two TextBoxes, formatted as hh:mm. This is pretty straightforward, but it could definitely be improved. I've observed people using the application and while some have no problem quickly entering times, other people struggle.
Given that I'm working in Silverlight2, what would you see as the perfect custom control that easily let you visualize and edit these two TimeSpans?
To make things harder, the UI should allow any time of the day to be selected with accuracy down to the minute, but emphasize times within the normal working day (eg: 8:00am - 5:00pm). Some users tend to enter 2:00 (am) when they really mean 2:00pm.
In my app, I'm tending towards aligning the times and durations to 5 minute intervals. As a bit of background, this app is similar to a room booking app where people specify when and how long they want a room for.
In one of my web applications I used a slider with 2 handles.
Example:
|.........Y-----------------Y...|
5AM 8PM
Of course I didn't need as high precision as you do, but I believe that with slightly longer slider 5min intervals would be possible.
To emphasize normal workday, you could colour background of the slider in different colour for normal workday. Or make handlers "snap" to start and end of normal workday.
It probably depends on how accurate you need your data and how varying it can be. If it doesn't need to be perfectly accurate and it doesn't vary a lot, you could do something like
Task was performed at [select start time...] o'clock for [select duration...]
where [select start time...] is a pulldown with every hour and [select duration...] is a pulldown with common scenarios for what you're tracking like "30 mins", "1 hour", "2 hours"
If it needs to be flexible maybe just going with the sentence structure and replacing the pulldowns with textboxes would make it clear for all first time users.
Get the latest Sliverlight Toolkit and use one of the new Time oriented controls
Look at Outlook perhaps, it uses dropdowns that defaults to sane half hours (to me anyway ;) and the selections can then be edited by hand afterwards if higher precision is wanted. The duration also follows when the start time is changed, and defaults to an hour or something.
I used text boxes in an old web application before just like you, with the added option of double-clicking them to bring up a quick selection widget like the above Outlook Sample. Perhaps a button or some other Silverlight magic can enhance that.
A vertical time-line like a calendar day in Outlook where you can drag the top and bottom of a meeting "box" is to me the most instuitive or atleast quickest way to place and adjust a booking. Perhaps if it's prefilled with one that spans an hour or so, easily draggable to change the start time - with the top and bottom resizeable to change the duration.
Expanding on what Anthony said, Silverlight Toolkit March 2009 release include TimePicker & TimeUpDown controls.
You can see a live demo of TimeUpDown and TimePicker with 2 popups at:
http://silverlight.codeplex.com/Wiki/View.aspx?title=Silverlight%20Toolkit%20Overview%20Part%201#TimeUpDown
I Actually owned the feature set and API for this control, so I'm extremely well familiar nowadays with what's the best form to input time.
There's a whole list of best practices we can talk about for time input. All of which are currently easily found in the controls.
On some concepts we've had to innovate (like the "Time Intellisense" feature) but mostly we were using true time tested concepts. (no pun intended)
However, as part of the non-goals for these controls for v1 we decided to not support time ranges. If you feel that time ranges is something we should natively support, feel free to suggest this on codeplex:
http://silverlight.codeplex.com/WorkItem/Create.aspx
We actively prioritize items based on amount of votes and user scenarios called on in issues.
For now, I'd suggest you just use 2 TimePickers.
Advanced visualizations (like a multi select ruler or a multi slider) are one way of doing time range input, but you've got to have a solid globalized text input system for a fallback option.
This is a great time to ask what task your users are trying to accomplish. You can craft your system's performance based on this. In Outlook, for example, people usually enter the time because they are trying to schedule a meeting -- so you can easily disambiguate "2" or "2:00" to mean 2pm, because very few users are trying to schedule meetings at 2 am. This sounds similar to your application.
If you look at your users, they will likely also be scheduling for typical times -- these should be easy to specify in your interface. E.g., if most meetings are 50 minutes long, that should be very salient, perhaps a button or other one-click option.
I wouldn't recommend inventing a new input widget. The more standard your input tool, the less your users have to think when using your product. Concentrate on the smarts inside your logic, figuring out (and showing the user) what you think they're asking for.

Resources