Determine if preview mode

2 posts, 1 answers
  1. David A.
    David A. avatar
    126 posts
    Member since:
    Aug 2008

    Posted 30 Jul 2014 Link to this post

    Hi,

    I am trying to conditionally skip code when in design mode, and normally use the following:

    if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
                   return;

    However, when previewing reports hooked up to a temporary objectdatasource, this above code does not work.  Is there a way to determine if I am in report preview mode?  The reason I ask is that I want to bypass the _NeedDataSource event if I am in VS and previewing the report.

    Thanks,
    David A.
  2. Answer
    Stef
    Admin
    Stef avatar
    3036 posts

    Posted 04 Aug 2014 Link to this post

    Hello David,

    Telerik Reporting is integrated tool, where on preview in the VS Report Designer the start application is Visual Studio.

    Possible approach to handle the case is described by my colleague in the following forum thread: DesignMode property. Based on the provided explanation you can also use an approach to detect which is the running process e.g.:
    public bool isInDesignMode
           {
               get
               {
                   System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess();
                   bool res = process.ProcessName == "devenv";
                   process.Dispose();
                   return res;
               }
           }


    I hope the above information helps you.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
Back to Top