/// <summary> /// Configures the specified shell. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="shell">The shell.</param> /// <param name="config">The configuration.</param> protected virtual void Configure <T>(T shell, IShellConfig config) where T : class { Form form; Window window; if (typeof(T) == typeof(Window)) { window = shell as Window; } else if (typeof(T) == typeof(Form)) { form = shell as Form; //TODO: Voy por aqui pero la ladilla no me deja pensar var x = SetParent(form.Handle, hWndDesktop); form.ShowInTaskbar = true; form.Visible = true; form.Size = new System.Drawing.Size(800, 800); form.Show(); } /* else * throw new NotImplementedException("A Window Form or WPF Window were expected. Unable to create unified shell."); */ // System.Diagnostics.Debugger.Launch(); ShellWindow = shell; }
/// <summary> /// Starts this instance. /// </summary> /// <param name="config">The configuration.</param> public void Start(IShellConfig config) { var shellFactory = TypeContainer.Current.Resolve <IShellFactory>(); switch (Shell) { case ShellType.WindowsForm: var form = shellFactory.Build(typeof(Form)); //var form = (Form)(ShellWindow = new Form()); Configure(form, config); break; case ShellType.Wpf: // var window = (Window)(ShellWindow = new Window()); var window = shellFactory.Build(typeof(Form)); Configure(window, config); break; } }