Facing problem in NSProgressIndicator to display progress of process.

qtsoftqtsoft Member ✭✭

Hi,

I am using NSProgressIndicator to display progress of process. for this i am using following code

            var progressIndicator = new NSProgressIndicator (new CGRect (50, 0, 400, 200)) 
            {
                DoubleValue = 0,
                Indeterminate = false
            } ;

            double progressValue = 0;
            totalItems = 50; //it can be changed according to parsed item. as 100, 1000, 9000.....
            //**progressIndicator.MinValue = 0;
            //**progressIndicator.MaxValue = totalItems;**
            while(progressValue < totalItems)
            {
                progressValue += 20;
                progressIndicator.DoubleValue = progressValue;
                mainWindowController.Window.ContentView.AddSubview (progressIndicator);// I also tried keep this line out side the loop 
            }
            //mainWindowController.Window.ContentView.AddSubview (progressIndicator);

            I also set progressInfo.progressIndicator.MaxValue = totalItems; . But progress is not being complete. Its being partially complete like 
            attached image. Where I am going wrong. Correct me.
Tagged:

Answers

  • qtsoftqtsoft Member ✭✭

    progressValue += 1;

  • qtsoftqtsoft Member ✭✭

    Attached image is here...

    1.png 138.6K
  • YuriKuznetsovYuriKuznetsov USMember ✭✭✭

    This code work fine for me

    progress.MinValue = 0;
    progress.MaxValue = 100;
    
    progress.DoubleValue += 20;
    
  • qtsoftqtsoft Member ✭✭

    In my case MaxValue can be any in integer value like 5, 9, 59, 888, 1099 etc. So i am assigning this integer value to

        progress.MaxValue =   totalItems  // (totalItems is any integer value)
    

    And I am running my while loop till progress.MaxValue and in every loop cycle I increment progressValue by 1 like

        progressValue += 1;
    

    an then

    progress.DoubleValue = progressValue;
    

    but progress bar increase very few, but My while loop is running till progress.MaxValue (totalItems). For example my progress.MaxValue(totalItems) is 6 . My while loop is running 6 times. But progress bar is increasing very few like image 1.png but it must be like image 2.png.

    I am initialising Min and Max value like

            progress.MinValue = 0;
                    progress.MaxValue = 6;
    
    1.png 75.6K
    2.png 43.1K
  • qtsoftqtsoft Member ✭✭

    Have you any idea...

  • qtsoftqtsoft Member ✭✭

    Some one else have any idea....

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    I did not realize you had opened multiple threads. Discussion on this is at https://forums.xamarin.com/discussion/128623/unable-to-find-out-problem-in-nsprogressindicator

This discussion has been closed.