|
Gentleman:
I would like to raise a browser window as a way to view a PDF. Right now, the application raises the window and propogates an internet address perfectly, however it does not launch a default PDF application as a way to view a file, and if I force it manually (which would defeat the purpose of the application) it will appear in an external window. The window must be internal to the application. I have made it work with some aftermarket solutions such as Apitron but their solutions are rather pricy, so I thought the best way to handle it would be to use a browser in an application window that could be stacked on other windows. If I could use a plug in to run a PDF viewer of any kind inside that window, it would serve as an acceptable solution. SO ... how do I add a plugin to Gecko so that it will run a PDF file when the page is loaded? Thank you in advance...Pat
|
|
|
|
|
I'd like to apply voice recording function to specific application which uses threads. There are START and STOP buttons on application besides other forms.
I can start the recording method but the main application is not responding and I cannot stop the recording process.
I would appreciate any solution to resolve this issue.
private void barButtonItemStartRec_ItemClick(object sender, ItemClickEventArgs e)
{
barButtonItemStartRec.Enabled = !(barButtonItemStopRec.Enabled = true);
var dlg = new MainForm();
BackgroundWorker recWorker = new BackgroundWorker();
recWorker.DoWork += dlg.StartRec;
recWorker.RunWorkerAsync();
}
private void barButtonItemStopRec_ItemClick(object sender, ItemClickEventArgs e)
{
barButtonItemStartRec.Enabled = !(barButtonItemStopRec.Enabled = false);
var dlg = new MainForm();
dlg.StopRec();
}
|
|
|
|
|
You are creating a new mainform, and stopping recording there - you are not stopping the recording in the "mainform" that you created in the StartRec-method. Change the local variable to a member-field and only create the mainform once.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
fyi: due to delay of CP site here I did not see your post before I started mine.
«At the still point of the turning world. Neither flesh nor fleshless;
Neither from nor towards; at the still point, there the dance is
...
Neither ascent nor decline. Except for the point, the still point,
There would be no dance, and there is only the dance»
T.S. Elliot, The Four Quartets: "Burnt Norton"/xml>
|
|
|
|
|
A good thing, as your explanation is more elaborate.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
There are several "red flags" in my head looking at your code:
1. you create instances of 'MainForm in both the EventHandlers, and those are assigned to local variables ('dlg): that means the references to those instances are effectively discarded the moment the EventHandler code is finished executing.
So, the instance of 'MainForm created in the first EventHandler has no relationship to the instance of MainForm created in the second EventHandler.
2. similarly 'recWorker is created, and the reference to it will be discarded.
3. there's so much one can't know looking at this code:
a. what code is in the 'StartRec and 'StopRec methods in 'MainForm.
b. we don't know in what context (Form, Class) these two EventHandlers are defined.
An obvious change to try is:
1. create one instance of MainForm and keep a reference to it.
2. create one instance of 'recWorker and keep a reference to it.
Suggestions:
1. might as well set the Enabled property of the recording Button to 'false when it gets a click: if it's not enabled it will never get a click.
2. set the Enabled property of the recording Button to 'true when you recording terminates
3. what about disabling the stop Button initially, and when recording is terminated.
«At the still point of the turning world. Neither flesh nor fleshless;
Neither from nor towards; at the still point, there the dance is
...
Neither ascent nor decline. Except for the point, the still point,
There would be no dance, and there is only the dance»
T.S. Elliot, The Four Quartets: "Burnt Norton"/xml>
|
|
|
|
|
Mainform methods:
public void StartRec()
{
try
{
string destfile = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.MyMusic), "Recorded_Voice" + DateTime.Now.ToString("_yyyy_MM_dd_HH_mm_ss_fff") + ".mp3");
mp3SoundCapture.CaptureDevice = SoundCaptureDevice.AllAvailable.First();
mp3SoundCapture.NormalizeVolume = true;
mp3SoundCapture.UseSynchronizationContext = true;
mp3SoundCapture.WaitOnStop = true;
mp3SoundCapture.OutputType = Mp3SoundCapture.Outputs.Mp3;
mp3SoundCapture.WaveFormat = PcmSoundFormat.Pcm48kHz16bitMono;
mp3SoundCapture.Mp3BitRate = Mp3BitRate.BitRate64;
mp3SoundCapture.Start(destfile);
}
catch (Exception ex)
{
FormHelper.MessageBoxForm("Record Error: " + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
public void StopRec()
{
mp3SoundCapture.Stop();
}
internal void StartRec(object sender, DoWorkEventArgs e)
{
StartRec();
}
public void StopRec(object sender, DoWorkEventArgs e)
{
StopRec();
}
|
|
|
|
|
Another point to think about is the recording process proper. Do you use callback methods or do you collect Windows messages in an overridden WndProc function?
|
|
|
|
|
could Someone help me, I tried to write a program to send an email, but it always fails!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
namespace emailC
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
try
{
using (MailMessage mail = new MailMessage())
{
using (SmtpClient smtp = new SmtpClient("smtp.mail.yahoo.com", 587))
{
mail.From = new MailAddress("fgelana@yahoo.com");
mail.To.Add("fraolgela@gmail.com");
mail.Subject = "C# Email";
mail.Body = "This is for testing SMTP mail for yahoo using C#";
smtp.Credentials = new System.Net.NetworkCredential("name@yahoo.com", "password");
smtp.EnableSsl = false;
smtp.Send(mail);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
It returns the following exception!
System.Net.Mail.SmtpException:Failure sending mail. --->
System.Net.WebException: The remote name could not be resolved
Thank You!
|
|
|
|
|
I see you've edited your message to remove your live Yahoo credentials. However, they were briefly visible on a public forum.
You should change your password immediately.
I'd also suggesting choosing a stronger password than the one you posted - use a mix of upper-case, lower-case, numbers and symbols, and avoid common words or brand names.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Oh Man Thanks!
I tried
nslookup smtp.mail.yahoo.com but it replied can't find smtp.mail.yahoo.com Query refused!
My Internet is working correctly but i don't know how to fix a problem with my DNS provider!
Thank you!
|
|
|
|
|
That's definitely a problem with your DNS servers. You'll need to talk to whoever's in charge of your infrastructure to resolve the problem.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Fraol Gelana wrote: System.Net.WebException: The remote name could not be resolved
Check your DNS settings, and make sure you can resolve "smtp.mail.yahoo.com".
Open a command-prompt, type nslookup smtp.mail.yahoo.com, and then press Return. The response should look something like:
Non-authoritative answer:
Name: smtp.mail.eu.am0.yahoodns.net
Address: 188.125.69.59
Aliases: smtp.mail.yahoo.com
smtp.mail.global.gm0.yahoodns.net
fo-smtp.mail.eu.am0.yahoodns.net
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
First step is to put a break-point on:
using (MailMessage mail = new MailMessage())
and single-step (F11) through the code, examining the state/value of all variables as each line is executed. This may help you identify exactly what's failing.
May I suggest you take out your "real" e-mail address from your post: posting real e-mail addresses here is likely to get you spammed because of various evil things running about the net.
«At the still point of the turning world. Neither flesh nor fleshless;
Neither from nor towards; at the still point, there the dance is
...
Neither ascent nor decline. Except for the point, the still point,
There would be no dance, and there is only the dance»
T.S. Elliot, The Four Quartets: "Burnt Norton"/xml>
|
|
|
|
|
BillWoodruff wrote: First step is to put a break-point on:
I would suspect strongly that the exception that says "The remote name could not be resolved" pretty much resolves the problem. And debugging it isn't going to change that.
Could it mean something else?
|
|
|
|
|
The code looks good, and should work. The message
Fraol Gelana wrote: System.Net.Mail.SmtpException:Failure sending mail. --->
System.Net.WebException: The remote name could not be resolved does point toward a problem with your network configuration. If you're at work you should try to contact your IT departement to resolve the issue, if you have a "home-environment" I recommend you to check your router's settings - Some have an internal firewall or blacklist.
Another approach would be to install Thunderbird[^] - Configure the email account, and if Thunderbird can't connect to Yahoo either there clearly must be an error with the network.
The console is a black place
|
|
|
|
|
How To Create Data Recovery in C#.net windows application that will recovery all the data from hard disk or removable drive which consists of Images,media files and other files.
|
|
|
|
|
That depends entirely on what your definition of "Data Recovery" is. That's a broad term and you haven't defined the condition under which data is lost and can be recovered.
Without that, you have no hope of completing the project.
You already posted this question in QA. Pick ONE forum and post the question ONCE.
|
|
|
|
|
Hi to everyone.
I know that there are a lot of articles in the internet about this problem. I know that there is KeepWith property and i read here http://forum.pdfsharp.net/viewtopic.php?f=2&t=679[^]
http://forum.pdfsharp.net/viewtopic.php?p=6852#p7408[^]
that it should work if i install assemblies http://www.pakeha_by.my-webs.org/MigraDocFastTableRender.html[^]
I installed and there is no effect, anyway i try to use it - my table is cut on one page((( and other rows do not go to the next page....
My way coding tables
PdfDocument outputDocument = new PdfDocument();
PdfPage editablePage = outputDocument.AddPage();
editablePage.Size = PageSize.A4;
XGraphics gfx = XGraphics.FromPdfPage(editablePage);
MigraDoc.DocumentObjectModel.Document doc3 = new MigraDoc.DocumentObjectModel.Document();
MigraDoc.DocumentObjectModel.Tables.Table table3 = new MigraDoc.DocumentObjectModel.Tables.Table();
Column column3 = table3.AddColumn(70);
column3.Format.Alignment = ParagraphAlignment.Left;
column3.Format.Font.Bold = false;
column3 = table3.AddColumn(50);
column3.Format.Alignment = ParagraphAlignment.Center;
column3.Format.Font.Bold = false;
Row row3 = table3.AddRow();
row3.Format.Alignment = ParagraphAlignment.Center;
row3.Format.Font.Bold = true;
row3.Format.Font.Size = 9;
row3[0].AddParagraph("Serial");
row3[1].AddParagraph("Time");
...............................................................
...............................................................
while (reader1.Read())
{
row3 = table3.AddRow();
row3[0].AddParagraph(Convert.ToString(reader1.GetValue(0)));
row3[1].AddParagraph(Convert.ToString(reader1.GetValue(1)));
}
...............................................................
...............................................................
table3.Rows[0].KeepWith = table3.Rows.Count-1;
doc3.AddSection().Add(table3);
DocumentRenderer docRenderer3 = new DocumentRenderer(doc3);
docRenderer3.PrepareDocument();
docRenderer3.RenderObject(gfx, 50, 0, 0, table3);
May be this way of constructing tables does not provide my requirements?
I will appreciate any help, thank you.
modified 13-Nov-14 12:30pm.
|
|
|
|
|
It seems i am alone here
Hey...Where are you cyberpeople?
|
|
|
|
|
PDFSharp is not a universally used tool, you might be better served but getting in their forum.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hi,
I am trying to send email message in C# using this MSDN article:
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient(v=vs.110).aspx
but I am getting this error:
Cannot access a disposed object. Object name : System.Net.Mail.MailMessage
can anyone help please...
private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
{
String token = (string)e.UserState;
if (e.Cancelled)
{
Console.WriteLine("[{0}] Send canceled.", token);
}
if (e.Error != null)
{
MessageBox.Show(String.Format("[{0}] {1}", token, e.Error.ToString()));
}
else
{
Console.WriteLine("Message sent.");
}
mailSent = true;
}
private static void send_message()
{
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 587;
client.Credentials = new System.Net.NetworkCredential("it@mydomain.com", "my_password");
client.EnableSsl = true;
MailAddress from = new MailAddress("it@mydomain.com", "My" + (char)0xD8 + " Company", System.Text.Encoding.UTF8);
MailAddress to = new MailAddress("jassim@mydomain.com");
MailMessage message = new MailMessage(from, to);
message.Body = "This is a test e-mail message sent by an application. ";
string someArrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });
message.Body += Environment.NewLine + someArrows;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.Subject = "test message 1" + someArrows;
message.SubjectEncoding = System.Text.Encoding.UTF8;
client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
string userState = "test message1";
client.SendAsync(message, userState);
Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
string answer = Console.ReadLine();
message.Dispose();
Console.WriteLine("Goodbye.");
}
private void btnSend_Click(object sender, EventArgs e)
{
if (XtraMessageBox.Show("Are you sure you want to send this message to all contacts now?", "Send", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
send_message();
}
}
Technology News @ www.JassimRahma.com
|
|
|
|
|
And, why haven't you inserted a break-point, and used F11 to single-step through the code and locate the error ?
«At the still point of the turning world. Neither flesh nor fleshless;
Neither from nor towards; at the still point, there the dance is
...
Neither ascent nor decline. Except for the point, the still point,
There would be no dance, and there is only the dance»
T.S. Elliot, The Four Quartets: "Burnt Norton"/xml>
|
|
|
|
|
I guess it is caused by the combination of
client.SendAsync(message, userState);
message.Dispose();
Because of the async part, that function returns immediately, though the process of sending may not even have started. But now you call Dispose on the message object which is still to be sent / being sent.
I suggest to remove the message.Dispose line.
|
|
|
|