Пример #1
0
        private void updateView()
        {
            var context = LocalizationManifest.Get.CurrentLanguage["FormColonization"];

            if (controller.Sources().Contains(sourceData))
            {
                this.controlButton.Image = Stareater.Properties.Resources.start;
                this.starName.Text       = this.sourceData.HostStar.Name.ToText(LocalizationManifest.Get.CurrentLanguage);
            }
            else
            {
                this.controlButton.Image = Stareater.Properties.Resources.stop;
                this.starName.Text       = context["stoppedColonization"].Text(
                    new TextVar("star", this.sourceData.HostStar.Name.ToText(LocalizationManifest.Get.CurrentLanguage)).Get
                    );
            }
        }
        void updateView()
        {
            var sources = controller.Sources().ToArray();

            while (sourceList.Controls.Count < sources.Length)
            {
                var itemView = new ColonizationSourceView(controller);
                itemView.OnStateChange += onSourceChange;
                sourceList.Controls.Add(itemView);
            }
            while (sourceList.Controls.Count > sources.Length)
            {
                var itemView = sourceList.Controls[sourceList.Controls.Count - 1] as ColonizationSourceView;
                itemView.OnStateChange -= onSourceChange;
                sourceList.Controls.RemoveAt(sourceList.Controls.Count - 1);
            }

            for (int i = 0; i < sources.Length; i++)
            {
                var itemView = sourceList.Controls[i] as ColonizationSourceView;
                itemView.Data = sources[i];
            }
        }