|
after some seach i came to this solucion but quality image saved is very low please advise.
Metafile emf = null;
if (OpenClipboard(IntPtr.Zero))
{
if (IsClipboardFormatAvailable(CF_ENHMETAFILE))
{
var ptr = GetClipboardData(CF_ENHMETAFILE);
if (!ptr.Equals(IntPtr.Zero))
emf = new Metafile(ptr, true);
emf.Save(@"c:\image1.png");
}
CloseClipboard();
}
|
|
|
|
|
|
I'm having trouble using TLS1.2 with smtp.gmail.com and authenticating; gmail keeps saying that I'm not authenticating correctly.
Not sure if I'm using the ServicePointManager correctly at this point.
So I'm using smtp.gmail.com on port 587 with ssl enabled.
This is what I have. The SmtpClient runs first and picks up the credentials, the the SendEmailAsync runs and sends. The Catch catched the exception saying that I wasn't authenticated.
Scratching my head on this.
public static SmtpClient create_SMTPClient(smtp_credentials smtpC)
{
var smtpClient = new SmtpClient();
var smtpSection = (SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp");
if (smtpSection == null)
{
smtpClient.UseDefaultCredentials = false;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
<pre>
var smtpCredentials = new System.Net.NetworkCredential() {
UserName = smtpC.smtp_AccountName,
Password = smtpC.smtp_Password
};
smtpClient.Credentials = smtpCredentials;
smtpClient.Host = smtpC.smtp_ServerUrl;
smtpClient.Port = smtpC.smtp_PortNumber;
smtpClient.EnableSsl = smtpC.smtp_PortNumber == 587 ? true : false;
smtpClient.Timeout = 250000;
}
if (smtpClient.Port == 587)
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
if (smtpClient.Port == 443)
ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidation_Callback;
return smtpClient;
}
public static async Task<SendEmailCompletedEventArgs> sendEmailAsync(SmtpClient smtpClient, MailMessage message, int retryCount)
{
int currentTry = 0;
while ((currentTry < retryCount))
{
try
{
await smtpClient.SendMailAsync(message);
return new SendEmailCompletedEventArgs(null, false, null, currentTry);
}
catch (Exception ex)
{
currentTry++;
if ((currentTry >= retryCount))
{
return new SendEmailCompletedEventArgs(ex, true, null, currentTry);
}
}
}
return new SendEmailCompletedEventArgs(null, true, null, currentTry);
}</pre>
If it ain't broke don't fix it
|
|
|
|
|
I think my issue here is I need to connect as TLS1.2 but it's connecting as TLS1.1, in which Gmail considers to be less secure.
So the Service point stepped down a notch and my code failed.
So I wonder if it's a cipher in my registry on SChannel or my protocols that I selected.
If it ain't broke don't fix it
|
|
|
|
|
Which OS? TLS1.2 was disabled by default prior to 8.1 / 2012 R2, and not available on Vista / 2008 or earlier.
You should be able to check whether it's enabled from the IE options dialog, on the "Advanced" page:
Support for SSL/TLS protocols on Windows – Unleashed[^]
AFAIK, those settings also affect .NET code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Developing on Win10 with VS2017.
I program the ServicePointManager, and in the SmtpClient it says the address threw an exception before I even call SendMailAsync
The after the SendMailAsync runs, the caught Exception says must StartTLS first.
My endpoint is smtp.gmail.com on 587 with ssl on and using .Net 4.6.1
Strange, but after calling SendEmailAsync, it reads the SmtpCreddentials again and call Send a 2nd time.
I think it works in my VB version using .Net 4.6.1
If it ain't broke don't fix it
|
|
|
|
|
I changed my Gmail account type to less secure and it works fine with the same settings.
I wonder what the difference is between secure and less secure, I mean the whole difference is.
I hear .Net 4.6.2 is suppose to fix this for secure app.
If it ain't broke don't fix it
|
|
|
|
|
how to make calculation based on the quantity that user key in with the data(column) in the excel file that we link in c# ?
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
ok. sorry 4 that. i just think maybe some of u have example that can be shared
|
|
|
|
|
It's possible we do - but if we have no idea what you are talking about (because you gave us no information) then it's unlikely that we can tell you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
I'm trying to learn Rx. I have seen a lot of Google results and other resources pointing to this site.
Thing is, I'm just not getting it. What I'd really like to see is a simple, real world example. The code snippets in that site are VERY brief, not too deeply explained, and don't really show real work usage.
Does anyone know of any tutorials or real world usage examples of Rx?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Hi,
I can't help you, but maybe this can.
|
|
|
|
|
Already did that
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I would recommend starting off here before delving into the Rx book.
"As beings of finite lifespan, our contributions to the sum of human knowledge is one of the greatest endeavors we can undertake and one of the defining characteristics of humanity itself"
|
|
|
|
|
|
Kevin Marois wrote: What I'd really like to see is a simple, real world example
My guess is that is an oxymoron.
If it is simple and you are using reactive extensions then someone is experimenting and not writing good code. It should rather be the case that there is a complex problem that needs a solution and reactive extensions are thus needed (in very limited cases.)
|
|
|
|
|
Hi. I want to know is it possible to play audio though online storage.
I have my website and I see am able to play music from my website form of my server storage what I transfer with filezilla.
I want to know can I do this using winforms
If so is there a source or a link
Thanks
|
|
|
|
|
AnthonyRaven wrote: is it possible to play audio though online storage. That does not really make sense. You play audio through a music application on your PC, reading the audio stream from disk or other connected device. Also what is the connection in your question between your website and a Windows Forms application?
|
|
|
|
|
i have a demo program of Rfid Reader ,from which i saw the commands to be sent to rfid reader in order to initialize rfid reader.and that program is sending 2 commands to Rfid Reader continously ..and the rfid reader is sending response command continously ... i achieve this part ,and i am receiving response command in command prompt . ,. now when i placed a tag in front of rfid reader ,rfid reader detected the tag and send this 33 bytes to command prompt .. how i get the number from 00 00 to 67 (middle portion) , as this is the Epc (Electronic Product code) .i want to get this number and Epcs of other tags also . how can i achieve this ?I have to send these EPCs on Firebase Database .I am stuck here .what i should do now ?
33 bytes
A0-13-01-89-0C-34-00-00-00-00-00-00-00-00-00-00-00-36-67-4B-9B-A0-01-89-00-00-11-00-00-00-01-BA
|
|
|
|
|
|
Hi, Good Evening everyone
I have created two classes namely Shape, Rectangle with Draw() method in both the classes, Rectangle class is a deried class from Shape. I have declared a public variable in Rectangle called num and initialised a value to it.
In the main class I have created an object of type class in following manner.
Shape s = new Rectangle();
Now when I am trying to access num variable of rectangle class it gives error saying “ /Users/apple/Projects/Practice/Practice/Program.cs(33,33): Error CS1061: 'Shape' does not contain a definition for 'num' and no extension method 'num' accepting a first argument of type 'Shape' could be found (are you missing a using directive or an assembly reference?) (CS1061) (Practice)”
My Understanding : The statement new Rectangle(); creates an object of type Rectangle in the memory and its reference is stored in object s of type Shape. So the object s should have access to variable num defined in rectangle class. Please make me understand this concept why we can’t access num variable from Object of type Shape.
Pls find the attached screenshot.
modified 8-Jul-17 13:10pm.
|
|
|
|
|
Because it doesn't exist in Shape.
If I have a toy, my son can play with it. But I can't play with my son's toy.
modified 8-Jul-17 13:24pm.
|
|
|
|
|
Member 13299953 wrote: My Understanding : The statement new Rectangle(); creates an object of type Rectangle in the memory and its reference is stored in object s of type Shape. So the object s should have access to variable num defined in rectangle class. Please make me understand this concept why we can’t access num variable from Object of type Shape.
Wrong. Shape only know what's defined in the Shape class. It knows absolutely nothing about any class that inherits from it.
The reverse is also true. Rectangle knows ONLY what Shape exposes to it since it's inheriting from Shape and what's defined in the Rectangle class. Private members defined in Shape are not visible to Rectangle at all.
Inheritance only goes one way. A base class can NOT and should not know anything at all about the classes that inherit from it.
|
|
|
|