public SandboxControlLink(ILink link, INode from, INode to, SandboxControl control, IKeyTableFactory tableFactory, IPrimFactory primFactory, IPermissions permissions) : base(link, from, to, control, permissions) { _control = control; _bufferedChanges = tableFactory.MakeKeyTable<double>(); _dialog = new Dialog(control.HostPrim, primFactory, LINK_BUTTONS); _dialog.ResponseReceived += DialogPressed; }
public ChangeAlg(IButton button, IControlUtil control, IPrimFactory factory) : base(button) { _control = control; _dialog = new Dialog(button.Prims.Count() > 0 ? button.Prims.First() : factory.Host, factory, control.Model.Algorithms.Concat(new String[] { Dialog.CANCEL }).ToArray()); _dialog.ResponseReceived += (name, id, text, chat) => { if (!text.Equals(Dialog.CANCEL)) _control.Model.SetAlgorithm(text); }; }
public Clear(IButton button, IControlUtil control, IPrimFactory factory) : base(button) { _control = control; _dialog = new Dialog(button.Prims.Count() > 0 ? button.Prims.First() : factory.Host, factory, YES, NO); _dialog.ResponseReceived += (name, id, text, chat) => { if (text.Equals(YES)) _control.Clear(name, id); }; }
public ModifyLinks(IButton button, SandboxControl control, IPrimFactory factory) : base(button) { _control = control; _dialog = new Dialog(button.Prims.Count() > 0 ? button.Prims.First() : factory.Host, factory, SandboxControlLink.UNIT, SandboxControlLink.LENGTH, SandboxControlLink.RANDOM, Dialog.CANCEL); _dialog.ResponseReceived += (name, id, text, chat) => { switch (text) { case SandboxControlLink.UNIT: SandboxControlLink.SetType(name, id, ControlLink.LinkType.Unit, _control, GetParameters(id)); break; case SandboxControlLink.RANDOM: SandboxControlLink.SetType(name, id, ControlLink.LinkType.Random, _control, GetParameters(id)); break; case SandboxControlLink.LENGTH: SandboxControlLink.SetType(name, id, ControlLink.LinkType.Length, _control, GetParameters(id)); break; } }; }
public Open(IButton button, IControlUtil control, IPrimFactory factory) : base(button) { IPrim prim = button.Prims.Count() > 0 ? button.Prims.First() : factory.Host; _dialog = new Dialog(prim, factory, SEQUENCE, TOPOLOGY, Dialog.CANCEL); SelectDialog openSequenceDialog = new SelectDialog(prim, factory, name => control.Record.GetUserFolder(name), control.Record.SharedFolder); SelectDialog openTopologyDialog = new SelectDialog(prim, factory, name => control.Topology.GetUserFolder(name), control.Topology.SharedFolder); _dialog.ResponseReceived += (name, id, text, chat) => { if (text.Equals(Dialog.CANCEL)) return; switch (text) { case SEQUENCE: openSequenceDialog.Show(name, id); break; case TOPOLOGY: openTopologyDialog.Show(name, id); break; } }; openSequenceDialog.OnSelect += (name, id, file) => control.Record.PlayRecording(name, id, file); openTopologyDialog.OnSelect += (name, id, file) => control.Topology.LoadTopology(name, id, file); }
public SelectDialog(IPrim prim, IPrimFactory factory, Func<string, string> getFolder) { _getFolder = getFolder; _fileSubsets = new Dictionary<UUID, int>(); _dialog = new Dialog(prim, factory); _dialog.ResponseReceived += (name, id, pressed, chatted) => { switch (pressed) { case MORE: ShowNextSet(name, id); break; case Dialog.CANCEL: _fileSubsets.Remove(id); break; default: _fileSubsets.Remove(id); if (OnSelect != null) OnSelect(name, id, pressed); break; } }; }
public SaveDialog(IPrim prim, IPrimFactory factory, string toSave, string defaultName, Func<string, string> getFolder) { _defaultName = defaultName; _toSave = toSave; _getFolder = getFolder; dialog = new Dialog(prim, factory, SAVE, SAVE_AS, Dialog.CANCEL); dialog.ResponseReceived += (name, id, pressed, chatted) => { switch (pressed) { case SAVE: if (OnSave != null) OnSave(name, id, GetDefaultName(name)); break; case SAVE_AS: if (chatted == null) Show(name, id, true); else if (OnSave != null) OnSave(name, id, chatted); break; case Dialog.CANCEL: break; } }; }