Наследование: System.Windows.Forms.Form
        private bool load(frmLoading.StatusDelegate status)
        {
            status(0, Strings.Status_Load_Settings);
            settings = Settings.AllSettings.Load();
            if (settings == null)
            {
                settings = new Settings.AllSettings();
                Thread.Sleep(4000);
            }

            status(10, Strings.Status_Creating_VM);
            vm = new VM();
            status(15, Strings.Status_Add_Functions);
            CoreFunctions.AddTo(vm);
            Functions.AddTo(vm);
            status(20, Strings.Status_Load_Scripts);
            vm.LoadFromDirectory("scripts");             // Load all scripts from scripts folder.
            status(40, Strings.Status_Load_Personalities);
            vm.LoadFromDirectory(settings.Personalities.Path);

            Personality player;

            if (!vm.TryGetPersonality("player", out player))
            {
                player = vm.CreatePersonality("Player");
            }

            // Create a personality for testing.
            Personality persona;

            if (!vm.TryGetPersonality("Lisa", out persona))
            {
                persona = vm.CreatePersonality("Lisa");
            }

            status(70, Strings.Status_Validate);
            vm.Validate();

            // ToDo : Move message to strings
            status(80, "Running setups..");
            vm.RunPersonalitySetup();

            var controller = vm.CreateController("Main");

            controller.Interval = 500;
            controller.AutoFill = true;
            controller.Personalities.Add(persona);

            status(90, Strings.Status_Load_UI);
            bool split = settings.Windows.Split;

            // show the main windows and get the glitter and chat controls.
            Glitter glitter;
            Chat    chat;

            if (split)
            {
                var other = new frmSplitOther();
                var media = new frmSplitMedia();
                settings.Windows.SplitOther.Attach(other);
                settings.Windows.SplitMedia.Attach(media);
                addMainForm(other);
                addMainForm(media);

                chat    = other.Chat;
                glitter = other.Glitter;
            }
            else
            {
                var combined = new frmCombined();
                settings.Windows.Combined.Attach(combined);
                addMainForm(combined);

                chat    = combined.Chat;
                glitter = combined.Glitter;
            }

            // assign the output of the controller to go to the chat control.
            controller.OnOutput = chat.Message;
            // just dump all chat input to the controller.
            chat.OnInput = (string text) => { controller.Input(player, text); };

            status(100, Strings.Status_Display_UI);
            return(true);
        }
Пример #2
0
		private bool load(frmLoading.StatusDelegate status)
		{
			status(0, Strings.Status_Load_Settings);
			settings = Settings.AllSettings.Load();
			if (settings == null)
			{
				settings = new Settings.AllSettings();
				Thread.Sleep(4000);
			}

			status(10, Strings.Status_Creating_VM);
			vm = new VM();
			status(15, Strings.Status_Add_Functions);
			CoreFunctions.AddTo(vm);
			Functions.AddTo(vm);
			status(20, Strings.Status_Load_Scripts);
			vm.LoadFromDirectory("scripts"); // Load all scripts from scripts folder.
			status(40, Strings.Status_Load_Personalities);
			vm.LoadFromDirectory(settings.Personalities.Path);

			Personality player;
			if (!vm.TryGetPersonality("player", out player))
				player = vm.CreatePersonality("Player");

			// Create a personality for testing.
			Personality persona;
			if (!vm.TryGetPersonality("Lisa", out persona))
				persona = vm.CreatePersonality("Lisa");

			status(70, Strings.Status_Validate);
			vm.Validate();

			// ToDo : Move message to strings
			status(80, "Running setups..");
			vm.RunPersonalitySetup();

			var controller = vm.CreateController("Main");
			controller.Interval = 500;
			controller.AutoFill = true;
			controller.AddPersonality(persona);

			status(90, Strings.Status_Load_UI);
			bool split = settings.Windows.Split;

			// show the main windows and get the glitter and chat controls.
			Glitter glitter;
			Chat chat;
			if (split)
			{
				var other = new frmSplitOther();
				var media = new frmSplitMedia();
				settings.Windows.SplitOther.Attach(other);
				settings.Windows.SplitMedia.Attach(media);
				addMainForm(other);
				addMainForm(media);

				chat = other.Chat;
				glitter = other.Glitter;
			}
			else
			{
				var combined = new frmCombined();
				settings.Windows.Combined.Attach(combined);
				addMainForm(combined);

				chat = combined.Chat;
				glitter = combined.Glitter;
			}

			// assign the output of the controller to go to the chat control.
			controller.OnOutput = chat.Message;
			// just dump all chat input to the controller.
			chat.OnInput = (string text) => { controller.Input(player, text); };

			status(100, Strings.Status_Display_UI);
			return true;
		}