EditPacketForm CreateEditor(EditPacketEventArgs e) { if (InvokeRequired) { return (EditPacketForm)Invoke(new Func<EditPacketEventArgs, EditPacketForm>(CreateEditor), e); } else { EditPacketForm frm = new EditPacketForm(); frm.Frame = e.Frame; frm.Selector = e.SelectPath; frm.DisplayColor = ColorValueConverter.ToColor(e.Color); frm.DisplayTag = e.Tag; frm.ShowDisableEditor = true; frm.ShowReadOnly = true; frm.Show(); frm.Activate(); return frm; } }
void DisposeEditor(EditPacketForm frm) { if (InvokeRequired) { Invoke(new Action<EditPacketForm>(DisposeEditor), frm); } else { frm.Dispose(); } }
void Graph_EditPacketEvent(object sender, EditPacketEventArgs e) { if (InvokeRequired) { Invoke(new EventHandler<EditPacketEventArgs>(Graph_EditPacketEvent), sender, e); } else { using (EditPacketForm frm = new EditPacketForm()) { frm.Frame = e.Frame; frm.Selector = e.SelectPath; frm.DisplayColor = ColorValueConverter.ToColor(e.Color); frm.DisplayTag = e.Tag; frm.ShowDisableEditor = true; frm.ShowReadOnly = true; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { e.Frame = frm.Frame; } if (frm.DisableEditor) { if (e.Sender != null) { e.Sender.Enabled = false; } } } } }