|
You need to implement IEditableObjectinterface.
And write code to BeginEdit, EndEdit and CancelEdit
You can check CSLA Framework on Internet to check how implement IEditableObject interface
Regards
|
|
|
|
|
Thanks bismark, that of course worked.
After seeing all the improvements to data binding during design time, I had hoped the powers that be had built a better mousetrap for object binding in V2.0, but not so hey.
|
|
|
|
|
Is there a way to zoom an image quickly that doesn't make it all fuzzy like using drawImage does. (I'm making a paint like program and I would like the pixels to stay rectangular as you zoom in). thnx
|
|
|
|
|
use the directx libraries for that type of effeciency
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
bobisreallycool wrote: Is there a way to zoom an image quickly that doesn't make it all fuzzy like using drawImage does.
You can't zoom into an image without losing quality.
bobisreallycool wrote: (I'm making a paint like program and I would like the pixels to stay rectangular as you zoom in).
Pixels are not quite rectangular, but you can keep them correctly drawn by making sure you zoom to a correct aspect ratio.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I need an example in c# with a timer.
I never has program in this lenguage .
Soy estudiante de 4to año de Informatica
|
|
|
|
|
Rosayne wrote: need an example in c# with a timer.
Google 'C# timer'
Rosayne wrote: I never has program in this lenguage .
What languages have you programmed in ? If none, then you should not worry about timers just yet, IMO.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
is so easy.
please write me to my personal email, I can help you... inclusive in Spanish.
|
|
|
|
|
Hi friends,
the follow code will be run normally in WindowsApplication:
string userName = "a";
string userPass = "a";
string address = "192.168.18.145";
int port = 8080;
WebProxy myproxy = new WebProxy(address , port);
NetworkCredential credentials = new NetworkCredential(userName, userPass, null);
myproxy.Credentials = credentials;
WebRequest rqt = WebRequest.Create(this.textBox2.Text.Trim());
rqt.Proxy = myproxy;
rqt.PreAuthenticate = true;
WebResponse rsp = rqt.GetResponse();
System.IO.Stream stream = rsp.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(stream);
this.textBox1.Text = reader.ReadToEnd();
stream.Close();
reader.Close();
but in the SmartDeviceApplication,,it will cause the problem :
The response did not contain an end of entity mark.
Can you tell me why and how to solve the problem??
Thank you !!
22
|
|
|
|
|
|
WebResponse rsp = rqt.GetResponse();
this line.....
|
|
|
|
|
Judging by the rest of your code, the site you are accessing is something else you've written? If so it looks like that code is sending back an invalid web response.
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
I think all the thing I have written....
Can you write a example of proxy with credential in SmartDeviceApplication for me??
thank you !!
|
|
|
|
|
I haven't played with this before so I can't send you any good samples. AFAIK though your client code looks correct. I think that the server/website you are accessing is sending back an invalidly formated HTML page
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
|
I Have a class (not a usercontrol) in a seperate assembly that I need to implement licensing on.
I'd like it to do the following and i'm not sure if this is possible.
a) I'd like to not use LIC files, but instead use a RegistryLicenseProvider which gets a certain key/value from the registry and sees if this is valid. I already have this part in my 'GetLicense' function in my derived LicenseProvider.
b) Developer installs package which creates registry key for RegistryLicenseprovider
which denote that this is a valid 'developer' license. For testing purposes I simply created a registry key with the value 'test'.
now the issue comes in the next steps - it should work like this:
c) When compiling the main exe, the license info gets picked up and embedded as runtime license in the exe
d) Client runs fine without this registry key because if it can't find the registry key it finds it embedded in the exe.
This is how i understand the standard LicFileLicenseProvider to work. Is this correct?
Currently the program runs, but as soon as I delete the registry key the program stops working so obviously nothing is getting embedded. I Had to create my own license.licx file and added it to the project as embedded resource too.
So instead of design time I'd almost need compile time licensing.
What am I forgetting or is this just not possible and should I just forget about this?
Do i need to write my own code that somehow gets the embedded licenses from the calling application?
Thanks
|
|
|
|
|
Side Note: I built the registrylicenseprovider like the one mentioned here:
http://www.codeguru.com/Csharp/.NET/net_framework/licensing/article.php/c5469/
|
|
|
|
|
Hello,
how can i create an array of followig struct:
struct CCDtype
{
double breite;
double höhe;
string btext;
// Konstruktor der Struktur
public CCDtype(double para1, double para2, string para3 )
{ this.breite=para1;
this.höhe =para2;
this.btext =para3;
}
} ;
I want to initialize it via constructor something like this:
private CCDtype[1] = new CCDtype[] (5.0, 3.7, "1/3\" ( 5.0 x 3.7 mm)");
The Array should be a static member of the struct!
thanks a lot
Daniel
|
|
|
|
|
Try this:
private CCDtype[1] = new CCDtype[] ( new CCDType(5.0, 3.7, "1/3\" ( 5.0 x 3.7 mm)"));
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks Christian,
If I try this, SharpDevelop says "SyntaxError "]" expected. There is something wrong with the empty bracket?
Could you explain me the background of using 2x new pleace?
Daniel
|
|
|
|
|
To create an instance of a class, you need to do this:
MyClass c = new MyClass;
when you create an array, you're in essence creating a lot of class instances. Each one needs to have new called on it, just as it would if you created it on it's own.
I think it's actually
MyClass [] mcArray = { new MyClass(12, "x"), new MyClass(57, "y") }
So, you don't call new on the array, I made a mistake.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks a lot!
At the end a general question:
Is it a good style to deal with a lot of instances of strucs or classes?
For example I want to program a "Game of Live". There could be a class creature with property like amount of neighbours and methods like die or stay.
If i have a gamepad with just 10x10 fields, i have to deal with 100 objects?
Or schould I build a class gamepad?
Daniel
|
|
|
|
|
For me personally, if I have a lot of entities ( for example, cells on a grid ), it makes a LOT of sense to group all the properties of one cell into a struct and have an array of them. I don't see any really viable alternative to this, and it works well. You can iterate over the objects, however many there are, and write the code to deal with one object, once.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm trying to build a match generator for a scoring program for some friends of mine... part of the task is to randomly generate match pairing with a few rules... teams shouldn't play back to back rounds, if more then 1 field is running teams shouldn't be scheduled to play one both fields at the same time, etc.... I've worked this out for the most part, but I'm running into a few issues and I wanted to throw this out to see if there are other ways to do this... So here's a quick walk through of how my code works right now, and I'll try to comment things accordingly so things line up:
1. Get all the teams playing in the event
2. Load team id's into an array
3. Go through the team array and load every possible match into the raw matches array
4. Randomly draw a match from raw match array
5. Check both teams to see if they have played in the last 2 rounds
6. If not, write to database as next match
7. Repeat process to until raw matches are done.
8. If it's set that teams will play each other multiple times, repeat entire process.
Part of what I need to do is come up with a way to determine my recently played buffer... right now it's set to the last 2 rounds, so it holds 4 teams. If only 5 teams are in the event, it's pretty much useless, so I've had to add checking to limit how many times it tries to pull a match that isn't putting a team back to back...
Thanks for any input!
and here's my code....
public void buildRounds(int fields, int times, int eventId)
{
OleDbConnection oConn;
OleDbCommand oComm;
OleDbDataAdapter adapter;
DataSet data = new DataSet();
string sSql;
int totalTeams;
int foo;
int currentField = 1;
int currentRound = 1;
Random random = new Random();
oConn = new OleDbConnection(connectionString);
try
{
oConn.Open();
for(int rounds=1;rounds<=times;rounds++)
{
sSql = "SELECT count(*) from eventDtl where eventID = " + eventId;
oComm = new OleDbCommand(sSql, oConn);
totalTeams = Convert.ToInt32(oComm.ExecuteScalar());
sSql = "SELECT teamID from eventDtl where eventID = " + eventId;
oComm = new OleDbCommand(sSql, oConn);
adapter = new OleDbDataAdapter(oComm);
data = new DataSet();
adapter.Fill(data);
ArrayList array = new ArrayList();
ArrayList teamBuffer = new ArrayList();
ArrayList rawMatches = new ArrayList();
foreach(DataTable myTable in data.Tables)
{
foreach(DataRow myRow in myTable.Rows)
{
array.Add(myRow["teamID"]);
}
}
foo = array.Count;
for(int i = 0;i<foo;i++)
{
for(int j=i+1;j<foo;j++)
{
rawMatches.Add(array[i] + " " + array[j]);
}
}
foo = rawMatches.Count;
while(foo>0)
{
if(teamBuffer.Count > 4)
{
teamBuffer.RemoveAt(0);
teamBuffer.RemoveAt(0);}
int myIndex = 0;
int team1;
int team2;
int match;
int counter = 1;
do
{
match = random.Next(0,foo);
if(currentField>fields)
{
currentField=1;
currentRound++;
}
string [] teams = rawMatches[match].ToString().Split(' ');
team1 = Convert.ToInt32(teams[0]);
team2 = Convert.ToInt32(teams[1]);
if(counter > foo){
myIndex = 0;
break;}
if(foo>4)
{
foreach(Object bar in teamBuffer)
{
if(Convert.ToInt32(bar) == team1 || Convert.ToInt32(bar) == team2)
{
myIndex=1;
break;}
else
myIndex=0;
}
}
counter++;
}while(myIndex==1);
teamBuffer.Add(team1);
teamBuffer.Add(team2);
sSql = "insert into rounds (eventID, roundNum, field, team1ID, team2ID) values ("
+ eventId + ", " + currentRound + ", " + currentField + ", " + team1 + ", " + team2 + ")";
oComm= new OleDbCommand(sSql, oConn);
oComm.ExecuteNonQuery();
currentField++;
rawMatches.RemoveAt(match);
foo = rawMatches.Count;
}
}
oConn.Close();
}
catch(Exception ex)
{
oConn.Close();
throw new Exception("Database error. " + ex.Message);
}
}
}
|
|
|
|
|
Break it into classes and mark thier actions. Its easier to read.
Check out UML "use cases" that might show you some valuable insight.
Use an IList or IEnumerable interface to track groups of teams
Could use a Queue collection to assign teams
Check CollectionBase class for details on the ILIst
Good job for your first try though
Nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|