Exemple #1
0
        private void ClickInstallButton(ManagementFrameFull managementFrame)
        {
            var mainPage = managementFrame.GetProperty("MainPage");

            if (mainPage == null)
            {
                return;
            }

            var m = mainPage.GetMethod <EventHandler>("ButtonBar_InstallButtonClicked");

            if (m == null)
            {
                return;
            }

            DisableLaunchWebMatrix();

            try
            {
                m(mainPage, EventArgs.Empty);

                Close();
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch
            {
            }
        }
Exemple #2
0
        public Form1(bool useIisExpress, string[] contextualEntryProducts, string contextualEntryLanguage)
        {
            InitializeComponent();

            var applicationOverrideFeed = MainXml;

            string[] contextualEntryFeeds = { MainXml, CustomXml };
            var      contextualEntryModes = useIisExpress ? ContextualEntryModes.TargetIisExpress : ContextualEntryModes.TargetIis;// | ContextualEntryModes.Sqm | ContextualEntryModes.AcceptEula;

            new WebPiPreferences {
                SelectedFeeds = CustomXml
            }.Save();

            var hostService = new HostService
            {
                AllowIisExpressAppInstall  = useIisExpress,
                UseIisExpressForAppInstall = useIisExpress
            };

            var serviceProvider = new UIHost(hostService, applicationOverrideFeed);

            serviceProvider.UseIisExpressForAppInstall(useIisExpress);
            var managementFrame  = new ManagementFrameFull(serviceProvider, contextualEntryProducts, contextualEntryFeeds, contextualEntryLanguage, contextualEntryModes);
            var isInstallClicked = false;

            Shown += delegate
            {
                if (isInstallClicked)
                {
                    return;
                }
                //
                // Automatically click 'Install'
                //
                var cartService    = serviceProvider.GetService("CartService");
                var installProduct = cartService.GetProperty("InstallProductList") as List <Product>;
                if (installProduct != null && installProduct.Any())
                {
                    ClickInstallButton(managementFrame);
                }
                else
                {
                    cartService.AddEventHandler <EventArgs>("ProductAdded", delegate
                    {
                        ClickInstallButton(managementFrame);
                    }, true);
                }

                isInstallClicked = true;
            };

            InstallerServiceProxy = new InstallerServiceProxy(serviceProvider, serviceProvider.GetService("InstallerService"))
            {
                UseIisExpress = useIisExpress
            };

            //
            // Disable update notification
            //
            serviceProvider.GetService("ProductService").SetField("_upgradeOptionOffered", true);

            FormClosing += (s, e) =>
            {
                //InstallerService.Print();
                hostService.RaiseShellFormClosing(s, e);
            };

            SuspendLayout();
            AutoScaleDimensions = new SizeF(6f, 13f);
            AutoScaleMode       = AutoScaleMode.Font;
            //this._managementFrame = new ManagementFrameFull(this._webPIServiceProvider, this.contextualEntryProducts, this.contextualEntryFeeds, this.contextualEntryLanguage, this.contextualEntryModes);
            var num  = Size.Width - ClientSize.Width;
            var num2 = Size.Height - ClientSize.Height;

            // ReSharper disable once DoNotCallOverridableMethodsInConstructor
            MinimumSize     = new Size(managementFrame.MinimumSize.Width + num, managementFrame.MinimumSize.Height + num2);
            FormBorderStyle = FormBorderStyle.Sizable;
            Size            = new Size(780, 540);
            CenterToScreen();
            managementFrame.Dock = DockStyle.Fill;
            Controls.Clear();
            Controls.Add(managementFrame);
            //this._lastWindowState = base.WindowState;
            managementFrame.LoadUI();
            ResumeLayout(false);
            PerformLayout();


            //managementFrame.LoadUI();
        }