public void Close() { Control.ControlCollection items = panelDemo.Controls; //c1Expander1.HeaderText = ""; //c1Expander1.ContentText = ""; C1DemoForm.ClearContainer(items); }
public C1DemoForm Run(string typeName, string title, string description) { //C1DemoForm d = null; Control.ControlCollection items = panelDemo.Controls; Type t = Type.GetType(typeName); loadedCode = false; try { demoForm = t.Assembly.CreateInstance(t.FullName) as C1DemoForm; //c1Expander1.HeaderText = title; c1DockingTabPage_Demo.Text = title; if (!string.IsNullOrEmpty(typeName)) { c1DockingTabPage_Code.TabVisible = LoadCodeViewer(); c1DockingTab_Demo.ShowTabs = c1DockingTabPage_Code.TabVisible; } demoForm.DisplayIn(items); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (demoForm != null && demoForm.IsHandleCreated) { // use BeginInvoke to be sure that it is called after form loading and all props are already initialized demoForm.BeginInvoke((Action) delegate() { AddProperties(demoForm); }); } return(demoForm); }
private void loadSample(SampleInfo sample) { if (sample != null) { if (sample.FormName.StartsWith(@"ComponentOne\Demos\")) { // run standalone demo or demo installer RunDemo(sample.FormName); return; } try { this.Cursor = Cursors.AppStarting; LockWindowUpdate(Handle); if (breadCrumb.Items.Count == 2) { BreadCrumbItem item = breadCrumb.AddItem(sample.Name); item.Tag = ExplorerMode.Samples; } else { breadCrumb.RemoveTop(); BreadCrumbItem item = breadCrumb.AddItem(sample.Name); item.Tag = ExplorerMode.Samples; } string description = sample.LongDescription; if (description == null || description == "") { description = sample.ShortDescription; } lblLeftDescriptionSamples.Text = description; // load sample form _activeForm = _viewer.Run(sample.FormName, sample.Name, sample.LongDescription); // attach viewer if it is not attached yet Control.ControlCollection collection = pnlMainSamples.Controls; if (!collection.Contains(_viewer)) { collection.Clear(); collection.Add(_viewer); _viewer.Visible = true; } TheExplorer.CurrentExplorerMode = ExplorerMode.Samples; } finally { LockWindowUpdate(IntPtr.Zero); this.Cursor = Cursors.Default; } } }
private void AddProperties(C1DemoForm d) { c1DockingTab_Properties.AutoHiding = true; panelProperties.Controls.Clear(); if (d.Properties.Count > 0) { PropertyList pl = new PropertyList(d.Properties); panelProperties.Controls.Add(pl); Explorer.ApplyTheme(pl); Explorer.ApplyTheme(c1DockingTab_Properties); c1DockingTab_Properties.Visible = true; if (d.PinProperties) { c1DockingTab_Properties.SlideShowPage(c1DockingTabPage_Properties); c1DockingTab_Properties.AutoHiding = false; } } else { c1DockingTab_Properties.SlideHidePage(); c1DockingTab_Properties.Visible = false; } }