|
Hi led mike and papadimitriou,
thanks for your reply. In fact I've read many available papers, tutorials about MVP patter include some of your suggested ones. My question goes directly to this particular project.
The root of the project structure tree is the project itself. The root has a list of sub items that are either a working package that can in turns has a list of sub items (working package or work item) or a work item (leaf node). In my implementation, composite pattern is used to model this:
class abstract ProjectElement
class Project: ProjectElement
{
List<projectelement> subItems;
}
class Package: Project
{
List<projectelement> subItems;
}
class WorkItem: Project
{
}
inspirated from some articles about Presenter first method by mean of thinking in "When" , my thoughts are:
- When the user opens a project, he sees the projecture structure => aha MVP triad ProjectStructureView-ProjectStructurePresenter-ProjectStructureModel
- When the user clicks on an item (which can be either project, package or workitem like explained above) an editor dialog is displayed showing the detailed information of the currently selected node (again project, package or workitem). The user can edit / change these information => MVP triad: ProjectElementEditorView-ProjectElementEditorPresenter-ProjectElementEditorModel. I am stuck at this point: the ProjectElementEditor is an abstract concept (abstract class) which can be either project, package or workitem. My question would be:
Does the MVP triad ProjectElementEditorView-ProjectElementEditorPresenter-ProjectElementEditorModel make sence? Then the ProjectElementEditorPresenter would has an generic interface to a ProjectElementEditorView (which can be either Project general information editor, package information editor or workitem information editor) or should I define for each type of view a MVP triad like:
ProjectGeneralInfoEditorView - ProjectGeneralInfoEditorPresenter-ProjectGeneralInfoEditorModel
PackageInfoEditorView - PackageEditorPresenter-PackageEditorModel
WorkItemEditorView - WorkItemEditorPresenter-WorkItemEditorModel
Hope it makes the problem clearer
|
|
|
|
|
Quang Tran Minh wrote: an editor dialog is displayed showing the detailed information of the currently selected node
dialogs are from Windows 3.0 User Interfaces. Today you can do things like have a splitter so you can present your navigation in one splitter pane and a different view, say for editing, in the other.
Also for .NET applications the PropertyGrid works brilliantly for an editor mechanism
Quang Tran Minh wrote: When the user clicks on an item (which can be either project, package or workitem like explained above)...
The Properties of the item are displayed in the PropertyGrid
led mike
|
|
|
|
|
Hello
I've a DataGridView populated with a query
The user can add some rows
The primary key is auto increment and not visible
But some oter fiels can not be duplicated
What is the best way to check them befor to do the update
do I have to make a query in the db for each of those fields before to validate the user entry ?
Any suggestion is welcome
|
|
|
|
|
baranils wrote: But some oter fiels can not be duplicated
Do you mean you created a unique index on the field in MySql?
led mike
|
|
|
|
|
Hello !
Not yet
The table contain one auto-increment primary key and a few fields
2 of those fields can't be duplicated because they are alternate identifier for the entity
For now I didn't aplly any index on those fields but I'm looking for the best way to manage them, using MySql ADO and C#
Thank you for your reply !
|
|
|
|
|
baranils wrote: but I'm looking for the best way to manage them
Well I'm no database expert but it's possible that creating unique indexes in the database is the best practice approach or at least the first step.
led mike
|
|
|
|
|
You have to specify IN THE DATABASE that a given column must be unique.
If your database already contains data, make sure that none of the data in that column is a duplicate BEFORE setting the column to be unique.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all,
Can you please assist me with any relevant code in Csharp/ASp.net that helps me reading a CSV file off an Ftp site and populate a table in my database.
Thank you very much.
|
|
|
|
|
Check out ye olde FtpWebRequest class, its like HttpWebRequest, but for FTP instead. What you end up with is a stream to the file, then you can read it like you would any other stream.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Thank you very much.Your help is much appreciated.
Can you please give me a little more tips please?
Thank you.
|
|
|
|
|
|
Hi all. How i can make control reflect changes was maded on his datasource?
<br />
ctlTextEdit.DataBindings.Add(new Binding("EditValue", _mySourceDataRow, "Field1"));<br />
<br />
....<br />
<br />
void someButton_onClick(...)<br />
{<br />
_mySourceDataRow.Field1 = "New text";<br />
<br />
} <br />
<br />
Or exists an method in Form class what make all child controls reread values from ones data sources?
THANK.
|
|
|
|
|
|
I'm looking for more efficient Xml reading. I do not mean performance - I load small files. I'd rather ask about coding style/methods. Now I use the following routine:
public static void FromFile(string path, KorepetytorMenu menu)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(path);
foreach (XmlNode rootNode in xmlDoc.ChildNodes) {
XmlElement rootEl = rootNode as XmlElement;
if (rootEl != null && rootEl.Name == "KorepetytorMenu") {
foreach (XmlNode node in rootEl.ChildNodes) {
XmlElement el = node as XmlElement;
if (el != null && el.Name == "RootNode") {
menu.rootNode = KorepetytorMenuNode.FromXmlElement(el);
ReadNodeChildsRecursive(menu.rootNode, el);
}
}
}
}
}
I just have been starting coding this, but I wrote some programs like this in the past and I know that it gets annoying when there are 10 or more nested foreach'es an if's.
A sample Xml file:
<?xml version="1.0" encoding="utf-8" ?>
<KorepetytorMenu>
<RootNode Header="" Image="">
<Node Header="Fizyka">
<Node Header="Równania Rózniczkowe" Image="Gwiazdka.png" />
<Node Header="Kinematyka 1" File="Matma\Równania Rózniczkowe.xml" />
(...)
</Node>
</RootNode>
</KorepetytorMenu>
Any ideas?
Thanks in advance.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Just note: I do NOT want to use reflection to perform this task, because the first use of reflection causes a slow-down, so if I need it to show main menu, then... . I tried to use Xml Serialization system in .Net, but I didn't like it. It's too slow (as it uses reflection) and forces me to design class in a specific style which does not satisfy me. Cheers!
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Take a look at XPath and the Node.selectNodes(...) method
led mike
|
|
|
|
|
Ok I get it. Thanks.
public static void FromFile(string path, KorepetytorMenu menu)
{
XPathDocument doc = new System.Xml.XPath.XPathDocument(path);
XPathNavigator nav = doc.CreateNavigator();
if (!nav.MoveToChild("KorepetytorMenu", "")) return;
if (!nav.MoveToChild("RootNode", "")) return;
menu.rootNode = KorepetytorMenuNode.FromXmlNavigator(nav);
ReadNodeChildsRecursive(menu.rootNode, nav);
}
Is it a correct approach?
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
gajatko wrote: Is it a correct approach?
Well I'm not sure what you are trying to do and that is certainly an improvement, but you still have not used XPath. If you want to access a possible set of elements you can use XmlNode.SelectNodes with an XPath statement and it is possible to get a collection of all the nodes you are interested in and then you simply iterate the list and do whatever operations you need for each XmlNode in the collection. See the example code in the documentation for XmlNode.SelectNodes()
led mike
|
|
|
|
|
Do you think of sth like this?:
static void ReadNodeChildsRecursive(KorepetytorMenuNode rootNode, XPathNavigator nav)
{
XPathNodeIterator iter = nav.SelectChildren(XPathNodeType.Element);
while (iter.MoveNext()) {
if (iter.Current.Name == "Node") {
rootNode.Nodes.Add(KorepetytorMenuNode.FromXmlNavigator(iter.Current));
ReadNodeChildsRecursive(rootNode.Nodes[rootNode.Nodes.Count - 1], iter.Current);
}
}
}
And...
public static KorepetytorMenuNode FromXmlNavigator(XPathNavigator nav)
{
return new KorepetytorMenuNode() {
File = nav.GetAttribute("File", "") ?? "",
Header = nav.GetAttribute("Header", "") ?? "",
Image = nav.GetAttribute("Image", "") ?? ""
};
}
Maybe I should post it in my previous message so it would be clear what did I do.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Why don't you do it the easy way:
string myFileName = @"C:\test\my.xml";
DataTable data = new DataTable();
data.ReadXml(myFileName);
After you've done that, you can just retrieve the data from data.Rows...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What about a situation when I have many meaningfull attributes and xml represents a tree with unbounded complexity? I though that a DataTable doesn't support more than a finite number of sub-trees, does it? Maybe I missed something, however.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
You could try it and see what happens. That's part of the adventure of being a programmer.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi !,
I am new to C# and was wondering if the standard components included in .NET are usefull enough to build winforms ? Or better buy 3rd class libraries ?
Thanks you !
Best regards,
Steve
|
|
|
|
|
with standard controls, you can develope any application, however nearly all third party controls are for good looking GUI they may slow performance too
and for more info, just google
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Steve Declerck,
Well, what do you want to do?, If its just simple form that inputs values into a DB, then sure, they are fine. If you want to display models and graphs, then, you'll need to buy some 3rd party libs.
Regards,
Gareth.
|
|
|
|