/// <summary> /// Redraws all forms /// </summary> internal void Redraw() { foreach (Control c in desktop.Controls) { if (!(c is IObjectLabelUI)) { continue; } IObjectLabelUI label = c as IObjectLabelUI; Form f = null; if (label is IShowForm) { IShowForm sf = label as IShowForm; f = sf.Form as Form; } if (f == null) { Redraw(c); continue; } if (f.IsDisposed) { Redraw(c); continue; } if (!(f is IRedraw)) { continue; } IRedraw r = f as IRedraw; r.Redraw(); } }
public FLowDesingerForm(IShowForm form, Stream stream) { InitializeComponent(); _form = form; //_flowFileName = (flowFileName.ToLower().IndexOf(".xoml") == -1) ? flowFileName.ToLower() : flowFileName.ToLower().Substring(0, flowFileName.ToLower().IndexOf(".xoml")); _stream = stream; }
/// <summary> /// Pre removes control /// </summary> /// <param name="control">The control</param> public static void PreRemove(this Control control) { if (control == null) { return; } if (control.IsDisposed) { return; } foreach (Control c in control.Controls) { c.PreRemove(); } if (control is IShowForm) { IShowForm sf = control as IShowForm; object o = sf.Form; if (o != null) { if (o is Control) { Control c = o as Control; c.PreRemove(); } } } if (control is IPreRemove) { IPreRemove p = control as IPreRemove; p.PreRemove(); } }
/// <summary> /// The properties editor event handler /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event arguments</param> private void showForm(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } IShowForm sf = this; sf.Show(); }
/// <summary> /// Shows component form /// </summary> public void ShowForm() { if (component is IShowForm) { IShowForm sf = component as IShowForm; sf.Show(); return; } IChildObjectLabel panel = ContainerPerformer.GetPanel(component as IObjectLabel) as IChildObjectLabel; panel.ShowForm(); }
/// <summary> /// Shows form /// </summary> /// <param name="sf">Object which shows form</param> public static void Show(this IShowForm sf) { sf.ShowForm(); Form form = sf.Form as Form; if (form == null) { return; } if (forms.Contains(form)) { if (form.IsDisposed) { forms.Remove(form); } return; } else { forms.Add(form); if (sf is IEnabled) { IEnabled en = sf as IEnabled; form.FormClosed += (object senrer, FormClosedEventArgs ev) => { try { if (forms.Contains(form)) { forms.Remove(form); } if (!en.Enabled) { en.Enabled = true; } } catch (Exception ex) { ex.ShowError(10); } }; if (en.Enabled) { en.Enabled = false; } } } }
private void MouseDown(object sender, MouseEventArgs e) { if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { label.Selected = !label.Selected; return; } if (e.Button == MouseButtons.Right) { if (label is IShowForm) { IShowForm sf = label as IShowForm; sf.Show(); return; } } /* if (EditorRectangle.Contains(e.X, e.Y)) * { * return; * }*/ PaletteButton active = pDesktop.Tools.Active; if (active != null) { if (active.IsArrow & (active.ReflectionType != null)) { try { ICategoryArrow arrow = pDesktop.Tools.Factory.CreateArrow(active); arrow.Source = label.Object; pDesktop.ActiveArrow = arrow; pDesktop.ActiveObjectLabel = label; return; } catch (Exception ex) { ex.ShowError(10); return; } } } IsMoved = true; pDesktop.SetBlocking(true); mouseX = e.X; mouseY = e.Y; }
private static void removeForm(INamedComponent component) { if (component is NamedComponent) { NamedComponent nc = component as NamedComponent; nc.RemoveForm(); return; } if (component is IShowForm) { IShowForm sf = component as IShowForm; sf.RemoveForm(); return; } IChildObjectLabel l = ContainerPerformer.GetPanel(component as IObjectLabel) as IChildObjectLabel; l.RemoveForm(); }
/// <summary> /// Test buffer with UI /// </summary> /// <param name="buffer">Byte buffer that contains scenario</param> /// <param name="binder">Serialization binder</param> /// <param name="pan">Desktop</param> /// <param name="ext">Extension</param> /// <param name="extd">Required extension</param> /// <returns>Test exception</returns> public Exception TestBuffer(byte[] buffer, SerializationBinder binder, PanelDesktop pan, string ext, string extd) { try { MemoryStream ms = new MemoryStream(buffer); pan.LoadFromStream(ms, binder, ext, extd); foreach (object o in pan.Controls) { if (o is IShowForm) { IShowForm sf = o as IShowForm; sf.ShowForm(); } } pan.TempDelete(); } catch (Exception e) { e.ShowError(10); return(TestException.GetRoot(e)); } return(null); }
/// <summary> /// Removes itself /// </summary> /// <param name="removeForm">The "remove form" sign</param> public void Remove(bool removeForm) { Control cp = Parent; if (cp != null) { if (cp.Controls.Contains(rbox)) { cp.Controls.Remove(rbox); } } if (removeForm) { if (label is IShowForm) { IShowForm sf = label as IShowForm; Form form = sf.Form as Form; if (form is IRemovableObject) { IRemovableObject r = form as IRemovableObject; r.RemoveObject(); } sf.RemoveForm(); sf = null; } } if (isRemoved) { return; } isRemoved = true; if (label is IRemovableObject) { IRemovableObject r = label as IRemovableObject; r.RemoveObject(); } Control cont = label as Control; Control c = Parent; if (c != null) { PanelDesktop d = pDesktop; if (c.Controls.Contains(cont)) { d.Remove(label); if (c.Controls.Contains(cont)) { c.Controls.Remove(cont); } } } if (label.Object is IRemovableObject) { IRemovableObject obj = label.Object as IRemovableObject; obj.RemoveObject(); obj = null; } cont.Dispose(); label = null; cont = null; GC.Collect(); }