PDA

View Full Version : کاربرد نخ [STATHREAD]



fatemesoleimani
سه شنبه 27 مرداد 1394, 17:30 عصر
سلام ،
تو پروژه ها در بخش program.cs چرا از این نخ استفاده میشه کاربردش میتونه چی باشه ؟
مثلا تو فرم اصلی برنامه اومدیم با استفاده از یک نخ زبان صفحه کلید را تغییر دادیم یعنی برای این کار باید در قسمت program.cs این [STATHREAD] را تعریف کنیم یا علت این کار هدف های دیگه میتونه باشه از کسانی کار کرده اند تقاضای راهنمایی می کنم
با تشکر و سپاس فراوان

silsin
سه شنبه 27 مرداد 1394, 19:21 عصر
رفرنس برای مطالعه
https://msdn.microsoft.com/en-us/library/system.stathreadattribute%28v=vs.110%29.aspx

اینم یه توضیح واسش :



[STAThread] is a carry-over from COM, Microsoft's "Component Object Model," introduced in 1993 as way to structure interaction and creation of software components; it was/is the "backbone" of ActiveX, OLE, and other layers of software abstraction. See: [^ (http://en.wikipedia.org/wiki/Component_Object_Model)].

COM provided both single-threaded apartment (STA), and multi-threaded (MTA) programming models.

If use the Microsoft Ribbon Control in Win7/8, you are using a COM component. If you use the Microsoft provided Controls in programming WinForms in C#‎‎ .NET, you are probably using Controls created with COM, and ActiveX, that now inter-operate with .NET.

The .NET CLR uses COM Interop as a kind of "bridge" between the world of managed .NET Types and COM facilities, and object [^ (http://en.wikipedia.org/wiki/COM_Interop)].

To get a deeper sense of what [STAThread] means in .NET programming, I suggest you study this excellent essay by Hans Passant: [^ (http://stackoverflow.com/a/4156000/133321)].

To over-simplify: WinForms programming requires the use of [STAThread] ... that, of course, does not stop you from creating and using other threads, as long as they don't "touch" the UI thread.

fatemesoleimani
چهارشنبه 28 مرداد 1394, 19:43 عصر
این ها را قبلا یه نگاهی کرده بودم اما خیلی متوجه نشدم
الان این ribbonControl منظور ribbonControl کامپوننت دات نت بار هست می خوام بدونم چون از کنترل ribbonControl استفاده شده تو برنامه این نخ تعریف شده یا ribbonControl ربطی به ribbonControl از
microsoft ribbonControl نداره