Ejemplo n.º 1
0
        public static PlatformFormReturn Show(string message, IList <Engine> platforms, Form parent)
        {
            PlatformForm form = new PlatformForm();

            form.Platforms         = platforms;
            form.MessageLabel.Text = message;
            PlatformFormReturn data = new PlatformFormReturn();

            data.Result = form.ShowDialog(parent);
            if (data.Result == DialogResult.OK)
            {
                data.Platform = form.PlatformList.SelectedItem as Engine;
            }

            return(data);
        }
Ejemplo n.º 2
0
        private bool SelectPlatform(List <Pair <Engine, Game> > platforms, out Engine platform, out Game game)
        {
            game = Game.Unknown;

            if (platforms.Count == 0 || platforms.Count > 1)
            {
                string         message = "The selected file was not recognized. Please select a platform to try to import with.";
                IList <Engine> engines = PlatformDetection.Selections;
                if (platforms.Count > 1)
                {
                    message = "The selected file could be in any of the following formats. Please select the one that matches best.";
                    engines = platforms.Select(p => p.Key).ToList();
                }
                var ret = PlatformForm.Show(message, engines, this);
                if (ret.Result == DialogResult.Cancel)
                {
                    platform = null;
                    return(false);
                }

                platform = ret.Platform;
                if (platforms.Count == 0)
                {
                    game = Game.Unknown;
                }
                else
                {
                    game = platforms.Where(p => p.Key == ret.Platform).First().Value;
                }
                return(true);
            }
            else
            {
                var pair = platforms.First();
                platform = pair.Key;
                game     = pair.Value;
            }

            return(true);
        }