小编And*_*dyB的帖子

在没有互联网访问的情况下从服务器端向 Android 应用程序发送警报/通知

我需要从 web 应用程序向 Android 应用程序发送推送通知。基本上我只想通知 android 客户端服务器上有新数据可用。所以它只需要一个字符串+手机的振动/声音。

这里的(大)问题是我在公司网络中无法访问互联网。这就是我不能使用 GCM 的原因。

到目前为止,我发现以下选项可以在没有 GCM 的情况下完成任务:

  • 使用 XMPP
  • 网络套接字
  • Ajax 轮询

是否可以将 WebSockets 或 AjaxPolling 包含到原生 Android 应用程序中以触发诸如振动之类的事件?

有没有更简单的解决方案,没有 xmpp 那么多的开销,因为我只需要发送一个简短的通知?到目前为止,我明白我需要像SMACK XMPP for Android + 例如OpenfireXMPPHP在这种情况下的服务器端。

ajax android xmpp websocket android-notifications

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

使用pdfsharp将wpf布局保存为pdf,c#

我是c#,wpf和pdfsharp库的新手.这是我的XAML代码:

<Grid>
    <zoom:ZoomControl>
    <graphsharp:GraphLayout x:Name="graphLayout"
                            Graph="{Binding ElementName=root, Path=GraphToVisualize}" 
                            LayoutAlgorithmType="FR"
                            OverlapRemovalAlgorithmType="FSA"
                            HighlightAlgorithmType="Simple"></graphsharp:GraphLayout>
    </zoom:ZoomControl>
    <Button Content="Button" Height="23" Name="button1" Width="75" Margin="12,294,658,412" Click="button1_Click" />
</Grid>
Run Code Online (Sandbox Code Playgroud)

我现在想要使用Pdfsharp将我的"graphLayout"保存到pdf文件中.我创建了一个按钮,基本上使用了pdfsharp wiki中的"hello world"示例代码来启动.

PdfDocument document = new PdfDocument();
        document.Info.Title = "Created with PDFsharp";
        PdfPage page = document.AddPage(); 
        XGraphics gfx = XGraphics.FromPdfPage(page);
        XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);
        gfx.DrawString("My Graph", font, XBrushes.Black,
            new XRect(0, 0, page.Width, page.Height),
            XStringFormats.TopCenter);
        const string filename = "MyGraph.pdf";
        document.Save(graphLayout+filename);
        Process.Start(filename);
Run Code Online (Sandbox Code Playgroud)

我得到一个pdf,但其中只有文字.有人可以告诉我,我如何将整个布局保存为PDF格式?谢谢

c# wpf graph pdfsharp quickgraph

3
推荐指数
1
解决办法
2万
查看次数