Updates from February, 2010 Toggle Comment Threads | Keyboard Shortcuts

  • Ali BaderEddin 2:48 am on February 24, 2010 Permalink | Reply
    Tags: AbsoluteUri, GetResponseUri, , SPUrlZone, SPWebApplication, Url   

    SPWebApplication Url 

    I was trying to get the url of a SharePoint web application, but I couldn’t find a Url property for that class. Trying out several properties, I finally found an easy way to get the Url:

    string webUrl = webApp.GetResponseUri(SPUrlZone.Default).AbsoluteUri;

    where webApp is a reference to an object of type SPWebApplication. For example, here is a sample code that displays all web urls in the Farm (except for Central Admin WebApp).

    foreach (SPWebApplication webApp in SPWebService.ContentService.WebApplications)
        string webUrl = webApp.GetResponseUri(SPUrlZone.Default).AbsoluteUri;
    • Girish Kumar Meena 4:36 am on June 25, 2010 Permalink | Reply

      good one. I found your article after I found the solution myself, nevertheless its a nice read.

    • royaline 8:59 am on September 9, 2010 Permalink | Reply

      Thanks for this post. I’ve spent a lot of time trying to get the SPContext of a timer job. Referencing the AbsouteUri was far from thought. This solved my problem. :)


    • Ali BaderEddin 2:12 pm on September 9, 2010 Permalink | Reply

      Glad it helped..

    • Avinash Kumar 1:47 am on March 25, 2011 Permalink | Reply

      Thanks for the valuable post…. :)

    • Mainer 7:24 am on April 12, 2011 Permalink | Reply

      Thank you a lot!

    • Smnkuurg 2:07 am on September 8, 2011 Permalink | Reply

      Recorded Delivery toplist lolita

    • Kmmsupyn 6:18 am on September 8, 2011 Permalink | Reply

      I’ve just graduated pedoclub illegal cp

    • Nwmgpwom 10:58 pm on September 20, 2011 Permalink | Reply

      What university do you go to? Fuskem Nymphets :DDD

    • Ckaqpjfc 9:27 pm on September 22, 2011 Permalink | Reply

      I’d like to transfer some money to this account Lolita Toplist Bbs ilrnt

    • Ootuavaw 9:55 am on September 24, 2011 Permalink | Reply

      Enter your PIN Silver Teen Model

    • Pqvkxikj 11:01 pm on January 4, 2012 Permalink | Reply

      I can’t stand football Max Bbs Touzokudan Livedoor

    • Cmenfenj 11:02 pm on January 4, 2012 Permalink | Reply

      I’m on a course at the moment Dorki Info Loli

    • click here 8:53 am on May 27, 2012 Permalink | Reply

      I had been wondering if you ever considered modifying the design of your blog? Its well written; I really like what you have got to state. But maybe you can include a little more in the way of written content so people might connect to it better. Youve got an awful lot of wording for only having one or two photos. Maybe you can space it out better?

    • Ibraheem 7:36 pm on December 17, 2012 Permalink | Reply

      Thanks for the quick piece of info, saved me time instead of trying the multiple url options available :)

    • kesuburan lelaki 11:19 pm on July 15, 2014 Permalink | Reply

      On the other hand, the second one works the same way except that it only detects if ovulation has already passed.
      It is important to choose a good fertility clinic since you will work with
      them intimately if you happen to require their help. Calculate and study your menstrual cycle
      to determine the time when you are highly fertile and be sure to make love frequently within that fertility window.

    • compro oro 10:59 pm on July 21, 2014 Permalink | Reply

      If you are going for most excellent contents like myself, only
      visit this site daily as it gives feature contents, thanks

    • keyword rank checker 6:54 pm on July 24, 2014 Permalink | Reply

      Quality content is thhe main to bе a focus for thhe people tо pay a
      visit the web site, tҺɑt’s ԝhat tҺіs web site іs providing.

    • Evelyne 2:10 am on August 27, 2014 Permalink | Reply

      These tiny components can damage easily if a large amount of current
      passes through them. During World War II, Eisler was interned in England for being
      an illegal alien. Deliver A Presentation, most performers
      from the witout a doubt throughout-deal through the development of
      awful excessiveness amount the actual malfunction stacking wire small business, even worse.

    • buy grow lights, 11:41 am on September 7, 2014 Permalink | Reply

      It’s amazing designed for me to have a web page, which is good
      in favor of my know-how. thanks admin

    • дизайн 3:23 am on September 17, 2014 Permalink | Reply

      Simply wish to say your article is as surprising.
      The clearness on your post is just great and that
      i could assume you’re a professional in this subject.

      Fine together with your permission let me to snatch your RSS feed to stay up
      to date with approaching post. Thanks a million and please carry on the enjoyable work.

    • wincont.ru 4:38 pm on September 19, 2014 Permalink | Reply

      The juicing recipes company was back in peak performance?
      I am going to preserve thee juice’s valuable nutrients making them fell fuller longer in your juicing recipes using oonly one day and be with people we care about.

    • GTA 5 online money glitch 5:57 am on September 25, 2014 Permalink | Reply

      Thanks on your marvelous posting! I definitely enjoyed reading it, you may be a great author.
      I will remember to bookmark your blog and definitely will come back very
      soon. I want to encourage one to continue your great work, have a nice holiday weekend!

    • san ramon medical center 1:05 am on September 30, 2014 Permalink | Reply

      At this time it seems like Movable Type is the best blogging platform available right now.
      (from what I’ve read) Is that what you are using on your blog?

    • results page 3:56 pm on October 5, 2014 Permalink | Reply

      Nice post. I was checking continuously this blog and I am impressed!

      Extremely useful information specially the last part :) I care for such
      information a lot. I was looking for this certain info for a long time.
      Thank you and best of luck.

  • Ali BaderEddin 4:50 am on February 11, 2010 Permalink | Reply  

    C# Windows Form is Busy 

    There are two very common ways of telling the user that your application is busy. One is to show a progress bar that gets updated based on the progress getting done, and another is to show the “Waiting” cursor while the application is doing work.

    Waiting Cursor

    To show the user the Waiting cursor while your program is busy, all you have to do is to set the current cursor to the Waiting cursor before your code runs, then set it back to an arrow after your code completes.

    Cursor.Current = Cursors.WaitCursor;
    //  Your Code
    Cursor.Current = Cursors.Default;

    Progress Bar

    The progress bar is a more user-friendly solution, but in most cases showing the waiting cursor does the job. Here is the simplest way to use a progress bar:

    int totalSteps = 10;
    for (int i = 1; i <= totalSteps; i++)
        //  One chunk of your code
        int progress = i * 100 / totalSteps;
        blocksProgressBar.Value = progress;
    blocksProgressBar.Value = 0;

    Yes, it’s that easy to implement a progress bar that gets updated based on the work done by your app. However, while progress is shown, the user can’t interact with the UI or do any other operation (the UI thread is the single thread doing the work here). To get the multi-threaded behavior, the easiest way is to use a background worker process, as shown below:

    So instead of putting your code in the event handler method, you will replace it with a call to start the worker process then move the code to the worker process events.

    private void doButton_Click(object sender, EventArgs e)

    The worker process will do its work in the DoWork event. To show progress, the code needs to be split into segments and the background worker ReportProgress method needs to be called whenever a segment of code is executed.

    private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        int totalSteps = 10;
        for (int i = 1; i <= totalSteps; i++)
            //  One chunk of your code
            int progress = i * 100 / totalSteps;

    Whenever progress changes, we need to update the value of the progress bar.

    private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        blocksProgressBar.Value = e.ProgressPercentage;

    When the worker process is done (progress = 100%), we reset the progress bar.

    private void backgroundWorker_Completed(object sender, RunWorkerCompletedEventArgs e)
        blocksProgressBar.Value = 0;

    Below is a Windows Form application that lets you try the concepts explained above, and also shows you how the Marquee progress bar works, which is shockingly harder than the more realistic single-threaded progress bar we’ve discussed above.

    Download source and exe from here.

    • Paul 9:09 am on May 11, 2011 Permalink | Reply

      Thank You! That is exactly what I was looking for.

    • Mike 10:45 am on October 4, 2011 Permalink | Reply

      How do you tie a progress bar to sql query, returning data into a datagridview? It doesn’t have to be totally accurate, just doing something while the data is loading, then stopping once it has loaded…

    • Rudi Larno 8:49 am on December 8, 2011 Permalink | Reply

      Seems like the Marquee style does its work using the UI thread. So then it is logical that your options using System.Threading.Thread.Sleep(milliSecondsToWait); do not work, as you are blocking the UI Thread, not allowing your UI to get updated.

      Nice write up however.

    • yogesh makwana 8:58 pm on January 18, 2012 Permalink | Reply

      i want to know how to use marque in c#.net windowform…??????

    • Ankit Baria 5:31 am on September 14, 2012 Permalink | Reply

      Really helpful post. Thanks

    • http://tinyurl.com/guileasy48296 3:31 am on January 9, 2013 Permalink | Reply

      “C# Windows Form is Busy The Code Log” was
      in fact a truly awesome post, . Keep publishing and I’ll try to continue to keep reading through! Thanks for your time ,Louie

    • caret caretaker careworn carfare cargo carhop caribou caricature caries carillon carillonneur carina carinate carioca cariole carious caritas cark carl carline carling carload carmagnole carman carminative carmine carnage carnal carnal knowledge carnallit 11:42 am on August 5, 2013 Permalink | Reply

      Hi there! I just would like to give a huge thumbs up for the nice information youve gotten here on this post.
      I might be coming again to your weblog for more soon.

    • Khursheed Fateh 10:17 pm on May 12, 2014 Permalink | Reply

      See the modifivations I made to ylour program. Now Timer base progressbar is working.

      private Stopwatch s = new Stopwatch(); // Stopwatch
      private void progressButton2_Click(object sender, EventArgs e)
      showProgress = true;
      timer.Enabled = true;

      s.Start(); // start stopwatch in this method

      marqueeProgressBar.Style = ProgressBarStyle.Marquee; // set progressbar style in this method

      private void timer_Tick(object sender, EventArgs e)
      if ( s.Elapsed < TimeSpan.FromSeconds((double)secondsToWaitSpinner2.Value))
      // as long as elapsed time is less then the delay time
      // keep going
      toolStripStatusLabel1.Text = s.Elapsed.ToString(); // show elapsed time
      marqueeProgressBar.Style = ProgressBarStyle.Blocks;
      s.Stop(); // stop stop-watch here
      s.Reset(); // reset stop watch so that when you click again
      // it starts from begining and
      // not from where it stoped last time
      timer.Enabled = false;
      toolStripStatusLabel1.Text = "";

    • Khursheed Fateh 10:32 pm on May 12, 2014 Permalink | Reply

      “Before and after” part of your code is not working because it is freezing/stoping UI/Form for specified time. Because for the duration marquee is set Form remain froozen/unresponsive progressbar fails to show. You can see this by commenting last statement of method like this. Now you will see progressbar marquee was started but was unable to update itself because form was not responding during that time.

      private void progressButton_Click(object sender, EventArgs e)
      marqueeProgressBar.Style = ProgressBarStyle.Marquee;

      int milliSecondsToWait = (int)secondsToWaitSpinner.Value * 1000;

      // marqueeProgressBar.Style = ProgressBarStyle.Blocks;

    • Marty 7:08 pm on July 21, 2014 Permalink | Reply

      I was curious if you ever considered changing the
      structure of your blog? Its very well written; I love what youve
      got to say. But maybe you could a little more in the way of content so people could
      connect with it better. Youve got an awful lot of text
      for only having one or two images. Maybe yyou could space iit out better?

    • Eleanore 1:10 am on July 22, 2014 Permalink | Reply

      I’m impressed, I must say. Rarely do I encounter a blog that’s both educative and amusing,
      and let me tell you, you have hit the nail on the head.
      The problem is an issue that not enough men and women are speaking intelligently about.
      Now i’m very happy I came across this during my search for something regarding this.

    • altin yuzuk 4:41 am on August 2, 2014 Permalink | Reply

      Hello to every , because I am actually eager of reading this
      blog’s post to be updated daily. It consists of nice data.

    • No pain, No Gain - Bodybuilding Documentary 11:20 am on September 20, 2014 Permalink | Reply

      Link exchange iis nothing eelse but it is just placing the other person’s web site link on your page at proper place and other person will also
      do similar in favor oof you.

    • https://sites.google.com/site/workview12/creating-pals-on-the-internet-will-earn-dollars-online 7:55 am on September 30, 2014 Permalink | Reply

      I was curious if you ever considered changing the layout of your blog?
      Its very well written; I love what youve got to say.
      But maybe you could a little more in the way of content so people could connect with
      it better. Youve got an awful lot of text for only having 1 or two pictures.
      Maybe you could space it out better?

    • aktivfun.blogg.de 7:38 pm on September 30, 2014 Permalink | Reply

      After going over a number of the blog posts
      on your web site, I truly like your technique of writing a blog.
      I saved it to my bookmark webpage list and will be checking back in the
      near future. Please check out my web site as well and tell me what you think.

    • steroid abuse in young athletes 2:12 pm on October 2, 2014 Permalink | Reply

      Hello are using WordPress for your blog platform?
      I’m new to the blog world but I’m trying to get started and
      set up my own. Do you require any coding knowledge to make your own blog?
      Any help would be really appreciated!

    • Frederick 7:37 am on December 19, 2014 Permalink | Reply

      MyLeadSystemPro has obtained a remarkable reputation to
      take everyday entrepreneurs and turning them into advertising leaders that were extraordinary.
      You’re presented methods, training’s and all the tools that you’ll require to develop into that Community Marketer
      that you are planning to become.

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc

Get every new post delivered to your Inbox.

%d bloggers like this: