|
Hi everyone,
I want to make a simple media player in C# and I used QuartzTypeLib library to read the video and this perfect. But, in the next step I want my player to support ability to add subtitle to the movie.
I googled it but i didn't find any thing that simple and useful for me.
Can any one help, please.
Thanks in advance.
|
|
|
|
|
Does answer # 9 in this[^] thread help?
/ravi
|
|
|
|
|
I think yes.
the second solution(I know it before) is better but i can't know how to use in C#. If you give me a link for that, please.
The first solution I don't understand completely but I prefer to use the first solution.
Thanks in advance.
|
|
|
|
|
Hi,
Here is my question...
I need to design two windows forms applications in such a way that the Form 1 will run for some time and then starts Form 2 in a new thread. Once the Form2 is started I need to update the labels on both the forms simultaneously.
Form1
public Form1()
{
Initialize();
DoSomeOperations();
}
public void DoSomeOperations()
{
updateLabel("Form 1");
Thread.Sleep(10000)
var task1= new Thread (() =>Form2()) {"GUIThread"};
task1.Start();
}
public void Form2()
{
Form2 f2= new Form2();
Application.Run(f2);
}
void updateLabel(string message)
{
label1.text = message; //label in Form1
label1.Refresh();
}
After Form2 is started, I wanted to update the label in Form 1 and Form2 at the same time. That is what ever message I get in Form 1, I need to display it both on Form 1 and Form2. I tried toraise an event in Updatelabel method and assigned the event to a method in the constructor of Form2 but it didnt work. Can somebody please help me with this?
Thanks in advance
|
|
|
|
|
|
You do not start a new form in a new thread. All GUI components get created and are manipulated by the startup thread.
Your work goes on background threads and if they have to manipulate controls, they Invoke calls to method to do the manipulations on the GUI thread.
|
|
|
|
|
Thank you guys...
I followed both your suggestion. Firstly I am not starting
the other form in a new thread. Instead I used the property Show().
Form2 f2= new Form2()
f2.Show() //Instead of Application.Run(f2)
and then made the label which I want to update on Form2 as internal. So I had direct access to it from Form1.
|
|
|
|
|
Hi,
create a global delegate so that the delegate can be access from both Form1 and Form2.
public delegate void LabelUpdateDel();
create an instance of the delegate in Form1.
public LabelUpdateDel lblUpdateDel;
I believe you are showing the Form2 from Form1.
so attach a Form1 method with the delegate before showing Form2.
Form2.lblUpdateDel=MethodUpdateLabel; // MethodUpdateLabel is in Form1.
Form2.Show();
private void MethodUpdateLabel ()
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(MethodUpdateLabel ));
}
else
{
lblForm1.Text = "your text";
}
}
Now the method DoSomeOperations() is look like
public void DoSomeOperations()
{
..
lblForm2.Text="Your text";
if(lblUpdateDel!=null)
{
lblUpdateDel();
}
}
thats all.
|
|
|
|
|
For a C# 2010 application, I would like to be able to check for the value
returned by the linq to sql query listed below as being null.
Is there any way to check for
strOrgName == null?
var strOrgName = (from o in rData.Orgs
join pl in rData.Custs on o.OrgID equals pl.OrgID
where pl.orgnum == strContract
select o.OrgName).FirstOrDefault();
The code I have written so far only allows if I check for
strOrgName != null.
I am using the code above to use as an example of how I would like to be able
check for the value returned being a null.
Thus can you tell me how to solve my isuse?
modified 29-Sep-12 17:16pm.
|
|
|
|
|
dcof wrote: The code I have written so far only allows if I check for strOrgName != null.
If you can check for != then you can check for == ; how are you doing the test?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi.
I need to do a project for school in which I want to have an option to encrypt and decrypt a text file (possibly large one). I want to do it without using the cryptography classes of C#. my question is what's the best way of doing it? I read here that the RSA method is only suitable for small data, so what do I use for large data, and can I combine it with the RSA? How dO I start this kind of project?
thank you.
|
|
|
|
|
May be you should give AES (Rijndael) a try :
You can use this classes for testing
Here[^]
BTW:
RSA is one of C# classes
|
|
|
|
|
|
e are creating a class library project. The project will be using TDD approach so we will be using DI. but other than that what can be the ways [designs] to make it maintainable and scalable as this will be a big library.
|
|
|
|
|
If this will be big. Don't make it. Instead split it to handful of libraries, services, logic, data access, contracts, extensions, user controls etc.
No more Mister Nice Guy... >: |
|
|
|
|
|
On occasion,when I am programing in VS 10, I will have an issue with a control, usually a button. Apparently I do something (I do not know what) and the application "loses" the original code behind a control and renames a new identical control with the name 1 after it.
Case in point:
private void buttonUsers_Click_1(object sender, EventArgs e)
{
}
The original control is still there someplace and the code is intact, but the control no longer points to it. It points to the new blank definition instead. In the past, if it was a single issue (1 control) deal, I simply recoded the new button with the code from the old one and moved on, but this time, all the buttons on the page are gone. In fact, all the buttons in the application seem to be the same way. I think it is time to find out why. I hope that someone can tell me what I am inadvertently doing to cause this and how I can recover the application to where it was. I am at a loss...I appreciate your help...Thank You ... P
|
|
|
|
|
I haven't experienced that kind of thing, and since you don't know how to reproduce this, I cannot help you on that front right now. Could you provide your solution files to see if we can reproduce your situation? also, try and do whatever you are doing regularly when this happens and take notice of all of it, try and give us the steps to reproduce your problem so we can help you figure out what is happening
Now, regarding this:
PDTUM wrote: how I can recover the application to where it was
I can't think of anything to help you recover it to where it was, but you should always have some form of backup of your code.
For future ocassions I would recommend using Source Code Control, even when working alone on a project, since you will have backups (preferably set the server on another machine) and you will be able to revert back to older versions of the code.
If you have access to TFS (Team Foundation Server) that would be great since Team Explorer integrates pretty well with VS, if you don't try Subversion or TortoiseSVN, failing all that, zip up your code and put your zips (or RARs or whichever compressed format you prefer) in a safe place (i.e. cloud storage - SkyDrive, Google Drive, DropBox), my point here is, no matter how rudimentary (or sophisticated) but always have a backup of your work.
|
|
|
|
|
Emmanuel,
Thank you for your input. This happens semi often, but it never affected more than one control before. I wish I could reproduce it, but I cannot. I was hoping that you might have seen this and just knew what the heck it was that I did, not just for this time but for the next time. Anyway...I do have a backup of the app, but it will take me the better part of a day to get back to where I was...it happens that way sometimes. I appreciate the time and effort for your detailed response (and advice). Best Regards, Pat
|
|
|
|
|
Check The Designer Class of your form and delete "buttonUsers", manually.
|
|
|
|
|
Hello Smart...Thank you for your reply. I did not understand this, but I tried it anyway. It generated 11 errors and the application would no longer load generating the following response:
"The variable "buttonUsers" was either never declared or was never assigned."
I appreciate your effort. If you have another idea or if I did this wrong, please let me know. I suppose that I will have to go back and rebuild at least 12 hours of previous code to get back to where I was....Oh well.
Best regards, Pat
|
|
|
|
|
Hello, Hope this will help:
1-Find all "buttonUsers" in entire Solution.
2-Delete all of them.
The Declaration
The Delegate
The Events
3-Open The From Designer and from Properties window Search for ButtonUsers, ( Manually ) if you find it Change it's Name to Something like "ButtonUsersXXX"and repeat Step 1 and step 2.
4- Build your Solution if you got an Error ( I hope you don't) Double click it, and post the line of the code which produce it here .
Have a good day Sir.
|
|
|
|
|
In a C# 2010 application, I am using linq to sql to connnect to a sql server 2008 database. From the linq statement listed below,
I am trying to obtain the OrgName as a string value. However I keep getting errors trying to make this occur.
string strCustnUM = CUSTOMERNUMBER;
var varOrgName = (from o in rData.Orgs
join pl in rData.Custs on o.OrgID equals pl.OrgID
where pl.orgnum == strContract
select(o.OrgName).SingleOrDefault());
string strOrgName = Convert.ToString(varOrgName);
Thus can you tell me how to change the linq statement so that I obtain the OrgName as a string value that I can use in the C# application?
|
|
|
|
|
Hmm, the structure of the query looks interesting. Try this:
var varOrgName = (from o in rData.Orgs
join pl in rData.Custs on o.OrgID equals pl.OrgID
where pl.orgnum == strContract
select o.OrgName)
.SingleOrDefault();
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Matt (above) is right, if that doesn't solve your problem, could you copy-paste the error you get, and tell us the data type of o.OrgName?
|
|
|
|
|
Can anyone explain me, What is EncoderValue.CompressionLZW in C#
|
|
|
|