Starting from analyzing the main function

Source: Internet
Author: User
Tags sharpdevelop
The most bt is here, and there is no application. Run () -- and all are read from addins.

1 [stathread ()]
2 public static void main (string [] ARGs)
3 {
4 commandlineargs = ARGs;
5 bool nologo = false;
6
7 foreach (string ARG in ARGs ){
8 If (Arg. toupper (). endswith ("nologo ")){
9 nologo = true;
10}
11}
12
13 if (! Nologo ){
14 splashscreen = new splashscreenform ();
15 splashscreen. Show ();
16}
17
18 arraylist commands = NULL;
19 try {
20 servicemanager. Services. initializeservicessubsystem ("/workspace/services ");
21
22 commands = addintreesingleton. addintree. gettreenode ("/workspace/autostart"). buildchilditems (null );
23
24 For (INT I = 0; I <commands. Count-1; ++ I ){
25 (icommand) commands [I]). Run ();
26}
27} catch (xmlexception e ){
28 MessageBox. Show ("cocould not load XML: \ n" + E. Message );
29 return;
30} catch (exception e ){
31 MessageBox. Show ("loading error, please reinstall: \ n" + E. tostring ());
32 return;
33} finally {
34 if (splashscreen! = NULL ){
35 splashscreen. Close ();
36 splashscreen. Dispose ();
37}
38}
39
40 // run the last autostart command, this must be the workbench starting command
41 if (commands. Count> 0 ){
42 (icommand) commands [commands. Count-1]). Run ();
43}
44
45 // unloading services
46 servicemanager. Services. unloadallservices ();
47}

The row-by-row analysis is as follows:
Line 18 is the "Daily prompt"-whether or not the splashscreen is realistic, and line 33 closes the form before the last command (activating the IDE Main Window) is started.
Line 18 is the key:
Servicemanager, a single piece, initializes all services (including four core services in core and 11 services in base), where service calls in core are written to death, the service called in base is to dynamically load sharpdevelop. addin node "/workspace/services.

Next, obtain all the codons -- buildchilditems () Methods on The addin Tree node "workspace/autostart". Because each codons is a command, the run () method is used to perform its own tasks. Execute these commands in sequence through the for loop.
The last command is "Activate ide Main Window". This command is executed only when all codons are running properly. In this command, you can see statements such as application. Run.

Finally, servicemanager unmounts all services.

Note: Another BT part is that sharpdevelop does not place the dll Directory for compilation under the bin of their respective projects, but all projects share the same bin directory externally, therefore, a static read-only constant is written to every class that needs to reflect the DLL, recording this relative path-this method is completely different from vs2003, so when converting CMBX into a proj project, the DLL reference is lost. This is also the problem with the configuration file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.