public void GoTo(VobInst guided, VobInst target) { // find out if there already is an existing, similar guide-command // and recycle it if possible before assigning a new one (costly on client-side) if (guideCommandByVobInst.TryGetValue(guided, out GuideCommandInfo oldInfo)) { if (oldInfo.GuideCommand.CmdType == (byte)CommandType.GoToVob) { if (((GoToVobCommand)oldInfo.GuideCommand).Target.Equals(target)) { oldInfo.UpdateInfo(oldInfo.GuideCommand, oldInfo.GuidedVobInst, DateTime.MaxValue); return; } } } // initialize new guide and remove old one from GUC-memory automatically GoToVobCommand cmd = new GoToVobCommand(target); guided.BaseInst.SetGuideCommand(cmd); // replace possible old guide from script-memory or insert new value GuideCommandInfo info = new GuideCommandInfo(cmd, guided); SubscribeGuideCommand(info); }
protected void UnsubscribeGuideCommand(GuideCommandInfo guideCmdInfo) { guideCommandByVobInst.Remove(guideCmdInfo.GuidedVobInst); }
protected void SubscribeGuideCommand(GuideCommandInfo guideCmdInfo) { guideCommandByVobInst[guideCmdInfo.GuidedVobInst] = guideCmdInfo; }