public static ValidationResult ShowSplashScreen(Func<SplashScreen, ValidationResult> setup) { var screen = new SplashScreen(setup); Application.Run(screen); return screen.result; }
static ValidationResult Setup(SplashScreen splashScreen) { var validator = new SPFInstalledValidator(); if (validator.RunValidator() == ValidationResult.Error) { MessageBox.Show(validator.ErrorString+Environment.NewLine+Environment.NewLine+validator.QuestionString, SPMEnvironment.Version.Title + " Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return ValidationResult.Error; } var builder = new ContainerBuilder(); // Find all the assemblies for this application builder.RegisterModule(new AutoLoadAssemblies()); // Build the container now! autoFacContainer = builder.Build(); //CompositionProvider.LoadAssemblies(); IoCContainer = autoFacContainer.Resolve<IContainerAdapter>(); var provider = IoCContainer.Resolve<SettingsProvider>(); provider.Load(); var engine = new PreflightController(splashScreen, IoCContainer); if (!engine.Validate()) { return ValidationResult.Error; } Window = IoCContainer.Resolve<MainWindow>(); Window.SplashScreenLoad(splashScreen); return ValidationResult.Success; }
public void SplashScreenLoad(SplashScreen splashScreen) { Trace.WriteLine("SplashScreenLoad()"); // The property "NeedsUpgradeIncludeChildren" of SPFarm is very slow to resolve. Therefore exclude it from the PropertyGrid PropertyGridTypeConverter.ExcludedProperties.Add("NeedsUpgradeIncludeChildren"); //PropertyGridTypeConverter.ExcludedProperties.Add("Xml"); //PropertyGridTypeConverter.ExcludedProperties.Add("XmlDataSchema"); PropertyGridTypeConverter.AddTo(typeof(SPFarm)); PropertyGridTypeConverter.AddTo(typeof(SPWebService)); // PropertyGridTypeConverter.AddTo(typeof(SPListItemCollection)); splashScreen.UpdateProgress("Loading SharePoint Model..."); Explorer = IoCContainer.Resolve<TreeViewComponent>(); this.Explorer.Dock = System.Windows.Forms.DockStyle.Fill; this.Explorer.HideSelection = false; this.Explorer.Location = new System.Drawing.Point(0, 0); this.Explorer.Name = "Explorer"; this.Explorer.ShowNodeToolTips = true; this.Explorer.Size = new System.Drawing.Size(408, 440); this.Explorer.TabIndex = 0; this.Explorer.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Explorer_KeyUp); this.Explorer.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.Explorer_NodeMouseClick); this.Explorer.Click += new System.EventHandler(this.Explorer_Click); this.Explorer.LocationChanged += Explorer_LocationChanged; this.Explorer.BeforeExpand += Explorer_BeforeExpand; this.Explorer.AfterSelect += Explorer_AfterSelect; this.Explorer.BeforeSelect += Explorer_BeforeSelect; this.Explorer.MouseClick += Explorer_MouseClick; splitContainer.Panel1.Controls.Add(Explorer); Explorer.Worker(() => Explorer.Build()); //((SPTreeNode)Explorer.SelectedNode).Refresh(); // Call default expand after Explorer.Build(); TabPropertyPage propertyPage = TabPages.GetPropertyPage(TabPages.PROPERTIES, null); propertyPage.Grid.PropertyValueChanged += new PropertyValueChangedEventHandler(Grid_PropertyValueChanged); if (Properties.Settings.Default.ReadOnly) { toolStripSave.Visible = false; toolStripSaveAll.Visible = false; } }
public PreflightController(SplashScreen splashScreen, IContainerAdapter container) { SplashForm = splashScreen; IoCContainer = container; }