|
The RealmForge project[^] uses C#, OpenGL and includes a 3ds importer. You might want to look into the source packages to see how its done.
Also, I believe the Axiom project includes a similar 3ds importer. You might want to check that out as well.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: I luv teh choco
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
suroor, if you require more information, please post in the forums so that it can benefit others as well.
|
|
|
|
|
Hi!
This is my first question in this board. So please be gentle with your comments
I just wanted a List<t> class that provides events when the list is about to change or has already changed.
I briefly looked in the framework documentation and searched the internet but I haven't found anything useful.
I would greatly appreciate any comments or information on best practise solutions
for this requirement.
Thanks in advance!
My implementation:
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">class</SPAN> ObservedList<T> : List<T>
{
<SPAN style="COLOR: blue">public</SPAN> ObservedList()
{
}
<SPAN style="COLOR: blue">public</SPAN> ObservedList(IEnumerable<T> collection)
: <SPAN style="COLOR: blue">base</SPAN>(collection)
{
}
<SPAN style="COLOR: blue">public</SPAN> ObservedList(<SPAN style="COLOR: blue">int</SPAN> capacity)
: <SPAN style="COLOR: blue">base</SPAN>(capacity)
{
}
<SPAN style="COLOR: blue">#region</SPAN> EventArgs
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">enum</SPAN> ChangeAction
{
Add,
Remove,
Clear,
Sort
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">class</SPAN> ObservedListChangingEventArgs : ObservedListChangedEventArgs
{
<SPAN style="COLOR: blue">public</SPAN> ObservedListChangingEventArgs(ChangeAction action, List<T> item)
: <SPAN style="COLOR: blue">base</SPAN>(action, item)
{
}
<SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">bool</SPAN> _cancel;
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">bool</SPAN> Cancel
{
<SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> _cancel; }
<SPAN style="COLOR: blue">set</SPAN> { _cancel = value; }
}
<SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">bool</SPAN> _handled;
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">bool</SPAN> Handled
{
<SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> _handled; }
<SPAN style="COLOR: blue">set</SPAN> { _handled = value; }
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">class</SPAN> ObservedListChangedEventArgs : System.EventArgs
{
<SPAN style="COLOR: blue">public</SPAN> ObservedListChangedEventArgs(ChangeAction action, List<T> list)
{
<SPAN style="COLOR: blue">this</SPAN>._items = list;
<SPAN style="COLOR: blue">this</SPAN>._action = action;
}
<SPAN style="COLOR: blue">private</SPAN> List<T> _items;
<SPAN style="COLOR: blue">public</SPAN> List<T> Items
{
<SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> _items; }
<SPAN style="COLOR: blue">set</SPAN> { _items = value; }
}
<SPAN style="COLOR: blue">private</SPAN> ChangeAction _action;
<SPAN style="COLOR: blue">public</SPAN> ChangeAction Action
{
<SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> _action; }
<SPAN style="COLOR: blue">set</SPAN> { _action = value; }
}
}
<SPAN style="COLOR: blue">#endregion</SPAN>
<SPAN style="COLOR: blue">#region</SPAN> events
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">event</SPAN> EventHandler<ObservedListChangingEventArgs> OnListChanging;
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">event</SPAN> EventHandler<ObservedListChangedEventArgs> OnListChanged;
<SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">void</SPAN> FireOnListChangedEvent(ChangeAction action)
{
<SPAN style="COLOR: blue">if</SPAN> (OnListChanged != <SPAN style="COLOR: blue">null</SPAN>)
{
<SPAN style="COLOR: blue">try</SPAN>
{
<SPAN style="COLOR: blue">this</SPAN>.OnListChanged(<SPAN style="COLOR: blue">this</SPAN>, <SPAN style="COLOR: blue">new</SPAN> ObservedListChangedEventArgs(action, <SPAN style="COLOR: blue">this</SPAN>));
}
<SPAN style="COLOR: blue">catch</SPAN> (System.Exception) { }
}
}
<SPAN style="COLOR: gray"> <SPAN style="COLOR: gray"> <SPAN style="COLOR: gray"> <SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">bool</SPAN> HandleOnListChangingEvents(ChangeAction action, T item)
{
List<T> items = <SPAN style="COLOR: blue">new</SPAN> List<T>();
items.Add(item);
<SPAN style="COLOR: blue">return</SPAN> HandleOnListChangingEvents(action, items);
}
<SPAN style="COLOR: gray"> <SPAN style="COLOR: gray"> <SPAN style="COLOR: gray"> <SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">bool</SPAN> HandleOnListChangingEvents(ChangeAction action, List<T> items)
{
<SPAN style="COLOR: blue">if</SPAN> (OnListChanging != <SPAN style="COLOR: blue">null</SPAN>)
{
ObservedListChangingEventArgs e = <SPAN style="COLOR: blue">new</SPAN> ObservedListChangingEventArgs(action,
items);
<SPAN style="COLOR: blue">foreach</SPAN> (Delegate subscriber <SPAN style="COLOR: blue">in</SPAN> OnListChanging.GetInvocationList())
{
EventHandler<ObservedListChangingEventArgs> target = (EventHandler<ObservedListChangingEventArgs>)subscriber;
<SPAN style="COLOR: blue">try</SPAN>
{
target(<SPAN style="COLOR: blue">this</SPAN>, e);
}
<SPAN style="COLOR: blue">catch</SPAN> (System.Exception)
{<SPAN style="COLOR: green"></SPAN> }
<SPAN style="COLOR: blue">if</SPAN> (e.Handled)
{
<SPAN style="COLOR: blue">break</SPAN>;
}
}
<SPAN style="COLOR: blue">return</SPAN> !e.Cancel;
}
<SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: maroon">true</SPAN>;
}
<SPAN style="COLOR: blue">#endregion</SPAN>
<SPAN style="COLOR: blue">#region</SPAN> <SPAN style="COLOR: blue">new</SPAN> implementation of the list methods (those changing the list)
<SPAN style="COLOR: blue">#region</SPAN> Add / AddRange
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> Add(T item)
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Add, item))
{
<SPAN style="COLOR: blue">base</SPAN>.Add(item);
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Add);
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> AddRange(IEnumerable<T> collection)
{
List<T> items = <SPAN style="COLOR: blue">new</SPAN> List<T>(collection);
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Add,items ))
{
<SPAN style="COLOR: blue">base</SPAN>.AddRange(collection);
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Add);
}
}
<SPAN style="COLOR: blue">#endregion</SPAN>
<SPAN style="COLOR: blue">#region</SPAN> Remove / Clear
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> Clear()
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Clear, <SPAN style="COLOR: blue">this</SPAN>))
{
<SPAN style="COLOR: blue">base</SPAN>.Clear();
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Clear);
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">bool</SPAN> Remove(T item)
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Remove, item))
{
<SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: blue">base</SPAN>.Remove(item);
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Remove);
}
<SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: maroon">false</SPAN>;
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> RemoveAt(<SPAN style="COLOR: blue">int</SPAN> index)
{
<SPAN style="COLOR: blue">if</SPAN> (<SPAN style="COLOR: blue">base</SPAN>.Count > index)
{
T item = <SPAN style="COLOR: blue">base</SPAN>[index];
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Remove, item))
{
<SPAN style="COLOR: blue">base</SPAN>.RemoveAt(index);
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Remove);
}
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">int</SPAN> RemoveAll(Predicate<T> predicate)
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Remove, <SPAN style="COLOR: blue">this</SPAN>.Find(predicate)))
{
<SPAN style="COLOR: blue">int</SPAN> removedItems = <SPAN style="COLOR: blue">base</SPAN>.RemoveAll(predicate);
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Remove);
<SPAN style="COLOR: blue">return</SPAN> removedItems;
}
<SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: maroon">0</SPAN>;
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> RemoveRange(<SPAN style="COLOR: blue">int</SPAN> index, <SPAN style="COLOR: blue">int</SPAN> count)
{
<SPAN style="COLOR: blue">if</SPAN> (index+count<<SPAN style="COLOR: blue">this</SPAN>.Count)
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Remove,<SPAN style="COLOR: blue">this</SPAN>.GetRange(index,count)))
{
<SPAN style="COLOR: blue">base</SPAN>.RemoveRange(index,count);
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Remove);
}
}
}
<SPAN style="COLOR: blue">#endregion</SPAN>
<SPAN style="COLOR: blue">#region</SPAN> Reverse / Sort
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> Reverse()
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Sort, <SPAN style="COLOR: blue">this</SPAN>))
{
<SPAN style="COLOR: blue">base</SPAN>.Reverse();
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Sort);
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> Reverse(<SPAN style="COLOR: blue">int</SPAN> index, <SPAN style="COLOR: blue">int</SPAN> count)
{
<SPAN style="COLOR: blue">if</SPAN> (index+count<<SPAN style="COLOR: blue">this</SPAN>.Count)
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Sort,<SPAN style="COLOR: blue">this</SPAN>.GetRange(index,count)))
{
<SPAN style="COLOR: blue">base</SPAN>.Reverse();
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Sort);
}
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> Sort()
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Sort, <SPAN style="COLOR: blue">this</SPAN>))
{
<SPAN style="COLOR: blue">base</SPAN>.Sort();
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Sort);
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> Sort(Comparison<T> comparison)
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Sort, <SPAN style="COLOR: blue">this</SPAN>))
{
<SPAN style="COLOR: blue">base</SPAN>.Sort(comparison);
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Sort);
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> Sort(IComparer<T> comparer)
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Sort, <SPAN style="COLOR: blue">this</SPAN>))
{
<SPAN style="COLOR: blue">base</SPAN>.Sort(comparer);
}
}
<SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">void</SPAN> Sort(<SPAN style="COLOR: blue">int</SPAN> index,<SPAN style="COLOR: blue">int</SPAN> count,IComparer<T> comparer)
{
<SPAN style="COLOR: blue">if</SPAN> (index + count < <SPAN style="COLOR: blue">this</SPAN>.Count)
{
<SPAN style="COLOR: blue">if</SPAN> (HandleOnListChangingEvents(ChangeAction.Sort, <SPAN style="COLOR: blue">this</SPAN>.GetRange(index,count)))
{
<SPAN style="COLOR: blue">base</SPAN>.Sort(index,count,comparer);
<SPAN style="COLOR: blue">this</SPAN>.FireOnListChangedEvent(ChangeAction.Sort);
}
}
}
<SPAN style="COLOR: blue">#endregion</SPAN>
<SPAN style="COLOR: blue">#endregion</SPAN>
}
-- modified at 8:21 Sunday 16th April, 2006
|
|
|
|
|
At a first glance:
You are both inheriting the List<t> class and declaring another internal list as _items. That means that you are using two different lists, one for the base methods that use the list itself, and one for the methods overriding the base methods and using the _items list instead.
---
b { font-weight: normal; }
|
|
|
|
|
Okay, I must admit this looks a bit strange but I've encapsulated the EventArg classes into the main class so the _items object is in fact not in the main class but in a EventArg class.
Maybe I should extract those subclasses
|
|
|
|
|
Hi i've try to write a tree using webcontrols, but i don't know the equivalent
of TreeNode.Tag which i use in windows forms . Please help. 10x.
|
|
|
|
|
I'm not a web developer, but I can say at least that it should be as simple as deriving from the TreeNode class you use to populate the web tree, and add a new object variable with a get/set property named Tag.
Alternately, you could just maintain a dictionary of tree node keys and object tag values.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: I luv teh choco
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
hi
i want to set pass on my access db and use it in .net but when i import it to vs.net, the following message has shown :
Microsoft Data Link Error
---------------------------
Test connection failed because of an error in initializing provider. Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
---------------------------
OK
my access was closed,and username is : Admin but i don't know why this message has been shown.
please help hat how to imort it to my vs.net and solve my problem.
|
|
|
|
|
Follow up on the replies you already got instead of posting the same question again.
---
b { font-weight: normal; }
|
|
|
|
|
hi
and sorry for question again
but my problem was not solved . Please give me a full description because i am beginer.
thanks.
|
|
|
|
|
Good afternoon.
1. In my program i send the letter through MS Outlook 2003. And so how to make so that it (Outlook) return in my program result of sending of the letter or I can not so I send:
<br />
Outlook.Application = new Outlook.Application();<br />
<br />
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);<br />
<br />
Outlook.Recipient oRecip = (Outlook.Recipient)oMsg.Recipients.Add(CBTo.SelectedItem.ToString());<br />
oRecip.Resolve();<br />
<br />
oMsg.Subject = "Letter";<br />
oMsg.Body = "";<br />
<br />
string sSource = currentPATH + @"\Attachment.zip";<br />
String sDisplayName = "MyFirstAttachment";<br />
int iPosition = (int)oMsg.Body.Length + 1;<br />
int iAttachType = (int)Outlook.OlAttachmentType.olByValue; <br />
Outlook.Attachment oAttach = oMsg.Attachments.Add(sSource,iAttachType,iPosition,sDisplayName);<br />
<br />
oMsg.Save();<br />
oMsg.Send();<br />
And so method Send simply sends the letter and if that show warning window Outlook, that the letter is not sent, and the program easy at this time works further... And it is necessary that it reacted to result! Method Send returns void. Can be other method?
2. How it is possible define a default box in MS Outlook through which letters by default send? Thanks.
|
|
|
|
|
hi all,
i need to read file contents from a zip file.
i believe there are two classes in System.IO.Compression namespace:
1) DeflateStream
2) GZipStream
Is is possible, using these classes, to know:
1. exact number of files in the zip file
2. read each file individually without extracting the content anywhere.
Please help me out. Any help will be highly appreciated.
Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Found ICSharpCode.SharpZipLib.dll
http://icsharpcode.net/OpenSource/SharpZipLib/Default.aspx
|
|
|
|
|
Hi there everybody!
I was using XmlDocument.SelectSingleNode in .Net quite fine but I just ported a portion of my code to compact framwork and it says there is no such damn function!!Is there any shortcut or other way to do the same work or ?
|
|
|
|
|
|
hi
when i open my access db exclusively and set password and when i add oledbdataadapter to my form and in configuration window set neccessary properties and enter my pass and click test connection button,the follow message shown for me :
---------------------------
Microsoft Data Link Error
---------------------------
Test connection failed because of an error in initializing provider. Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
---------------------------
OK
---------------------------
user : Admin
Pass : 123
How to solve my problem and add my db in c# ?
|
|
|
|
|
When you have the database open in Access, you can't also open it from C#. Close Access.
---
b { font-weight: normal; }
|
|
|
|
|
when access was close that message shown again.
|
|
|
|
|
hdv212 wrote:
---------------------------
Microsoft Data Link Error
---------------------------
Test connection failed because of an error in initializing provider. Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
---------------------------
OK
---------------------------
user : Admin
Pass : 123
[disclaimer]
I’m still not up to speed with .NET, but I recognize this type of error for ADO.
[/disclaimer]
I assume your supplying a username along with the password, right? If you just want the database password protected don’t worry about setting a password on the user, just set the password on the database and don’t worry about the user name in the connection.
|
|
|
|
|
Can somebody tell me the deployment steps for the window application in C#
Thank You
Pankaj Garg
|
|
|
|
|
You simply need to "copy and paste" the executable and any support files onto the target machine, which has to have the .NET Framework installed.
I'm not sure about how to do this using the VS Installer Projects but using something like NSIS gives you more flexability.
Alot depends on how complex your application is and what your requirements are, if you need further help then please be more specific.
Ed
|
|
|
|
|
how can i find bluetooth devices mac addresses in my area then store them in a array?
|
|
|
|
|
I'm using Open GL with C# and I want to import objects from 3D Max. How Can I do that??
|
|
|
|
|
I already answered your question here[^]. Please don't post the same question multiple times in the forum, once is sufficient.
|
|
|
|
|