示例#1
0
        //---------------------------------------------------------------------------------
        // debut de database
        //Database.SQL DataBase = new Database.SQL();

        //---------------------------------------------------------------------------------
        public Form1(string[] args)
        {
            //----- tip manager
            TipManager.Start();

            //----- menu
            InitializeComponent();
            ApplyTheme();
            UpdateUI();

            //----- args
            if (args.Length > 0 && File.Exists(args[0]))
            {
                FileInfo fi = new FileInfo(args[0]);
                TaxonUtils.MyConfig.TaxonPath     = fi.Directory.FullName;
                TaxonUtils.MyConfig.TaxonFileName = fi.Name;
            }

            //----- load
            DateTime      startLoad  = DateTime.Now;
            TaxonTreeNode loadedNode = null;

            if (TaxonUtils.Exists())
            {
                loadedNode = TaxonTreeNode.Load(TaxonUtils.GetTaxonFileName());
            }
            if (loadedNode == null)
            {
                if (!TaxonTreeNode.LoadHasBeenCanceled() && !TaxonUtils.MyConfig.emptyTreeAtStartup)
                {
                    Loggers.WriteError(LogTags.Data, "Cannot open taxon file data : \n\n    " + TaxonUtils.GetTaxonFileName());
                }
            }
            else
            {
                string message = "open " + TaxonUtils.GetTaxonFileName() + " successful";
                message += "\n    " + loadedNode.Count() + " taxon loaded";
                message += "\n    " + loadedNode.Count(ClassicRankEnum.Espece) + " " + VinceToolbox.Helpers.enumHelper.GetEnumDescription(ClassicRankEnum.Espece);
                message += "," + loadedNode.Count(ClassicRankEnum.SousEspece) + " " + VinceToolbox.Helpers.enumHelper.GetEnumDescription(ClassicRankEnum.SousEspece);
                Loggers.WriteInformation(LogTags.Data, message);
            }

            FormAbout.SetSplashScreenMessage(".. End initialization ...");
            TaxonUtils.SetOriginalRoot(loadedNode);
            TaxonUtils.MainWindow = this;

            DateTime endLoad = DateTime.Now;

            TaxonControlList.OnRegisterTaxonControl      += TaxonControlList_OnRegisterTaxonControl;
            TaxonControlList.OnInitTaxonControlAfterLoad += TaxonControlList_OnInitTaxonControlAfterLoad;
            TaxonControlList.OnUnregisterTaxonControl    += TaxonControlList_OnUnregisterTaxonControl;
            SystemConfig.OnRunningModeChanged            += SystemConfig_OnRunningModeChanged;
            SystemConfig_OnRunningModeChanged(null, EventArgs.Empty);

            TaxonUtils.MyConfig.ToUI();
            taxonGraph_AddOneIfNone();

            Loggers.WriteInformation(LogTags.Data, "Total loading time: " + (int)((endLoad - startLoad).TotalMilliseconds));
        }