Exemple #1
0
        /// <summary>The levels view on view loaded.</summary>
        /// <param name="sender">The sender.</param>
        /// <param name="eventArgs">The event args.</param>
        private void LevelsViewOnViewLoad(object sender, EventArgs eventArgs)
        {
            this.LoadImages();

            var levelNumbers = LevelsManager.GetActiveLevelNumbers();

            if (levelNumbers.Any())
            {
                Array.Sort(levelNumbers);

                // Cache enities
                var cacheEntities = SearchManager.GetGeometry();
                var main          = LevelsManager.GetMainLevel();

                var drawing = FileManager.CurrentFileName;

                drawing = string.IsNullOrEmpty(drawing) ? LocalizationStrings.LEVELS : Path.GetFileName(drawing);

                // Top most node
                var mainLevel = new TreeNode(drawing, (int)TreeIconIndex.MainLevel, (int)TreeIconIndex.MainLevel);

                for (var i = 0; i < levelNumbers.Count(); i++)
                {
                    // Query the cached data
                    var entities = cacheEntities.Where(e => e.Level == i).ToList().Count;

                    var level = new Level
                    {
                        Entities    = entities,
                        Name        = LevelsManager.GetLevelName(i),
                        Number      = i,
                        SetName     = LevelsManager.GetLevelSetName(i),
                        Visible     = LevelsManager.IsLevelVisible(i),
                        IsMainLevel = i == main
                    };

                    // Level node
                    var node = new TreeNode($"{level.Number.ToString().PadRight(5)} {level.Name}", (int)TreeIconIndex.Level, (int)TreeIconIndex.Level)
                    {
                        Tag = level
                    };
                    mainLevel.Nodes.Add(node);
                }

                this.view.LevelsTree.Nodes.Add(mainLevel);
                this.view.LevelsTree.Nodes[0].Expand();
            }
        }
        /// <summary> Creates this object. </summary>
        public void Create()
        {
            var level = LevelsManager.GetMainLevel();

            this.CreateLine1();
            this.CreateLine2();
            this.CreateLine3();

            LevelsManager.SetMainLevel(101);

            this.CreateArc1();
            this.CreateArc2();
            this.CreateArc3();
            this.CreateArc3();

            LevelsManager.SetMainLevel(level);
        }