internal void LoadPadContentIfRequired() { bool dockingManagerIsInitializing = layout.Busy || !layout.DockingManager.IsLoaded; if (placeholder != null && placeholder.IsVisible && !dockingManagerIsInitializing) { placeholder.IsVisibleChanged -= AvalonPadContent_IsVisibleChanged; padInstance = descriptor.PadContent; if (padInstance != null) { bool isFocused = this.IsKeyboardFocused; SD.WinForms.SetContent(this, padInstance.Control, padInstance); placeholder = null; if (isFocused) { IInputElement initialFocus = padInstance.InitiallyFocusedControl as IInputElement; if (initialFocus != null) { Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(delegate { Keyboard.Focus(initialFocus); })); } } } } }
void PropertyChanged(object sender, PropertyValueChangedEventArgs e) { AlgorithmManager.Algorithms.CurrentAlgorithm.UpdateGraphAppearance(); IPadContent animationPad = WorkbenchSingleton.Workbench.GetPad(typeof(AnimationPad)); AlgorithmManager.Algorithms.CurrentAlgorithm.UpdateAnimationPad(); }
public void CreatePad() { if (Altaxo.Current.Dispatcher.InvokeRequired) { throw new InvalidOperationException("This action could trigger pad creation and is only valid on the main thread!"); } if (!padContentCreated) { padContentCreated = true; try { if (addIn != null) { Current.Log.Debug("Creating pad " + Class + "..."); padContent = (IPadContent)addIn.CreateObject(Class); padContent.PadDescriptor = this; } else { padContent = (IPadContent)Activator.CreateInstance(padType); padContent.PadDescriptor = this; } if (padContent is IMVCController mvcPadContent && padContent.ViewObject == null) { Current.Gui.FindAndAttachControlTo(mvcPadContent); } } catch (Exception ex) { MessageService.ShowException(ex, "Error creating pad instance"); } } }
public virtual void ShowPad(IPadContent content) { if (layout != null) { layout.ShowPad(content); } }
void CreateContent() { if (this.content == null) { this.content = codon.InitializePadContent(this); } }
void ActivateContent() { if (!allowInitialize) { return; } if (!isInitialized) { isInitialized = true; IPadContent content = padDescriptor.PadContent; if (content == null) { return; } try { Control control = content.Control; control.Dock = DockStyle.Fill; Controls.Add(control); } catch (Exception ex) { MessageService.ShowError(ex, "Error in IPadContent.Control"); } } }
/// <summary> /// 将动画面板清空 /// </summary> public Graphics ClearAnimationPad() { IPadContent animationPad = WorkbenchSingleton.Workbench.GetPad(typeof(NetFocus.DataStructure.Gui.Pads.AnimationPad)); if (animationPad == null) { Bitmap bmp1 = new Bitmap(1, 1); Graphics g1 = Graphics.FromImage(bmp1); return(g1); } int x = animationPad.Control.Left > 0 ? animationPad.Control.Left : 0; int y = animationPad.Control.Top > 0 ? animationPad.Control.Top : 0; int width = animationPad.Control.Width > 0 ? animationPad.Control.Width : 1; int height = animationPad.Control.Height > 0 ? animationPad.Control.Height : 1; Bitmap bmp = new Bitmap(width, height); Graphics g = Graphics.FromImage(bmp); g.DrawRectangle(new Pen(Color.Gray, 1), x, y, width - 1, height - 1); ((PictureBox)animationPad.Control).BackgroundImage = bmp; PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); Color c = ParseColor(propertyService.GetProperty("NetFocus.DataStructure.AnimationPadPanel.BackColor", "White")); animationPad.Control.BackColor = c; return(g); //这里,最后要把Graphics对象返回,因为一个特定的算法对象还要借助这个对象画一些特定的动画信息 }
public void CreatePad() { #if DEBUG if (WorkbenchSingleton.InvokeRequired) { throw new InvalidOperationException("This action could trigger pad creation and is only valid on the main thread!"); } #endif if (!padContentCreated) { padContentCreated = true; try { if (addIn != null) { LoggingService.Debug("Creating pad " + Class + "..."); padContent = (IPadContent)addIn.CreateObject(Class); } else { padContent = (IPadContent)Activator.CreateInstance(padType); } } catch (Exception ex) { MessageService.ShowError(ex, "Error creating pad instance"); } } }
/// <summary> /// <para>Adds a <see cref='.IPadContent'/> with the specified value to the /// <see cref='.PadContentCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='.IPadContent'/> to add.</param> /// <returns> /// <para>The index at which the new element was inserted.</para> /// </returns> /// <seealso cref='.PadContentCollection.AddRange'/> public int Add(IPadContent value) { if (!List.Contains(value)) { return(List.Add(value)); } return(List.IndexOf(value)); }
/// <summary> /// <para>Adds a <see cref='.IPadContent'/> with the specified value to the /// <see cref='.PadContentCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='.IPadContent'/> to add.</param> /// <returns> /// <para>The index at which the new element was inserted.</para> /// </returns> /// <seealso cref='.PadContentCollection.AddRange'/> public int Add(IPadContent value) { if(!List.Contains(value)) { return List.Add(value); } return List.IndexOf(value); }
public PadCodon(IPadContent content, string id, string label, string defaultPlacement, string icon) { this.id = id; this.content = content; this.label = label; this.defaultPlacement = defaultPlacement; this.icon = icon; }
public void Dispose() { if (padContent != null) { padContent.Dispose(); padContent = null; } }
public void CreatePad() { if (!padContentCreated) { padContentCreated = true; padContent = (IPadContent)codon.AddIn.CreateObject(Class); } }
public PadCodon(IPadContent content, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, string icon) { this.id = id; this.content = content; this.label = label; this.defaultPlacement = defaultPlacement; this.icon = icon; this.defaultStatus = defaultStatus; }
private void muneProperty_Click(object sender, EventArgs e) { IPadContent padContent = GetPad(typeof(FormProperties)); if (padContent != null) { ((DockContent)padContent).DockHandler.Activate(); } }
public void ActivatePad(IPadContent padContent) { Content content = (Content)contentHash[padContent]; if (content != null) { content.BringToFront(); } }
public void HidePad(IPadContent padContent) { Content content = (Content)contentHash[padContent]; if (content != null) { dockManager.HideContent(content); } }
/// <summary> /// 清空属性面板 /// </summary> public void ClearPropertyPad() { IPadContent propertyPad = WorkbenchSingleton.Workbench.GetPad(typeof(PropertyPad)); if (propertyPad != null) { ((PropertyGrid)propertyPad.Control).SelectedObject = null; } }
private void menuToolBox_Click(object sender, EventArgs e) { IPadContent padContent = GetPad(typeof(FormToolBox)); if (padContent != null) { ((DockContent)padContent).DockHandler.Activate(); } }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { Debug.Assert(Class != null && Class.Length > 0); IPadContent pad = AddIn.CreateObject(Class) as IPadContent; pad.Shortcut = shortcut; return(pad); }
public void ShowPad(IPadContent content) { if (contentHash[content] == null) { IProperties properties = (IProperties)propertyService.GetProperty("Workspace.ViewMementos", new DefaultProperties()); string type = content.GetType().ToString(); content.Control.Dock = DockStyle.None; Content c1; if (content.Icon != null) { ImageList imgList = new ImageList(); imgList.Images.Add(content.Icon); c1 = dockManager.Contents.Add(content.Control, content.Title, imgList, 0); } else { c1 = dockManager.Contents.Add(content.Control, content.Title); } c1.DisplaySize = new Size(270, 200); contentHash[content] = c1; if (properties.GetProperty(type, "Left") == "Left") { if (leftContent == null) { leftContent = dockManager.AddContentWithState(c1, State.DockLeft); } else { dockManager.AddContentToWindowContent(c1, leftContent); } } else if (properties.GetProperty(type, "Left") == "Bottom") { if (bottomContent == null) { bottomContent = dockManager.AddContentWithState(c1, State.DockBottom); } else { dockManager.AddContentToWindowContent(c1, bottomContent); } } } else { Content c = (Content)contentHash[content]; if (c != null) { dockManager.ShowContent(c); } } }
public bool IsVisible(IPadContent padContent) { Content content = (Content)contentHash[padContent]; if (content != null) { return(content.Visible); } return(false); }
internal Pad FindPad(IPadContent padContent) { foreach (Pad pad in Pads) { if (pad.Content == padContent) { return(pad); } } return(null); }
public void UpdatePropertyPad() { IPadContent propertyPad = WorkbenchSingleton.Workbench.GetPad(typeof(PropertyPad)); if (propertyPad != null) { ((PropertyGrid)propertyPad.Control).SelectedObject = null; if (AlgorithmManager.Algorithms.CurrentAlgorithm != null) { ((PropertyGrid)propertyPad.Control).SelectedObject = AlgorithmManager.Algorithms.CurrentAlgorithm.Status; } } }
public IPadContent InitializePadContent(IPadWindow window) { if (content == null) { content = CreatePad(); content.Initialize(window); } else if (!initializeCalled) { content.Initialize(window); } initializeCalled = true; return(content); }
public object BuildItem(object caller, Codon codon, System.Collections.ArrayList subItems) { IPadContent pc = (IPadContent)codon.AddIn.CreateObject(codon.Properties["class"]); if (pc == null) { return(null); } pc.Title = codon.Properties["title"].ToString(); pc.ID = codon.Properties["id"].ToString(); pc.Pos = codon.Properties["pos"].ToString(); if (codon.Properties.Contains("active") && codon.Properties["active"].ToLower() == "true") { pc.IsActive = true; } else { pc.IsActive = false; } if (codon.Properties.Contains("ShowCloseButton") && codon.Properties["ShowCloseButton"].ToLower() == "true") { pc.ShowCloseButton = true; } else { pc.ShowCloseButton = false; } if (codon.Properties.Contains("AutoHide") && codon.Properties["AutoHide"].ToLower() == "true") { pc.AutoHide = true; } else { pc.AutoHide = false; } if (codon.Properties.Contains("height")) { int height = 500; bool bHeight = int.TryParse(codon.Properties["height"].ToString(), out height); pc.PHeight = height; } else { pc.PHeight = 500; } return(pc); }
/// <summary> /// Closes the pad. /// </summary> /// <param name="content">The content.</param> /// <exception cref="ArgumentNullException">content</exception> public void ClosePad(IPadContent content) { if (null == content) { throw new ArgumentNullException(nameof(content)); } if (content.PadDescriptor is null) // this is a document in the pad area { _padContentCollection.Remove(content); (content as IDisposable)?.Dispose(); } else { content.IsVisible = false; } }
IGlyph CreateVisitedGlyph(IGlyph glyph) { int count = ((ArrayIterator)visitedIterator).Count; int diameter = 35; int x = 1; int y = 1; IPadContent animationPad = WorkbenchSingleton.Workbench.GetPad(typeof(NetFocus.DataStructure.Gui.Pads.AnimationPad)); if (animationPad != null) { x = 10 + count * (diameter + 5); y = animationPad.Control.Height - diameter - 10; } string text = ((IBiTreeNode)glyph).Text; return(new BiTreeNode(x, y, diameter, status.遍历过结点颜色, text)); }
IGlyph CreateStackItem(IGlyph nodeGlyph) { int itemCount = ((StackIterator)stackIterator).ItemCount; int x = 2; int y = 10; int width = 1; int height = 28; IPadContent stackPad = WorkbenchSingleton.Workbench.GetPad(typeof(NetFocus.DataStructure.Gui.Pads.StackPad)); if (stackPad != null) { y = stackPad.Control.Height - (itemCount + 1) * (2 + 28) - 1; width = stackPad.Control.Width - 6; } string text = ((IBiTreeNode)nodeGlyph).Text; return(new StackItem(x, y, width, height, SystemColors.Control, GlyphAppearance.Popup, text)); }
void ActivateContent() { if (!allowInitialize) { return; } if (!isInitialized) { isInitialized = true; IPadContent content = padDescriptor.PadContent; if (content == null) { return; } Control control = content.Control; control.Dock = DockStyle.Fill; Controls.Add(control); } }
internal void LoadPadContentIfRequired() { bool dockingManagerIsInitializing = layout.Busy || !layout.DockingManager.IsLoaded; if (placeholder != null && placeholder.IsVisible && !dockingManagerIsInitializing) { placeholder.IsVisibleChanged -= AvalonPadContent_IsVisibleChanged; padInstance = descriptor.PadContent; if (padInstance != null) { bool isFocused = this.IsKeyboardFocused; this.SetContent(padInstance.Control, padInstance); placeholder = null; if (isFocused) { IInputElement initialFocus = padInstance.InitiallyFocusedControl as IInputElement; if (initialFocus != null) { Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(delegate { Keyboard.Focus(initialFocus); })); } } } } }
public void CreatePad() { #if DEBUG if (WorkbenchSingleton.InvokeRequired) { throw new InvalidOperationException("This action could trigger pad creation and is only valid on the main thread!"); } #endif if (!padContentCreated) { padContentCreated = true; if (addIn != null) { padContent = (IPadContent)addIn.CreateObject(Class); } else { padContent = (IPadContent)Activator.CreateInstance(padType); } } }
/// <summary> /// <para>Inserts a <see cref='.IPadContent'/> into the <see cref='.PadContentCollection'/> at the specified index.</para> /// </summary> /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param> /// <param name=' value'>The <see cref='.IPadContent'/> to insert.</param> /// <returns><para>None.</para></returns> /// <seealso cref='.PadContentCollection.Add'/> public void Insert(int index, IPadContent value) { List.Insert(index, value); }
public void Dispose() { if (this.padContent != null) { this.padContent.Dispose(); this.padContent = null; } }
public bool IsVisible(IPadContent padContent) { DockItem item = GetDockItem (padContent); if (item != null) return item.IsAttached; return false; }
void AddPad(IPadContent content, string placement) { DockItem item = new DockItem (content.Id, content.Title, content.Icon, DockItemBehavior.Normal); Gtk.Label label = item.TabLabel as Gtk.Label; label.UseMarkup = true; if (content is Widget) item.Add (content.Control); else { CommandRouterContainer crc = new CommandRouterContainer (content.Control, content, true); crc.Show (); item.Add (crc); } item.Show (); item.HideItem (); content.TitleChanged += new EventHandler (UpdatePad); content.IconChanged += new EventHandler (UpdatePad); DockPad (item, placement); if (!activePadCollection.Contains (content)) activePadCollection.Add (content); }
public void CreatePad() { if (!this.padContentCreated) { this.padContentCreated = true; this.padContent = (IPadContent) this.codon.AddIn.CreateObject(this.Class); } }
public void ActivatePad(IPadContent padContent) { DockItem item = GetDockItem (padContent); if (item != null) item.Present (null); }
public PadCodon (IPadContent content, string id, string label, string defaultPlacement, string icon) { this.id = id; this.content = content; this.label = label; this.defaultPlacement = defaultPlacement; this.icon = icon; }
public bool IsVisible(IPadContent padContent) { Content content = (Content)contentHash[padContent]; if (content != null) { return content.Visible; } return false; }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { content = CreatePad (); return this; }
public void CreatePad() { if (SD.MainThread.InvokeRequired) { throw new InvalidOperationException("This action could trigger pad creation and is only valid on the main thread!"); } if (!padContentCreated) { padContentCreated = true; try { if (addIn != null) { LoggingService.Debug("Creating pad " + Class + "..."); padContent = (IPadContent)addIn.CreateObject(Class); } else { padContent = (IPadContent)Activator.CreateInstance(padType); } } catch (Exception ex) { MessageService.ShowException(ex, "Error creating pad instance"); } } }
/// <summary> /// <para> Removes a specific <see cref='.IPadContent'/> from the /// <see cref='.PadContentCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='.IPadContent'/> to remove from the <see cref='.PadContentCollection'/> .</param> /// <returns><para>None.</para></returns> /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception> public void Remove(IPadContent value) { List.Remove(value); }
void CreateContent () { if (this.content == null) { this.content = codon.InitializePadContent (this); } }
/// <summary> /// <para> /// Initializes a new instance of <see cref='.PadContentCollection'/> containing any array of <see cref='.IPadContent'/> objects. /// </para> /// </summary> /// <param name='value'> /// A array of <see cref='.IPadContent'/> objects with which to intialize the collection /// </param> public PadContentCollection(IPadContent[] value) { this.AddRange(value); }
/// <summary> /// <para>Adds a <see cref='.IPadContent'/> with the specified value to the /// <see cref='.PadContentCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='.IPadContent'/> to add.</param> /// <returns> /// <para>The index at which the new element was inserted.</para> /// </returns> /// <seealso cref='.PadContentCollection.AddRange'/> public int Add(IPadContent value) { return List.Add(value); }
/// <summary> /// <para>Copies the elements of an array to the end of the <see cref='.PadContentCollection'/>.</para> /// </summary> /// <param name='value'> /// An array of type <see cref='.IPadContent'/> containing the objects to add to the collection. /// </param> /// <returns> /// <para>None.</para> /// </returns> /// <seealso cref='.PadContentCollection.Add'/> public void AddRange(IPadContent[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
public PadCodon (IPadContent content, string id, string label, string defaultPlacement, string icon) : this (content, id, label, defaultPlacement, DockItemStatus.Dockable, icon) { }
public void HidePad(IPadContent padContent) { DockItem item = GetDockItem (padContent); if (item != null) item.HideItem(); }
/// <summary> /// <para>Gets a value indicating whether the /// <see cref='.PadContentCollection'/> contains the specified <see cref='.IPadContent'/>.</para> /// </summary> /// <param name='value'>The <see cref='.IPadContent'/> to locate.</param> /// <returns> /// <para><see langword='true'/> if the <see cref='.IPadContent'/> is contained in the collection; /// otherwise, <see langword='false'/>.</para> /// </returns> /// <seealso cref='.PadContentCollection.IndexOf'/> public bool Contains(IPadContent value) { return List.Contains(value); }
public void ShowPad(IPadContent content) { DockItem item = GetDockItem (content); if (item != null) { // TODO: ShowItem is not working properly in the // managed Gdl. /* if (item.DefaultPosition != null) item.ShowItem(); else */ DockPad (item, content.DefaultPlacement); } else AddPad (content, content.DefaultPlacement); }
/// <summary> /// <para>Copies the <see cref='.PadContentCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the /// specified index.</para> /// </summary> /// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='.PadContentCollection'/> .</para></param> /// <param name='index'>The index in <paramref name='array'/> where copying begins.</param> /// <returns> /// <para>None.</para> /// </returns> /// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='.PadContentCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception> /// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception> /// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception> /// <seealso cref='System.Array'/> public void CopyTo(IPadContent[] array, int index) { List.CopyTo(array, index); }
DockItem GetDockItem(IPadContent content) { if (activePadCollection.Contains (content)) { DockItem item = dock.GetItemByName (content.Id); return item; } return null; }
/// <summary> /// <para>Returns the index of a <see cref='.IPadContent'/> in /// the <see cref='.PadContentCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='.IPadContent'/> to locate.</param> /// <returns> /// <para>The index of the <see cref='.IPadContent'/> of <paramref name='value'/> in the /// <see cref='.PadContentCollection'/>, if found; otherwise, -1.</para> /// </returns> /// <seealso cref='.PadContentCollection.Contains'/> public int IndexOf(IPadContent value) { return List.IndexOf(value); }
public PadCodon (IPadContent content, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, string icon) { this.id = id; this.content = content; this.label = label; this.defaultPlacement = defaultPlacement; this.icon = icon; this.defaultStatus = defaultStatus; }
public IPadContent InitializePadContent (IPadWindow window) { if (content == null) { content = CreatePad (); content.Initialize (window); } else if (!initializeCalled) content.Initialize (window); initializeCalled = true; return content; }