小编Pas*_*bdo的帖子

如何使用php api连接windows8 app c#

我有这个代码,我试图连接到一个php基础api服务器的Windows8应用程序.但是我没有得到任何结果知道,如果我尝试调试它的网址是正确的,并设置变量.我是windows8应用程序和c#的新手,经过多次研究,这是连接到api服务器看起来像任何帮助请


private void Button_Click(object sender, RoutedEventArgs e)
        {

            var username="lucy";
            var password="lucy";

            var request = HttpWebRequest.Create("http://myURL/login.php?username="+username+"&password="+password) as HttpWebRequest;
            request.Method = "POST";
            request.ContentType = "text/json";
            request.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), request);
        }
private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
    {
        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
        // End the stream request operation

        Stream postStream = request.EndGetRequestStream(asynchronousResult);


        // Create the post data
        string postData = JsonConvert.SerializeObject(postStream).ToString();
        MessageDialog msgDialog1 = new MessageDialog(postData, "bayyanit");
      msgDialog1.ShowAsync();

        Debug.WriteLine(postData);
        byte[] byteArray = Encoding.UTF8.GetBytes(postData);


        postStream.Write(byteArray, 0, byteArray.Length);
      //  postStream.Close();

        //Start the web request
        try
        {
            request.BeginGetResponse(new …
Run Code Online (Sandbox Code Playgroud)

php c# api json windows-8

5
推荐指数
1
解决办法
254
查看次数

IsLightDismissEnabled ="True"实际上并没有解雇弹出窗口

我有一个弹出窗口,当我点击弹出窗口外的任何地方时我想关闭它.我搜索过,大家都建议我使用属性IsLightDismissEnabled; 然而,如果我在外面触摸,它将只删除pop pop,使所有处于非活动状态的灰色屏幕,就好像它没有完全关闭弹出窗口这是我的代码片段:

 <Popup x:Name="logincontroler" IsOpen="False" Margin="0,190,896,276" IsLightDismissEnabled="True">
            <StackPanel Height="300" Width="470" x:Name="popup" FlowDirection="RightToLeft">
                <Grid Width="470" Background="White" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="70"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <RichEditBox Grid.Row="1" Height="250" TextWrapping="Wrap" FontSize="20" Name="notesPopupTextBox" FlowDirection="LeftToRight"/>
                    <StackPanel Grid.Row="0" Orientation="Horizontal" Background="#FFE3E3E5">
                        <Button Name="CanclePopupButton" Content="Cancel" Width="64" Height="64" Click="CanclePopupButton_Click" />
                        <Button Name="ClearNotePopupButton" Content="Clear" Width="64" Height="64" Click="ClearNotePopupButton_Click" />
                        <Button Name="saveNoteButton" Content="Save" Width="64" Height="64" Click="saveNoteButton_Click" />

                        <TextBlock FontWeight="Medium"  FontSize="40" Foreground="#2a2a86" Margin="170 12 0 0">Note</TextBlock>
                    </StackPanel>
                </Grid>
            </StackPanel>
        </Popup>
Run Code Online (Sandbox Code Playgroud)

这是我的事件代码

 private void ShowButton_Click(object sender, RoutedEventArgs e)
    {
        logincontroler.IsOpen = true;
        flipView1.IsEnabled = …
Run Code Online (Sandbox Code Playgroud)

c# windows-store-apps windows-8.1

5
推荐指数
1
解决办法
737
查看次数

标签 统计

c# ×2

api ×1

json ×1

php ×1

windows-8 ×1

windows-8.1 ×1

windows-store-apps ×1