dispatcher

Problems with dispatcher in C# console application

做~自己de王妃 提交于 2019-12-04 20:32:32
I need to invoke method runed on timer thread on right working thread. Invoke/BeginInvoke process is working for me. There are 2 threads which shares one inter thread data container for data exchange. One is filling queue, one shuld process the queue. Queue raises event if it is filled after empty state. All the problem is caused by timer, which open new thread on its elapsed event. I am using Dispatcher to dispatch on the right thread, but everything works, except this Dispatcher. :-) Please, does anybody see where the problem is? Complete test code is here: http://pastebin.com/jqYbR9PS .

Dispatcher: abort dispatcher operation

拟墨画扇 提交于 2019-12-04 18:32:08
I want adding items to DataGrid in thread. I have view model for my user control: public class Contact { public string Name { get; set; } public string Phone { get; set; } } public class ContactGridViewModel { public ContactGridViewModel() { Items = new ObservableCollection<Contact>(); } public ObservableCollection<Contact> Items { get; private set; } public Dispatcher Dispatcher { get { return Dispatcher.CurrentDispatcher); } } private DispatcherOperation LastOperation { get; set; } public void Update(IEnumerable<Contact> contacts) { if (LastOperation != null) LastOperation.Abort(); Items

“Must create DependencySource on same Thread as the DependencyObject” When Create GridView

孤人 提交于 2019-12-04 12:45:02
I have a problem with thread.When I want set a GridView into a ListView as View in another thread.It display a message which said: Must create DependencySource on same Thread as the DependencyObject. // Create grid view GridView grid = new GridView(); // Add column // Name grid.Columns.Add((GridViewColumn)myresourcedictionary["gridDirFileName"]); // Type grid.Columns.Add((GridViewColumn)myresourcedictionary["gridDirFileType"]); // Data Modified grid.Columns.Add((GridViewColumn)myresourcedictionary["gridDirFileDataModified"]); // Size grid.Columns.Add((GridViewColumn)myresourcedictionary[

How to configure kamailio server with load balancing and asterisk? [closed]

Deadly 提交于 2019-12-04 08:44:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I want to configure Kamailio server so that traffic will be forwarded to other four asterisk servers equally. It is working fine with a single asterisk box but I am unable to forward a call to another asterisk box. Here is the kamailio.cfg that I am using. #!KAMAILIO #!define WITH_MYSQL #!define WITH_AUTH #

WPF Dispatcher Invoke return value is always null

青春壹個敷衍的年華 提交于 2019-12-04 06:25:31
I have a call to a method that returns a UIElement that I call using the Dispatcher , below is the code. However the return value of the Dispatcher invoke is always NULL, any ideas? void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { var slides = (IList<UIElement>)e.Argument; var bmpSlides = new List<UIElement>(); var imageService = new ImageService(); int count = 0; foreach (UIElement slide in slides) { object retVal = slide.Dispatcher.Invoke( new ThreadStart(() => imageService.GenerateProxyImage(slide))); bmpSlides.Add(imageService.GenerateProxyImage(slide)); _backgroundWorker

Is it possible to recursively flush directories in the CQ5/AEM apache dispatcher?

北城余情 提交于 2019-12-04 05:03:58
I have a dispatcher set up with a fairly deep stats file level due to a particular project in a multi tenancy situation. What I'm hoping is for a way to be able to recursively flush directories to mimic a more shallow stats file level for the other tenants. Is there a dispatcher flush command that allows me to explicitly delete a directory of content? You could achieve this yourself by sending a simple GET request to your dispatcher. The path on the Dispatcher that you need to hit is /dispatcher/invalidate.cache . The following headers ensure that it's processed correctly: CQ-Action: This can

how to give callback function to the Dispatcher.BeginInvoke

隐身守侯 提交于 2019-12-04 03:11:29
问题 I need to use callback function to do some post procesing tasks when the function started with the Dispatcher.BeginInvoke finishes. However i could not find any parameter in Dispatcher.BeginInvoke to accept a callback. Is it possible to give a callback function to Dispatcher.BeginInvoke? 回答1: The DispatcherOperation object returned by BeginInvoke has a Completed event on it. Subscribe to that to perform operations upon completion: var dispatcherOp = Dispatcher.BeginInvoke( /* your method here

Saving a FixedDocument to an XPS file causes memory leak

爷,独闯天下 提交于 2019-12-03 17:19:55
问题 I have created a .NET Windows Service which performs certain actions and generates reports. These reports are XPS documents which I save in a certain directory. Being familiar with WPF, the way I have chosen to create the reports is to instantiate a System.Windows.Documents.FixedDocument , adding FixedPage objects with content as required. My problem is that the Service memory usage goes up and up and up over time as it runs. At first, I went through my code rigorously, ensuring all

WPF Dispatcher, Background worker and a whole lot of pain

ぃ、小莉子 提交于 2019-12-03 15:58:36
Ok this may be really simple but everything I try just seems to hit a brick wall. I have a view model with two properties, which are bound to my WPF form: bool IsWorking {get;set;} ObservableCollection<OtherViewModel> PendingItems {get;set;} I have a method that I call to fetch some new pending items from outlook, however I also what to show some sort of progress on the form(spinning progress bar), the progress bar visibility is bound to the IsWorking property on the ViewModel, and a grid is bound to PendingItems collection. I would like to be able to set the IsWorking to true so the UI can

Change WPF mainwindow label from another class and separate thread

大憨熊 提交于 2019-12-03 12:52:44
问题 Im working on a WPF application. I have a label called "Status_label" in MainWindow.xaml . and I want to change its content from a different class (signIn.cs). Normally I'm able to do this var mainWin = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow; mainWin.status_lable.Content = "Irantha signed in"; But my problem is,when I'm trying to access it via different thread in signIn.cs class, it gives an error: The calling thread cannot