How to use multi async method in Windows Runtime Component (C#)

I want to migrate an async method into Windows Runtime Component.
CookieContainer cc = await utility.GetCookieContainer();
But the content of async method still contains async methods.
public async Task<CookieContainer> GetCookieContainer()
if (stsAuthToken != null)
if (DateTime.Now > stsAuthToken.Expires)
this.stsAuthToken = await GetMsoStsSAMLToken();
AuthCookies cookies = await GetAuthCookies(this.stsAuthToken);
CookieContainer cc = new CookieContainer();
Cookie samlAuthCookie = new Cookie("FedAuth", cookies.FedAuth)
Path = "/",
Expires = this.stsAuthToken.Expires,
Secure = cookies.Host.Scheme.Equals("https"),
HttpOnly = true,
Domain = cookies.Host.Host
cc.Add(this.spSiteUrl, samlAuthCookie);
Cookie rtFACookie = new Cookie("rtFA", cookies.RtFA)
Path = "/",
Expires = this.stsAuthToken.Expires,
Secure = cookies.Host.Scheme.Equals("https"),
HttpOnly = true,
Domain = cookies.Host.Host
cc.Add(this.spSiteUrl, rtFACookie);
this.cookieContainer = cc;
And even GetMsoStsSAMLToken and GetAuthCookies contain async methods...
How to migrate it?

Hi Matt,
I'm sorry for my unclear description.
My WinRT Component is for Javascript. If I use folloiong codes, error occurs.
public static async Task<bool> GetInternal(string url, string username, string password)
bool r = await AuthUtility.Create(new Uri(url), username, password);
return r;
The error is
SharePointWindowsRuntimeComponent.Common.GetInternal(System.String, System.String, System.String)' has a parameter of type 'System.Threading.Tasks.Task<System.Boolean>' in its signature. Although this generic type is not a valid Windows Runtime type,
the type or its generic parameters implement interfaces that are valid Windows Runtime types.  Consider changing the type 'Task' in the method signature to one of the following types instead: Windows.Foundation.IAsyncAction, Windows.Foundation.IAsyncOperation,
or one of the other Windows Runtime async interfaces. The standard .NET awaiter pattern also applies when consuming Windows Runtime async interfaces. Please see System.Runtime.InteropServices.WindowsRuntime.AsyncInfo for more information about converting managed
task objects to Windows Runtime async interfaces.
Some articles said, Task<T> is not WinRT type and should be converted to IAsyncOperation<T>. Only stirng, int, bool, object, array of above types and some 'simple' type can be used. (The
related article)
Then I try to convert Task<bool>, but the codes don't work.
Above is why I ask this question.
If async method can be used in WinRT component directly, please let me know why I got above error.
Thanks.

Similar Messages

  • How to use the complete method for as3 FLV component

    Hi team,
    I am using an FLV component dragged to the stage and then bringing in video content.  How can I make it visible=false when it has finished playing using the COMPLETE event?
    Cheers.
    sub

    if your component's instance name is flv_pb, use:
    flv_pb.addEventListener(Event.COMPLETE,completeF);
    function completeF(e:Event):void{
    flv_pb.visible=false;

  • How to use the index method for pathpoints object in illustrator through javascripts

    hii...
    am using Illustrator CS2 using javascripts...
    how to use the index method for pathpoints object in illustrator through javascripts..

    Hi, what are you trying to do with path points?
    CarlosCanto

  • How to use the POST method In Oracle APEX 3.1

    Hi,
    In APEX if we are submitting the page the parameters( Variables ) will pass through URL.
    How to hide the these parameters from URL??
    I Hope POST method will solve this problem.
    How to use the POST method in APEX???
    Help me out to solve this problem.
    thanks in advance.
    Cheers,
    Shan

    In APEX if we are submitting the page the parameters( Variables ) will pass through URL.No they won't. Submission POSTs the <tt>wwv_flow</tt> form.
    Sometimes a branch may be performed after submission, generating a URL in which parameter values are visible. To avoid this, use the save state before branching option.
    Other actions&mdash;like using navigation lists, or clicking a link in a report&mdash;will perform a GET using parameters in the URL. In these cases using Session State Protection is advised.

  • How to use dual monitor display in windows 7 using MSTSC command.......??????

    how to use dual monitor display in windows 7 using MSTSC command ....?????

    Hi Anurag,
    The main issue is how to use the dual monitor in the Remote Desktop Session in Windows 7 ,right ?
    please refer to the following links:
    Using Multiple Monitors in Remote Desktop Session
    http://blogs.msdn.com/b/rds/archive/2009/07/01/using-multiple-monitors-in-remote-desktop-session.aspx
    Best regards

  • How to use my findTheHighest method to find the highest value in my two dim

    I am going to create a 13row by 10 colume two dimensional array.
    how to use my findTheHighest method to find the highest value in my two dimensional array.
    .When i compile this program , i got those as following;
    "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsExce
    at TaxEvolution.findTheHighest(TaxEvolution.java:31)
    at TaxEvolutionClient.main(TaxEvolutionClient.java:25)"
    public class TaxEvolution{
    public double[][] salesTaxRates;
    public TaxEvolution()
      salesTaxRates = new double[13][10];
      fillProvinTaxRates();
    private void fillProvinTaxRates()
      for ( int row = 0; row < salesTaxRates.length; row++ )
        for ( int column = 0; column < salesTaxRates[row].length; column++ )
          salesTaxRates[row][column]= (int)(Math.random()*5000) + 1;
    public double findTheHighest()
        double highest = salesTaxRates[0][0];
        for ( int row = 0; row <= salesTaxRates.length; row++ )
          for ( int column = 0; column <= salesTaxRates[row].length; column++ )
             if ( salesTaxRates[row][column] >= highest )
                   highest = salesTaxRates[row][column];
        return highest;   
    public double[][] arrayTaxEvolution()
      double[][] returnTaxRates = new double[13][10];
      for ( int row = 0; row < salesTaxRates.length; row++ )
        for ( int column = 0; column < salesTaxRates[row].length; column++ )
          returnTaxRates = salesTaxRates;
      return returnTaxRates;
    public class TaxEvolutionClient{
    public static void main( String[] args ){
      TaxEvolution protaxRateList = new TaxEvolution();
      double[][] taxRateList = protaxRateList.arrayTaxEvolution();
        for ( int i = 0; i < taxRateList.length; i++ )
          for ( int j = 0; j < taxRateList[0].length; j++ )
            System.out.print( taxRateList[i][j] + "\t" );               
            System.out.print( protaxRateList.findTheHighest + "\t" );
    }

    Multiposted
    http://forum.java.sun.com/thread.jspa?threadID=699057&tstart=0

  • How to use adobe 5.0 on windows 7 to install 2 upgrades.

    how to use adobe 5.0 on windows 7 to install 2 upgrades.

    Keith you maybe facing an issue with trying to install Photoshop CS2 on Windows 7 in general.  If you have both serial numbers registered, and one of them is a full version, then you can request that your software be unlocked to allow for installation.  Our support team will better be able to determine your eligibility for this.  You can contact them via chat at http://adobe.ly/yxj0t6.

  • I had nokia n8 and now i want to transfer my contacts from nokia to my new i phone 5, i set up i tune and i cloud account but i don't know how to use do it. i have windows 7 and no outlook

    i had nokia n8 and now i want to transfer my contacts from nokia to my new i phone 5, i set up i tune and i cloud account but i don't know how to use do it. i have windows 7 and no outlook

    If I wiped my phone I wouldn't have the contacts on my phone to send to my self.    I would need to take just the contacts from my back up. I would have to do this through iTunes and I don't see how I can just extract the contacts only from my back up. From what I can figure out it is all or nothing

  • How i use multi panel in single applet

    hi master
    sir i need three panel in single applet
    i use this code but not set the panel
    pnl.setBounds(20, 10, 10, 20);
    and
    pnl.setLocation(12, 12);
    and
    pnl.setSize(12, 20);
    this is my class code
    JTable table = new JTable(rdata, columnNames);
    getContentPane().add(table.getTableHeader(),BorderLayout.NORTH);
    getContentPane().add(table);
    JPanel pnl = new JPanel();
    //pnl.setBounds(20, 10, 10, 20);
    //pnl.setLocation(12, 12);
    pnl.setSize(12, 20);
    pnl.add(new JScrollPane(table));
    getContentPane().add(pnl);
    //pnl.setBounds(10, 10, 10, 20);
    please sir give me idea how i use multi panel and how i set panel boundry
    thanking you
    aamir

    http://forum.java.sun.com/thread.jspa?threadID=5118094&tstart=0

  • How to use singloeton factory methods ?

    Hi Guys,
    Can any one   please help me like how to use singleton factory  methods in oops? i am very new to  OOPS concepts ?
    Thanks in advance

    PRINTER - part2
      METHOD constructor.
        "initial printer cartridge fill
        me->number = i_number.
        me->cartridge = i_units.
        me->cost = me->cartridge * 10.
      ENDMETHOD.                  
      METHOD increase_cost.
        cost = cost + i_units.
      ENDMETHOD.                   
      METHOD consume_cartrigde.
        cartridge = cartridge - i_units.
      ENDMETHOD.                   
      METHOD get_total_cost.
        DATA lo_printer TYPE REF TO lcl_printer.
        LOOP AT it_printers INTO lo_printer.
          r_cost = r_cost + lo_printer->get_cost( ).
        ENDLOOP.
      ENDMETHOD.                 
      METHOD get_cost.
        r_cost = cost.
      ENDMETHOD.                
      METHOD get_cartridge.
        r_cartridge = cartridge.
      ENDMETHOD.                   
      METHOD get_number.
        r_number = number.
      ENDMETHOD.                  
    * helper method to show current state of printers
      METHOD show_printers.
        DATA lv_mess   TYPE string.
        DATA lv_number TYPE i.
        DATA lv_cartridge  TYPE i.
        DATA lv_cartridge_c TYPE c LENGTH 5.
        DATA lv_cost TYPE i.
        DATA lv_cost_c TYPE c LENGTH 5.
        DATA lv_number_c TYPE c LENGTH 2.
        DATA lo_printer TYPE REF TO lcl_printer.
        LOOP AT it_printers INTO lo_printer.
          lv_number_c = lv_number = lo_printer->get_number( ).
          lv_cost_c = lv_cost  = lo_printer->get_cost( ).
          lv_cartridge_c = lv_cartridge = lo_printer->get_cartridge( ).
          CONCATENATE lv_mess 'Printer:' lv_number_c ', cost:' lv_cost_c ', cartridge:' lv_cartridge_c
                      cl_abap_char_utilities=>cr_lf INTO lv_mess SEPARATED BY space.
        ENDLOOP.
        MESSAGE lv_mess TYPE 'I'.
      ENDMETHOD.                   
    ENDCLASS.  
    CLIENT
    DATA go_printer  TYPE REF TO lcl_printer. "printers
    DATA go_job TYPE REF TO lcl_job.          "job
    DATA  gv_mess TYPE string.
    DATA: gv_number TYPE i,
          gv_number_c TYPE c LENGTH 10.
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME.
    PARAMETERS: pa_print  TYPE i OBLIGATORY, "printer number
                pa_units TYPE i DEFAULT 100. "initial printer filling
    SELECTION-SCREEN PUSHBUTTON /10(15) addp  USER-COMMAND fcadd  VISIBLE LENGTH 15.
    SELECTION-SCREEN PUSHBUTTON /10(15) refil USER-COMMAND fcref  VISIBLE LENGTH 15.
    SELECTION-SCREEN PUSHBUTTON /10(15) show  USER-COMMAND fcshow VISIBLE LENGTH 15.
    SELECTION-SCREEN PUSHBUTTON /10(15) print USER-COMMAND fcprnt VISIBLE LENGTH 15.
    SELECTION-SCREEN PUSHBUTTON /10(15) total USER-COMMAND fctot  VISIBLE LENGTH 15.
    SELECTION-SCREEN END OF BLOCK bl1.
    SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME.
    PARAMETERS: pa_col   TYPE c1,
                pa_pages TYPE i,
                pa_numb  TYPE i. "to which printer you want the job be send to
    SELECTION-SCREEN END OF BLOCK bl2.
    INITIALIZATION.
      addp = 'Add printer'.
      show = 'Show printers'.
      print = 'Print'.
      total = 'Total cost'.
      refil = 'Refill'.
    AT SELECTION-SCREEN.
      CLEAR: gv_number, gv_number_c, gv_mess.
      CASE sy-ucomm.
        WHEN 'FCADD'.
          go_printer = lcl_printer=>factory( i_number = pa_print
                                             i_units  = pa_units ).
        WHEN 'FCSHOW'.
          IF go_printer IS NOT BOUND.
            MESSAGE 'Add at least one printer first' TYPE 'E'.
          ELSE.
            go_printer->show_printers( ).
          ENDIF.
        WHEN 'FCPRNT'.
          IF pa_pages IS INITIAL.
            MESSAGE 'Provide number of pages' TYPE 'E'.
          ENDIF.
          CREATE OBJECT go_job EXPORTING i_pages = pa_pages i_color = pa_col.
          IF lcl_printer=>get_printer( pa_numb ) IS NOT BOUND.
            gv_number_c = pa_numb.
            condense gv_number_c.
            CONCATENATE 'Printer' gv_number_c 'doesn`t exist, select correct one' INTO gv_mess SEPARATED BY space.
            MESSAGE gv_mess TYPE 'E'.
          ELSE.
            go_printer->print( i_number = pa_numb
                               io_job   = go_job ).
          ENDIF.
        WHEN 'FCTOT'.
          IF go_printer IS BOUND.
            gv_number_c = gv_number = go_printer->get_total_cost( ).
          ENDIF.
          CONCATENATE 'Total cost of all printers for printing and initial cartridge filling is: ' gv_number_c INTO gv_mess
                      SEPARATED BY space.
          MESSAGE gv_mess TYPE 'I'.
        WHEN 'FCREF'.
          IF lcl_printer=>get_printer( pa_print ) IS NOT BOUND.
            gv_number_c = pa_print.
            CONCATENATE 'Printer doesn`t exist' gv_number_c INTO gv_mess SEPARATED BY space.
            MESSAGE gv_mess TYPE 'E'.
          ELSE.
            go_printer->fill_cartridge( i_number = pa_print
                                        i_units = pa_units ).
          ENDIF.
      ENDCASE.
    Regards
    Marcin

  • How to use super.finalize method?

    Hi,
    pls guide how to use super.finalise ( ) method ?
    Regards,
    Pavani

    http://www.janeg.ca/scjp/gc/finalize.html
    Armin

  • How can I consume a c# windows runtime component in a WRL (C++) class?

    I would like to instantiate a class of a C# windows runtime project, from a WRL project.
    In order to make the C# class I have created a WRL project to generate an interface for it to implement. This has worked, but I would rather do it all in the one C# project. I don't know how to do this, and I also don't know how to finally consume the C#
    project (and the resulting .winmd file) from a Wrl project. 

    You're right; I'll post back here.
    Edit: I asked over here:
    https://social.msdn.microsoft.com/Forums/windowsapps/en-US/53a77d09-01b1-4039-8ad3-207b47b08775/how-can-i-consume-a-c-windows-runtime-component-in-a-wrl-c-class?forum=winappswithnativecode#53a77d09-01b1-4039-8ad3-207b47b08775

  • Known issue: Remote deployment fails when windows 10 C++ apps (Windows Universal) with a reference to a Windows Runtime Component is deployed in a remote machine (Windows 10 Insider Preview SDK and tools, April 2015 release)

    When you attempt to deploy a windows 10 C++ Universal app that has a reference to a Windows Runtime component, to a Remote Machine (windows 10 machine), you will get an error message instead of successful deployment.

    Right click solution, Go to Properties -> Configuration Properties -> Configuration - Uncheck "Deploy" checkbox for the Windows Runtime Component project. Then retry deployment to remote machine.

  • How to use ApplicationModule custom methods in JSP?

    I have an ApplicationModule for which I have defined several custom methods (in the ApplicationModuleImpl class). I wish to invoke these methods from a JSP. I'm having trouble getting a scriptable reference to the application module object in the JSP. I can get data from the view objects using the jbo:xxx data tags, but I can't get any sort of reference to the application module object that would allow me to invoke the methods. I have tried editing the application module to expose the methods as client methods, but still can't get a reference to them.
    My main questions:
    1. Is there a way to invoke the custom methods somewhere between the jbo:ApplicationModule tag and the jbo:ReleasePageResources tag?
    2. Is there a way to declare and use the application module without using the jbo:ApplicationModule tag? Would I ever benefit from doing this?

    Alan, here's how to call a custom method String getSomeInfo() that I've created on my application module, MyModule in this example. Also, in this example the id parameter in the ApplicationModule tag is "am" (<jbo:ApplicationModule id="am"...):
    First, edit your application module. In the app module editor, go to the Client Methods tab and move getSomeInfo into the selected list.
    Next, edit your JSP to call your custom method.
    <% MyModule myAm = (MyModule)am.useApplicationModule(); String someInfo = myAm.getSomeInfo(); %>
    You also have to add the correct import statements to the page tag in your JSP:
    <%@ page contentType="text/html;charset=windows-1252" import="oracle.jbo.*, MyModule.common.*"%>
    Hope this helps
    Blaise

  • SubmitGenerateReportAsync Issue. Await operator can only be used with Async Method

    Hi,
    I am trying to submit a request to download keyword performance report using following .
     var reportId =await SubmitGenerateReportAsync(reportRequest); its giving me error 
    The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
    Here is the SubmitGenerateReportAsync method. I am already using async in definition. Not sure what else is wrong.
     private async Task<string> SubmitGenerateReportAsync(ReportRequest report)
                var request = new SubmitGenerateReportRequest
                    ReportRequest = report
                return (await Service.CallAsync((s, r) => s.SubmitGenerateReportAsync(r), request)).ReportRequestId;
    Same issue with PollGenerateReportAsync
     reportStatus =await PollGenerateReportAsync(reportId.ToString());
      private async Task<ReportRequestStatus> PollGenerateReportAsync(string reportId)
                var request = new PollGenerateReportRequest
                    ReportRequestId = reportId
                return (await Service.CallAsync((s, r) => s.PollGenerateReportAsync(r), request)).ReportRequestStatus;
    Let me know if its easy fix.

    I fixed the link to our
    code example which shows how to run such a report from the console. You would create async methods, run, and wait from within Main.
    /// <summary>
    /// The entry point for the console application.
    /// </summary>
    /// <param name="args">Arguments are not required for this example.</param>
    public static void Main(string[] args)
    var example = new KeywordPerformance();
    Console.WriteLine(example.Description);
    try
    var authentication = new PasswordAuthentication(
    "<UserNameGoesHere>",
    "<PasswordGoesHere>");
    // The OAuthHelper class is available for download with the BingAdsExamples solution.
    // OAuthDesktopMobileImplicitGrant authentication = await OAuthHelper.AuthorizeImplicitly();
    var authorizationData = new AuthorizationData
    Authentication = authentication,
    CustomerId = <CustomerIdGoesHere>,
    AccountId = <AccountIdGoesHere>,
    DeveloperToken = "<DeveloperTokenGoesHere>"
    example.RunAsync(authorizationData).Wait();
    catch (Exception ex)
    Console.WriteLine(ex.Message);
    Best regards,
    Eric

Maybe you are looking for

  • Ordering notebook outside of US?

    Hello, I'm from the Netherlands, and I want to order a notebook from Best Buy, is that possible? Or is it U.S. only? Thanks in advance, Paul Solved! Go to Solution.

  • Create multiple id's with same email

    I have 2 iPads, but want separate iTunes accts with the same email address.  Can I do this?

  • Navigation hides behind slideshow

    I have tried several navigation scripts and z-index all over the place but no matter what I try the sub-folders of my navigation on my homepage always gets hidden by the slideshow. Can someone tell me how to correct this? If you need to see it go to

  • DBIF_RSQL_TABLE_UNKNOWN occured. P1=ABAP-gen

    Hi There Could anybody assist. We are busy doing a OS/DB migration and the following is info on our servers. Source system info: OS/ Windows 2008 R2 DB: Oracle 11.3 SAP: ECC6 EHP 7 non-unicode Kernel 740: patch 37 DBSL Patch 051 Tagert system: OS: Wi

  • Mac OS 9.1 password

    I have a Mac OS 9.1 and when I open it, it asks" This Macintosh is protected by Sesame .Please identify yourself ".but I dont know the password. What can I do?