中文字幕在线一区二区在线,久久久精品免费观看国产,无码日日模日日碰夜夜爽,天堂av在线最新版在线,日韩美精品无码一本二本三本,麻豆精品三级国产国语,精品无码AⅤ片,国产区在线观看视频

      Winform多線程方式登錄代碼

      時(shí)間:2024-10-10 19:18:57 ACCP培訓(xùn) 我要投稿
      • 相關(guān)推薦

      關(guān)于Winform多線程方式登錄代碼

        為了方便大家學(xué)習(xí)相關(guān)的知識(shí),YJBYS小編下面為你整理了關(guān)于Winform多線程方式登錄代碼,希望對(duì)你有所幫助。

        bool restart = true;

        while (restart)

        {

        Start(out restart);

        }

        (1):在主進(jìn)程中不停的調(diào)用start.

        void Start(out bool restart)

        {

        bool connected = false;

        restart = false;

        string[] userInfo = null;

        try

        {

        //打開(kāi)LoginInfoForm窗體,返回用戶名密碼。

        userInfo = GetLoginInfo();// Splasher.GetLoginInfo();

        if (userInfo == null)

        {

        loginOK = false;

        return;

        }

        //啟動(dòng)登陸后臺(tái)線程。LoginProcessForm窗體啟動(dòng)MySplashThread啟動(dòng)不停的打開(kāi)LoginProcessForm窗體。

        Splasher.Show();

        }

        catch (Exception err)

        {

        DebugHelper.Write(err);

        Splasher.ShowDialog("錄入登錄信息發(fā)生異常,請(qǐng)和管理員聯(lián)系", MessageTipType.Error);

        return;

        }

        eProcessState previousStepResult = eProcessState.Complete;

        while (Splasher.StartExecute())

        {

        try

        {

        switch (Splasher.CurrentStep)

        {

        case eLoginState.__:

        case eLoginState.__:

        case eLoginState.__:

        case eLoginState.__:

        }

        previousStepResult = eProcessState.Complete;

        //結(jié)束執(zhí)行

        Splasher.EndExecute(previousStepResult);

        }

        catch (Exception error)

        {

        //略

        }

        }

        }

        //start中的對(duì)過(guò)程的控制。

        static public void Show()

        {

        try

        {

        //當(dāng)?shù)诙握{(diào)用的時(shí)候MySplashThread != null了這個(gè)時(shí)候

        if (MySplashThread != null)

        {

        // public void Reset()

        //{

        // progressView.Reset();

        //currentItemIndex = 0;

        //}

        //相當(dāng)于觸發(fā)MySplashForm.Reset事件。

        MySplashForm.Invoke(new MethodInvoker(MySplashForm.Reset));

        //將窗體顯示出來(lái)。

        MySplashForm.Invoke(new MethodInvoker(MySplashForm.Show));

        return;

        }

        //當(dāng)?shù)谝淮蔚臅r(shí)候調(diào)用構(gòu)造函數(shù)構(gòu)造出窗體。構(gòu)造出來(lái)以后myResetEvent.Set();通知

        if (MySplashForm == null)

        {

        MySplashForm = new LoginProcessForm(myResetEvent);

        }

        //這里只是每次都調(diào)用Application.Run(MySplashForm);作用相當(dāng)于建立起信息循環(huán)隊(duì)列

        MySplashThread = new Thread(new ThreadStart(Splasher.ShowThread));

        MySplashThread.IsBackground = true;

        MySplashThread.SetApartmentState(ApartmentState.STA);

        MySplashThread.Start();

        //等待直到myResetEvent.Set();

        myResetEvent.WaitOne(5000);

        }

        catch (Exception err)

        {

        DebugHelper.Write(err);

        }

        }

        //構(gòu)造函數(shù)。

        public LoginProcessForm(AutoResetEvent autoreset)

        {

        myResetEvent = autoreset;

        Renderer = new SkinFormLoginFormRender();

        InitializeComponent();

        //this.TopMost = true;

        //this.CloseBox = true;

        CanMoveWindow = false;

        labelVersion.Text = "Version:" + AssemblyInfoHelper.AssemblyFileVersion;

        this.Load += new EventHandler(LoginProcessForm_Load);

        }

        delegate void EndExecuteCallback(eProcessState previousProcessResult);

        static public void EndExecute(eProcessState previousProcessResult)

        {

        //winform中子線程不能更新主線程的控件。所以MySplashForm.InvokeRequired代表是否需要更新主線程控件。

        //如果需要更新的話MySplashForm.Invoke

        if (MySplashForm.InvokeRequired)

        {

        //回調(diào)會(huì)繼續(xù)執(zhí)行previousProcessResult,等下次的時(shí)候就會(huì)到下面去執(zhí)行了。

        MySplashForm.Invoke(new EndExecuteCallback(EndExecute), previousProcessResult);

        }

        else

        {

        //如果

        MySplashForm.EndExecute(previousProcessResult);

        }

        }

        ///

        /// 進(jìn)入下一過(guò)程

        ///

        ///

        ///

        public void EndExecute(eProcessState previousProcessResult)

        {

        //progressView為我們使用的用戶控件

        progressView.SetTip(processItems[currentItemIndex], previousProcessResult);

        currentItemIndex++;

        }

        //關(guān)閉代碼

        static public void Close()

        {

        try

        {

        if (MySplashThread == null) return;

        if (MySplashForm == null) return;

        try

        {

        MySplashForm.Invoke(new MethodInvoker(MySplashForm.Close));

        }

        catch (Exception err)

        {

        DebugHelper.Write(err);

        }

        MySplashThread.Abort();

        }

        catch (Exception err)

        {

        DebugHelper.Write(err);

        }

        finally

        {

        MySplashThread = null;

        MySplashForm = null;

        }

        }

      【W(wǎng)inform多線程方式登錄代碼】相關(guān)文章:

      Java多線程的實(shí)現(xiàn)方式07-08

      顯示jquery代碼的四種方式06-26

      PHP Curl多線程原理詳解09-11

      HTML的代碼注釋10-07

      過(guò)濾HTML代碼08-29

      關(guān)于MyEclipse代碼提示設(shè)置包括html和jsp的代碼09-25

      java多線程面試題201710-03

      asp緩存類代碼09-28

      關(guān)于AJAX類代碼09-19

      PHP代碼優(yōu)化技巧09-24

      主站蜘蛛池模板: 图木舒克市| 亚洲成片在线看一区二区| 天堂Av无码Av一区二区三区| AV无码专区亚洲AVL在线观看| 欧美日本国产亚洲网站免费一区二区| 久久精品国产屋| 亚洲综合久久一本久道| av手机在线天堂网| 承德县| 民县| 潜江市| 马尔康县| 龙山县| 合山市| 黑水县| 十堰市| 西峡县| 巴彦淖尔市| av天堂线上| 97色人阁俺也去人人人人人| 伊川县| 视频精品熟女一区二区三区| 宁化县| 熟妇与小伙子露脸对白| 福建省| 国产精品剧情一区二区三区av| 精品无吗国产一区二区三区av| av天堂线上| 精品三级久久久久久久| 国产精品一区二区三区色| 溧水县| 国产精品亚洲ΑV天堂无码| 国产精品伦人视频免费看| 鄂托克前旗| 人妻少妇中文字幕久久69堂| 国产成人久久精品激情91| 国产精品亚洲精品日产久久久 | 精品久久杨幂国产杨幂| 国产成年无码aⅴ片在线观看| 亚洲无码图| 国产人av一区二区三区在线观看|