private void TheaterStage_Load(object sender, EventArgs e)
        {
            var settings = Program.Settings;

            Text = string.Format(TitleTemplate, ApplicationHelper.GetCodeName(), settings.Game.Title);

            Icon = Resources.MLTD_Icon;

            ClientSize = new Size(settings.Window.Width, settings.Window.Height);
            CenterToScreen();

            // Register element events.
            var theaterDays = Game.AsTheaterDays();

            var video = theaterDays.FindSingleElement <BackgroundVideo>();

            if (video != null)
            {
                video.VideoStateChanged += Video_VideoStateChanged;
            }
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();

            if (!File.Exists(ConfigFilePath))
            {
                MessageBox.Show($"Missing config file at '{ConfigFilePath}'.", ApplicationHelper.GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            var b = new DeserializerBuilder()
                    .WithNamingConvention(new UnderscoredNamingConvention())
                    .IgnoreUnmatchedProperties()
                    .WithTypeConverter(new PercentOrRealValueConverter())
                    .WithTypeConverter(new ColorConverter())
                    .WithTypeConverter(new SizeFConverter())
                    .WithTypeConverter(new PointFConverter());
            var s = b.Build();

            using (var fileStream = File.Open(ConfigFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                using (var reader = new StreamReader(fileStream)) {
                    var settings = s.Deserialize <ApplicationSettings>(reader);
                    Settings = settings;
                }
            }

            var extensionPaths = new[] {
                Environment.CurrentDirectory,
                Path.Combine(Environment.CurrentDirectory, "plugins")
            };

            PluginManager = new PluginManager(extensionPaths);

            using (var theaterDays = new TheaterDays()) {
                theaterDays.Run <TheaterView>(args);
            }

            PluginManager.Dispose();
        }