WPF Material Design Snackbar handle timer duration expired event - wpf

If a message was added to Snackbar's queue with the durationOverride parameter, it will disappear after that duration. Is it possible to handle such scenario and execute some code in ViewModel?

Related

Run a callback after mouse scrolling is done in C with Gtk

I'm working on a C application using Gtk for the GUI. We have custom slider widgets connected to the "mouse scrolled" event with a callback function. The problem is each scrolling increment will trigger the callback once, which updates a parameter and refreshes a computationaly-expensive rendering. So, when the user scrolls more than once, the GUI freezes until all scrolls are processed individually in sequence.
I want to have the multiple unit scrolling increments recorded as one flat increment, such that the expensive rendering is started only once the user is done scrolling, so we only record all increments until the scrolling is finished and then we update the parameter and refresh the rendering.
My first idea was to have the "mouse scrolled" callback emit some "update" signal and save :
the timestamp of the scroll event long t,
the number of scrolling increments int steps
Each new scrolling event would increment the steps counter and overwrite the timestamp.
Then, the "update" signal would be captured by a function that would wait for t + 0.5 s to actually save the slider value and trigger a new rendering. If the user performs a new scrolling during that time, the function would just keep waiting.
Is there a Gtk or C API to perform that kind of task ?

create popup for events overlap vtiger calendar

How can I add the control to the configuration screen of a calendar event?
overlapping of events or if the same user "assigned to" already has an event in calendar (even partial) between "Start date and time" and "End date and time" of the new one event by clicking the "Save" button a warning popup must appear with the message "It is already present a calendar event at this juncture, we want to proceed?"
The selection YES will create the calendar event, the NO choice will return to edit mode on the event.
One strategy would be to create an ajax action in the events module that receives start and end date & time and checks whether the current user has an overlapping event.
Then you create a JS script that listens to the onclick event of the Save. When clicking on the button you then call the ajax action and process the response.
That's the general idea. Take a look at other ajax actions in Vtiger to have an example.

wpf richtextbox data loading completion event/method

Is there any event get fired upon completion of data loading into richtextbox...
can't use text_changed as it called every time any single alphabet/number/symbol loaded... just looking for some help for some event to be called upon completion of data.

Wpf UI doesnt update if I use Thread.Sleep

private void Window_ContentRendered_1(object sender, EventArgs e)
{
StatusLabel.Text = "Doesnt show up until the sleep is over...0_0";
System.Threading.Thread.Sleep(2000);
}
I want to ask why does it heppend and only then a solution. thanks all
Issue is you are sleeping on UI thread.
After first line execution you slept on UI thread but it's UI thread responsibility to refresh UI (UI thread refreshes UI on Render dispatcher priority). Hence, you see no update after first line execution because UI thread never gets time to execute render priority items queued on dispatcher.
Ideally, you should use DispatcherTimer to wait on UI thread for certain interval of time and then update once interval time is elapsed.
Also, either you should move the long running task on background thread using backgroundWorker and sleep on that thread instead on UI thread. Also as SLaks suggested you can use async/await to get desired result.
However, quick and dirty solution would be to dispatch empty delegate on UI thread with Dispatcher priority set to Render just before you slept on it so that UI refresh part gets executed before thread falls in sleep state.
StatusLabel.Text = "Doesnt show up until the sleep is over...0_0";
lbStatus.Dispatcher.Invoke((Action)(() => { }), DispatcherPriority.Render);
Thread.Sleep(2000);
Idea here is once you queue empty delegate on UI dispatcher with render priority, it will execute all pending items with priority higher or equal to Render. Since, UI refresh is done on on Render priority, UI will be refreshed and you will see update in label content on GUI.

Status Message during function call (WPF, Multithreadin)

I have one "CleanUp" button on my WPF UI.By clicking on this button, I"ll call some C++ wrapper function to do some calculation.The calculation will take some time.
What I want exactly:
1. During calculation, I want to show some message like "Clean-Up is going on" besides one node of TreeView (TreeView is present on same UI.
Any help would be appreciated........
You can try by using a BackgroundWorker.
Just set a new background worker and set it's dowork event to your "wrapper function to do some calculation" ;-)
After that you can trigger the reportprogress event to set a new state or message while it's executing.

Resources