dispatcher

as3 - dispatchEvent from a parent swf to a child swf

China☆狼群 提交于 2019-12-05 17:31:41
I have one main "parent" swf that loads several other swfs. If something happens in the main swf I need to tell one of the child swfs about it. This seems to work well the other way around. Any of the children can simply dispatchEvent(), and I can set up the main swf to listen for the event. However, I can't get the child swf to catch any events dispatched by the parent. How is it done? OK, so if you know most of this already, my apologies... but it seems a pretty common issue and isn't immediately obvious. In AS3 events dispatched by objects on the display list can be listened for as they

An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

空扰寡人 提交于 2019-12-05 17:14:26
I'm working on a small application in C# / WPF that is fed by data from the serial port. It also reads a text file containing some constants in order to calculate something. An event handler is made to handle the incoming data when it arrives: _serialPort.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(Receive); Here is the Receive handler, along with a delegate that is created in a Dispatcher, to further update the UI. private delegate void UpdateUiTextDelegate(string text); private void Receive(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { // collect

Dispatcher.Invoke() on Windows Phone 7?

◇◆丶佛笑我妖孽 提交于 2019-12-05 16:34:27
In a callback method I am attempting to get the text property of a textBox like this: string postData = tbSendBox.Text; But because its not executed on the UI thread it gives me a cross-thread exception. I want something like this: Dispatcher.BeginInvoke(() => { string postData = tbSendBox.Text; }); But this runs asynchronously. The synchronous version is: Dispatcher.Invoke(() => { string postData = tbSendBox.Text; }); But Dispatcher.Invoke() does not exist for the Windows Phone. Is there something equivalent? Is there a different approach? Here is the whole function: public void

WPF跨线程访问线程安全的数据

六眼飞鱼酱① 提交于 2019-12-05 15:07:54
wpf报错:(如解决:该类型的CollectionView不支持从调度程序线程以外的线程对其SourceCollection) 典型应用场景:WPF页面程序中,ListView的ItemsSource是一个ObservableCollection<StudentInfo>; 操作:另起一个线程,为ListView动态更新数据,也就是给ObservableCollection<StudentInfo>添加记录。这类操作,就是跨线程访问线程安全的数据,如果不使用Dispatcher,就会导致出错“该类型的CollectionView不支持从调度程序线程以外的线程对其SourceCollection”。 解决方案: Application.Current.Dispatcher.Invoke(new Action(()=> { User_Func(); })); 来源: oschina 链接: https://my.oschina.net/u/2332532/blog/1930251

Dispatcher is not coming on C# Windows Forms Application

不羁的心 提交于 2019-12-05 07:08:51
I have a C# Windows Forms Application with a progress bar. I want to progress that dynamically based on some method status. I have that method in a separate class, and am creating a new thread for that method, with a delegate to pass the status of the method to the parent thread. The same situation I am able solve in a WPF application using progressbar.Dispatcher but in a Windows Forms application there is no Dispatcher, even if I use the System.Threading namespace. progressbar.Dispatcher seems to be available only in a WPF Application. In winforms you can use the ProgressBar.Invoke or

Getting the right WPF dispatcher in a thread [duplicate]

Deadly 提交于 2019-12-05 06:48:22
This question already has answers here : How do I get the UI thread's Dispatcher? (2 answers) Closed 4 years ago . In the constructor of an object i need to create a WPF mediaElement object: m_videoMedia = new MediaElement(); but the class can also be instantiated from a other thread so i need to use Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { m_videoMedia = new MediaElement(); })); But how can I get the right dispatcher instance in that constructor :s You most likely can just use Dispatcher.CurrentDispatcher .Invoke... However, if for some reason that doesn't work, you could

How to invoke WPF Dispatcher in Nunit?

旧巷老猫 提交于 2019-12-05 06:36:38
I want to test an application which renders a text block with a data field value. I would like to get the actual width and actual height, once the rendering completes. Everything works fine. The problem came first, when I tried to test the application. I'm unable to invoke the dispatcher from the test project. Following is the code. this.Loaded += (s, e) => { TextBlock textBlock1 = new TextBlock(); //// Text block value is assigned from data base field. textBlock1.Text = strValueFromDataBaseField; //// Setting the wrap behavior. textBlock1.TextWrapping = TextWrapping.WrapWithOverflow; ////

springmvc注解开发

眉间皱痕 提交于 2019-12-05 02:43:57
ps : 这东西比较简单,用来为我们使用springboot打基础 [TOC] 一 : 工程搭建 (一) 导包 <!-- servlet --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>4.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <!-- spring --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.1.7

从 Spring Boot到 Spring MVC(注解方式)

不想你离开。 提交于 2019-12-04 23:46:47
概述 在前文 《从SpringBoot到SpringMVC(非注解方式)》 之中,我们远离了 Spring Boot的开箱即用与自动配置的便利性后,回归到了淳朴的 Spring MVC开发时代,但是以非注解的方式来给出的,而本文则以注解方式再度讲述一遍。 注: 本文首发于 My Personal Blog:CodeSheep·程序羊 ,欢迎光临 小站 Spring MVC架构模式 一个典型的Spring MVC请求流程如图所示,详细分为12个步骤: 用户发起请求,由前端控制器DispatcherServlet处理 前端控制器通过处理器映射器查找hander,可以根据XML或者注解去找 处理器映射器返回执行链 前端控制器请求处理器适配器来执行hander 处理器适配器来执行handler 处理业务完成后,会给处理器适配器返回ModeAndView对象,其中有视图名称,模型数据 处理器适配器将视图名称和模型数据返回到前端控制器 前端控制器通过视图解析器来对视图进行解析 视图解析器返回真正的视图给前端控制器 前端控制器通过返回的视图和数据进行渲染 返回渲染完成的视图 将最终的视图返回给用户,产生响应 整个过程清晰明了,下面我们将结合实际实验来理解这整个过程。 Spring MVC项目搭建 实验环境如下: IntelliJ IDEA 2018.1 (Ultimate Edition)

Delayed Dispatch Invoke?

╄→гoц情女王★ 提交于 2019-12-04 23:04:04
In WPF due to the intricacies on how the interface is updated I sometimes have to perform actions after a short delay. Currently I'm doing this simply by: var dt = new DispatcherTimer(DispatcherPriority.Send); dt.Tick += (s, e) => { dt.Stop(); //DoStuff }; dt.Interval = TimeSpan.FromMilliseconds(200); dt.Start(); But it's both a bit ugly and perhaps too much overhead to create a new timer each time (?) What's the best from a performance standpoint to do it, ie execute most promptly? And what's good way to rewrite the above code into something like: this.Dispatcher.BeginInvoke(new Action