1

好的,所以我想截屏我正在处理的应用程序的布局我想将截屏设置为按钮或应用程序栏项目,截屏后直接进入电子邮件,并发送该截屏

我在这里看到:如何在 dotnet 上以编程方式截取屏幕截图并通过电子邮件发送

在这里:C# 在应用程序中截取 .net 控件的屏幕截图并附加到 Outlook 电子邮件

但我不确定它是否适用于 windows phone 8。我知道你可以通过主页按钮和电源按钮截取屏幕截图,但如果可能的话,我希望一举完成

我最初打算填写文本框,然后他们会生成一封电子邮件,看起来像这样

 private void email_Click(object sender, EventArgs e)
    {

        EmailComposeTask emailComposeTask = new EmailComposeTask();

        string first = infoBox1.Text;
        string second = infoBox2.Text;
        string third = infoBox3.Text;
        string fourth = infoBox4.Text;

        string one = amountBox1.Text;
        string two = amountBox2.Text;
        string three = amountBox3.Text;
        string four = amountBox4.Text;

        emailComposeTask.To = "";


        emailComposeTask.Body =    

            first + " " + " " + " " + " " + " " + " " + " " +  one + Environment.NewLine +
            second + " " + " " + " " + " " + " " + " " + " " + two + Environment.NewLine +
            third + " " + " " + " " + " " + " " + " " + " " +  three + Environment.NewLine +
            fourth + " " + " " + " " + " " + " " + " " + " " + four + Environment.NewLine;

但我不喜欢它的输出,没有正确对齐等......提前致谢!

4

2 回答 2

1

只需单击按钮即可使用此代码..

private void ApplicationBarIconButton_Click(object sender, EventArgs e)
    {
        var fileName = String.Format("WmDev_{0:}.jpg", DateTime.Now.Ticks);
        WriteableBitmap bmpCurrentScreenImage = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
        bmpCurrentScreenImage.Render(LayoutRoot, new MatrixTransform());
        bmpCurrentScreenImage.Invalidate();
        SaveToMediaLibrary(bmpCurrentScreenImage, fileName, 100);
        MessageBox.Show("Captured image " + fileName + " Saved Sucessfully", "WmDev Capture Screen", MessageBoxButton.OK);

        string currentFileName = fileName;
    }

然后在使用此代码将图像保存在相机胶卷上之后..

public void SaveToMediaLibrary(WriteableBitmap bitmap, string name, int quality)
    {
        using (var stream = new MemoryStream())
        {
            // Save the picture to the Windows Phone media library.
            bitmap.SaveJpeg(stream, bitmap.PixelWidth, bitmap.PixelHeight, 0, quality);
            stream.Seek(0, SeekOrigin.Begin);
            new MediaLibrary().SavePicture(name, stream);
        }
    }

现在您可以检查您的相机胶卷,捕获的屏幕将被保存。
确保检查您的 WMAppManifest.xml 并在功能中检查所有功能然后运行您的代码我相信它会工作

于 2013-05-02T04:08:19.993 回答
0

要拍摄屏幕截图,您可以点击此链接..

http://www.developer.nokia.com/Community/Wiki/index.php?title=How_to_take_screenshot_on_Windows_Phone&diff=176659&oldid=175825

并且在 Windows phone 8 SDK 中仍然无法通过 EmailTask​​ 发送带有附件的电子邮件。

于 2013-04-30T15:09:26.293 回答