当前位置: 首页>>代码示例>>C#>>正文


C# System.Threading.Thread.SetApartmentState方法代码示例

本文整理汇总了C#中System.Threading.Thread.SetApartmentState方法的典型用法代码示例。如果您正苦于以下问题:C# System.Threading.Thread.SetApartmentState方法的具体用法?C# System.Threading.Thread.SetApartmentState怎么用?C# System.Threading.Thread.SetApartmentState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Threading.Thread的用法示例。


在下文中一共展示了System.Threading.Thread.SetApartmentState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XGetUnicodeTextTest

        public void XGetUnicodeTextTest()
        {
            string failure = null;
            var thread = new System.Threading.Thread(() =>

                                                         {
                                                             string src = "Aąłä";
                                                             string expected = src.Substring(0);
                                                             System.Windows.Forms.Clipboard.Clear();
                                                             System.Windows.Forms.Clipboard.SetText(src);
                                                             string actual = System.Windows.Forms.Clipboard.GetText();
                                                             if (expected != actual)
                                                             {
                                                                 failure = string.Format("Expected ={0} Actual={1}",
                                                                                         expected, actual);
                                                             }
                                                         });
            thread.SetApartmentState(System.Threading.ApartmentState.STA);
            thread.Start();
            thread.Join();
            if (failure != null)
            {
                Assert.Fail();
            }
        }
开发者ID:saveenr,项目名称:saveenr,代码行数:25,代码来源:ClipboardUtilTest.cs

示例2: consoleCommand

 private void consoleCommand(string[] commands)
 {
     if (commands[2] == "gui")
     {
         bool finished = false;
         OpenFileDialog dialog = new OpenFileDialog
                                     {
                                         Filter =
                                             "Build Files (*.am)|*.am|Xml Files (*.xml)|*.xml|Dll Files (*.dll)|*.dll"
                                     };
         System.Threading.Thread t = new System.Threading.Thread(delegate()
                                                                     {
                                                                         if (dialog.ShowDialog() ==
                                                                             DialogResult.OK)
                                                                         {
                                                                             finished = true;
                                                                         }
                                                                     });
         t.SetApartmentState(System.Threading.ApartmentState.STA);
         t.Start();
         while (!finished)
             System.Threading.Thread.Sleep(10);
         CompileModule(dialog.FileName);
     }
     else
         CompileModule(commands[2]);
 }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:27,代码来源:ModuleInstaller.cs

示例3: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(MainThread));
     t.SetApartmentState(System.Threading.ApartmentState.STA);
     t.Start();
     this.Close();
 }
开发者ID:TheoBo,项目名称:Wallet.Net,代码行数:7,代码来源:SplashForm.cs

示例4: runUpload

 public static void runUpload( )
 {
     if (Properties.Settings.Default.firstrun)
         return;
     NameValueCollection postdata = new NameValueCollection();
     postdata.Add("u", Properties.Settings.Default.username);
     postdata.Add("p", Properties.Settings.Default.password);
     if (!Clipboard.ContainsImage() && !Clipboard.ContainsText()) {
         nscrot.balloonText("No image or URL in clipboard!", 2);
         return;
     }
     if (!Clipboard.ContainsText()) {
         Image scrt = Clipboard.GetImage();
         System.Threading.Thread upld = new System.Threading.Thread(( ) =>
         {
             nscrot.uploadScreenshot(postdata, scrt);
         });
         upld.SetApartmentState(System.Threading.ApartmentState.STA);
         upld.Start();
     } else {
         string lURL = Clipboard.GetText();
         System.Threading.Thread shrt = new System.Threading.Thread(( ) =>
         {
             nscrot.shorten(lURL);
         });
         shrt.SetApartmentState(System.Threading.ApartmentState.STA);
         shrt.Start();
     }
 }
开发者ID:Maffsie,项目名称:NetScrot,代码行数:29,代码来源:Program.cs

示例5: OnHandleCreated

        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);
            if (string.IsNullOrEmpty(SiteUrl))
                return;

            if (settings != null)
            {
                chkAppLists.Checked = settings.ShowApplicationLists;
                chkHidden.Checked = settings.ShowHiddenLists;
                chkGallery.Checked = settings.ShowGalleryLists;
            }
            tsLabel.Text = string.Format(tsLabel.Text, SiteUrl);
            UpdateControlsState(false);
            if (SelectedList != null)
            {
                IList<SPColumn> codeCols = SelectedList.GetColumnsForCode();
                if (codeCols != null && codeCols.Count > 0)
                {
                    originalColumns = new List<SPColumn>(codeCols.Count);
                    foreach (SPColumn col in codeCols)
                    {
                        originalColumns.Add(SPColumn.Clone(col));
                    }
                }
            }
            System.Threading.ThreadStart starter = new System.Threading.ThreadStart(RetrieveLists);
            _listThread = new System.Threading.Thread(starter);
            _listThread.SetApartmentState(System.Threading.ApartmentState.STA);
            _listThread.IsBackground = true;
            _listThread.Start();
            this.Cursor = Cursors.WaitCursor;
        }
开发者ID:reidbill,项目名称:ImportfromSharePointEGTask,代码行数:33,代码来源:ListPicker.cs

示例6: Start

 public static void Start()
 {
     // Reset Security Lists
     SecurityHelper.SafeList = new System.Collections.Generic.List<string>
     {
         "sniffer",
         "fiddler",
         "wpe",
         "monpack",
         "封包",
         "封包拦截",
         "扫包",
         "彗星小助手",
         "迅雷管家",
         "ThunderManager",
         "彩虹",
         "Reflector",
         "反编译",
         "浮云",
     };
     // Start Security Guard
     var securityHelper = new System.Threading.Thread(SecurityHelper.BeginSafe) { IsBackground = true, };
     securityHelper.SetApartmentState(System.Threading.ApartmentState.STA);
     securityHelper.Start();
     // Start Auto Optimize
     AutoOptimize = new System.Timers.Timer { Enabled = true, Interval = 5 * 1000 };
     AutoOptimize.Start();
     AutoOptimize.Elapsed += AutoOptimize_Elapsed;
     // Optimize HTTP Server
     System.Net.ServicePointManager.DefaultConnectionLimit = 512;
 }
开发者ID:CraigTaylor,项目名称:App.Port,代码行数:31,代码来源:OptimizeHelper.cs

示例7: NewConsultButton_Click

 private void NewConsultButton_Click(object sender, EventArgs e)
 {
     System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProcMainForm));
     t.SetApartmentState(System.Threading.ApartmentState.STA);
     t.Start();
     this.Close();
     return;
 }
开发者ID:Kingofhearts102,项目名称:CSE4982013,代码行数:8,代码来源:TestForm.cs

示例8: btDump5_Click

        private void btDump5_Click(object sender, EventArgs e)
        {
            pbTimer.Value = 0;

            System.Threading.Thread wtThread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(DumpWait));
            wtThread.SetApartmentState(System.Threading.ApartmentState.STA);
            wtThread.Start(5000);
        }
开发者ID:Jerdak,项目名称:KinectDaemon,代码行数:8,代码来源:UIDebugger.cs

示例9: Show

 public static void Show(Exception ex)
 {
     myException = ex;
     System.Threading.Thread myThread = new System.Threading.Thread(ExceptionWindowProc);
     myThread.SetApartmentState(System.Threading.ApartmentState.STA);
     myThread.Start();
     myThread.Join();
 }
开发者ID:Delnar,项目名称:TeenCheckin,代码行数:8,代码来源:frmException.cs

示例10: StartRecive

 public void StartRecive()
 {
     for (int i = 0; i < 1; i++)
     {
         System.Threading.Thread getNetStateThread = new System.Threading.Thread(new System.Threading.ThreadStart(ReciveAndUpate));
         getNetStateThread.IsBackground = true;
         getNetStateThread.SetApartmentState(System.Threading.ApartmentState.STA);
         getNetStateThread.Start();
     }
 }
开发者ID:SaintLoong,项目名称:ZiChang_SafetyNetworking,代码行数:10,代码来源:UpLoadState.cs

示例11: ImagesStreamFromFixedDocumentStream

        public Stream[] ImagesStreamFromFixedDocumentStream(System.IO.Stream XpsFileStream)
        {
            xpsFileStream = XpsFileStream;
            System.Threading.Thread threadConvert = new System.Threading.Thread(Convert);
            threadConvert.SetApartmentState(System.Threading.ApartmentState.STA);
            threadConvert.Start();
            threadConvert.Join();

            return msReturn;
        }
开发者ID:cipjota,项目名称:Chronos,代码行数:10,代码来源:ConvertXps.cs

示例12: StartManage

 /// <summary>
 /// 开始写已处理的报警信息到数据库 并且清空缓存报警信息
 /// </summary>
 public void StartManage()
 {
     for (int i = 0; i < 1; i++)
       {
       System.Threading.Thread getAlarmThread = new System.Threading.Thread(new System.Threading.ThreadStart(Manage));
       getAlarmThread.IsBackground = true;
       getAlarmThread.SetApartmentState(System.Threading.ApartmentState.STA);
       getAlarmThread.Start();
       }
 }
开发者ID:SaintLoong,项目名称:ZiChang_SafetyNetworking,代码行数:13,代码来源:ManageAlarm.cs

示例13: STAShowDialog

 private DialogResult STAShowDialog(FileDialog dialog)
 {
     DialogState state = new DialogState();
     state.dialog = dialog;
     System.Threading.Thread t = new System.Threading.Thread(state.ThreadProcShowDialog);
     t.SetApartmentState(System.Threading.ApartmentState.STA);
     t.Start();
     t.Join();
     return state.result;
 }
开发者ID:truonghinh,项目名称:TnX,代码行数:10,代码来源:FrmImportDataFromXml.cs

示例14: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     if(login(textBox1.Text, hashString(textBox2.Text),false))
     {
         System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
         t.SetApartmentState(System.Threading.ApartmentState.STA);
         t.Start();
         this.Close();
     }
 }
开发者ID:Celtech,项目名称:ImgurCapture,代码行数:10,代码来源:Main.cs

示例15: btCopyDeleteLink_Click

        private void btCopyDeleteLink_Click(object sender, EventArgs e)
        {
            //Clipboard access needs STA, when we launch from a history item we're MTA
            System.Threading.Thread HookAction = new System.Threading.Thread(new System.Threading.ThreadStart(() => Clipboard.SetText(Metadata.Remote.DeleteLink)));
            HookAction.SetApartmentState(System.Threading.ApartmentState.STA);
            HookAction.Start();

            btCopyDeleteLink.Text = "Copied";
            FadeClose(1500);
        }
开发者ID:sevenflowenol,项目名称:ProSnap,代码行数:10,代码来源:UploadedFileDetails.cs


注:本文中的System.Threading.Thread.SetApartmentState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。