bitmap image saving as blank image - c#

I need to capture client screen so i reffered http://www.csharphelp.com/2006/11/capturing-the-screen-image-using-c/
its working fine on local but on server my image is saving as blank image
System.Drawing.Bitmap outputImage = CaptureScreen.CaptureScreen.GetDesktopImage();
string path = HttpContext.Current.Server.MapPath("~/" + "Corporate/testimages/ab1.png");
outputImage.Save(path);
help me out thanks in advance...

I think the problem is, that your application is running by an user without a desktop environment.
There are detected Windows Users for something like Web Applications and this user doesn't have an screen.
You should think about extracting the Screening process in a separate program.
EDIT:
Kratika doesn't want to screen the clients screen, (s)he wants to screen an other website and provide the download link.

Related

Notification Icon in .NET MAUI Android

I'm facing an issue with push notifications in .NET MAUI. I'm using Firebase Cloud Messaging and I have successfully integrated it into my app. The problem is with the notification icon; when I receive a notification while using the app, the icon is displayed correctly, but if I receive the notification when the app is closed, the icon appears small and inside a larger circle (which doesn't look good). I've tried using both SVG and PNG files with colored or white and transparent backgrounds, but nothing seems to work. That's the image I have used.
Here are the screenshots of the problem:
Inside the app:
And if I scroll down while in the app:
Outside the app (when closed):
And again, if I scroll down while the app is closed:
These examples were made using a PNG file named small_notification_icon.png and saved in the Resources/Images folder, which only uses white color with a transparent background. This is the code I used:
var notificationBuilder = new NotificationCompat.Builder(this, MainActivity.ChannelID)
.SetSmallIcon(Resource.Drawable.small_notification_icon)
.SetContentTitle(title)
.SetContentText(messageBody)
.SetChannelId(MainActivity.ChannelID)
.SetPriority((int)NotificationPriority.High);
var notificationManager = NotificationManagerCompat.From(this);
notificationManager.Notify(MainActivity.NotificationID, notificationBuilder.Build());
I would appreciate any help or suggestions on how to resolve this issue.
I've identified the issue. When the app runs in the background, notifications sent from the console use the launcher icon designated in the manifest file.
To address the problem, you can simply replace the default image specified in the AndroidManifest by inserting the following code within the Application tag. All you need to do is substitute your_favourite_image with the image you prefer for the notification icon.
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#drawable/your_favourite_image" />
This should resolve the issue and allow you to use your preferred image for notifications.

Adaptive Card is not showing the image in web application

I am using the dotNet sdk. All the images are stored in the wwwroot/Image folder i.e. Static folder.
When i am running the bot through emulator i.e. Locally it is showing the image.
But after publishing the application the image is not showing up.
when i debug program remotly then i am getting the proper image path: D:\home\site\wwwroot\wwwroot\Image\pdf.jpg
, which is currect url but sill image is not showing up.
new AdaptiveColumn() {
Width=AdaptiveColumnWidth.Auto,
Items = new List<AdaptiveElement>()
{
new AdaptiveImage()
{
//Url = new Uri(iconUrl),
Size = AdaptiveImageSize.Small,
Style = AdaptiveImageStyle.Default,
UrlString=iconUrl
}
}
},
Any location starting with a drive letter like D is a local path and not a remote URL. You should never use a local path when trying to identify resources on a server, since your bot is communicating with a client on a totally different machine.
Please familiarize yourself with this document to understand how static files work in .NET Core: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files
Once your web app is running on a server, you will be able to access the image using HTTP/S. If you're running the bot locally then the URL should look something like http://localhost:3978/Image/pdf.jpg and if the bot is deployed then it should look something like https://rajatbot.azurewebsites.com/Image/pdf.jpg. Test the URL by pasting it into a browser to make sure it works, then put the URL in your card.

How can I load image into picture box from another computer?

I need my picture box to load image from another computer. It means a different IP address. I have tried loading image from same computer and it works. But I need to load image from a separate server PC. The code below does not work.
pbFeature.Image = Image.FromFile(#"\192.168.232.100\C:\pic\a.png");
Network paths start with \\ not \. Assuming the file is shared correctly you just need pbFeature.Image = Image.FromFile(#"\\192.168.232.100\C:\pic\a.png");
Paste that same path into windows explorer and it should open the image if it is shared correctly.
share the file/folder to access by another computer. then you access file like below
var file= File.ReadAllText(#"\\server\path\filename.png");
then use the file where ever you want

How can I open an image in the default photos app?

I have an app that captures images from the device's camera and saves them as StorageFiles to a folder in my app's roaming data. I've been trying to make a page that will open the image and show a preview, but I've been having many problems doing that, so I want to just open the image in the default photos app. However, I can't find any way to do that. Using await Launcher.LaunchUriAsync(new Uri(#"ms-appdata:///roaming/folder/img.jpg")); asks if I want to search for an app in the Store (searches for "ms-appdata"). Does the native Photos app for Windows (Phone) have a dedicated URI scheme? Also, I am targeting Windows 10 with this app, so the URI schemes (if any) may have changed.
Launcher.LaunchUriAsync is for launching an application using the URI scheme, this is not what you want.
Instead you'll want to launch an app based on a file:
Get the image as a StorageFile
var imageFile = await StorageFile.GetFileFromPathAsync(#"ms-appdata:///roaming/folder/img.jpg");
Then you tell the OS to launch an app to handle that file. It's then up to the user to choose which app to handle the image file:
var success = await Windows.System.Launcher.LaunchFileAsync(imageFile);
You can read more about "launching" files here.

windows phone 7 Download files and save it in phone storage

am developing an application which can fetch files from internet.. how do i download and save a "docx" or "wav" file from internet within the application and use it later with other application likes office or windows media player.
You can download files in the background (ie. they will continue even when your application is not running).
Having said that, you should research the types of files you need to support. For example, you can play an audio file (if the format is supported) or add it to Music hub but you cannot open a file in Office. Very few filetypes can be integrated with, so do some research before you start writing your app otherwise you might be disappointed.
place an image control in your page. here im1 is controls name.
it is working for me
string imgurl="http://.........";(path)
Uri addrs=new Uri(imgurl,UriKind.Absolute);
BitmapImage bitmap = new BitmapImage(addrs);
im1.Source = bitmap;

Categories

Resources