开发者

property value becomes when Backgrounworker Do-work executes [closed]

开发者 https://www.devze.com 2023-04-05 11:05 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improve this question

i want to share files to social medias. i have taken the list of files and set that into an application object property the list of files value was in applicationobject when the form_Load executes.i have called backgroungworker in form_load In dowork i asked to perform some operation with the method called from another class.when dowork executes iam not having value in application object.

here is my code

 private CloudBuddyApp applicationObject;
        public CloudBuddyApp ApplicationObject
        {
            get { return applicationObject; }
            set { applicationObject = value; }
        }

 enum ProcessType
        {
            PublicAcess
        }
 private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                processtype = ProcessType.PublicAcess;
                uxbackgroundWorker.RunWorkerAsync();
             }
            catch (Exception error)
            {
                CloudBuddyLog.WriteErrorInfo("Share.cs :: Form1_Load :" + error.Message);
            }

         }
 private void uxbackgroundWorker_DoWork(object sender, DoWork开发者_运维技巧EventArgs e)/// when it executes the count becomes zero in application
        {
            //try
            //{
                switch (processtype)
                {
                    case ProcessType.PublicAcess:
                        presenter.GetPublicURL();
                    break;
                }
            //}
            //catch(Exception error)
            //{
            //    CloudBuddyLog.WriteErrorInfo("Share.cs :: uxbackgroundWorker_DoWork:" + error.Message);
            //}
        }

        private void uxbackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                switch (processtype)
                {
                    case ProcessType.PublicAcess:
                        presenter.setdata();
                        uxCommentTextBox.Text = generatedurl;
                    break;
                }
            }
            catch (Exception error)
            {
                CloudBuddyLog.WriteErrorInfo("Share.cs :: uxbackgroundWorker_RunWorkerCompleted:" + error.Message);
            }

        }
0

精彩评论

暂无评论...
验证码 换一张
取 消