Beispiel #1
0
        public bool CanAttachInputChannel(InputChannelMetadata c, InputListenerMetadata meta)
        {
            if (!meta.ID.ListenerID.Equals(ListenerID))
            {
                return(false);          // check if metadata belongs to me
            }
            var executor = meta.Parent; /* Meta should be one of Fader, Go,Stop,GoStop,Pause,Back,PauseBack,Select,Flash */

            if (meta.ID.MetadataID == ExecutorWindow_PGDn || meta.ID.MetadataID == ExecutorWindow_PGUp)
            {
                return(c.ChannelType == EInputChannelType.BUTTON);
            }
            if (meta.ID.MetadataID == GrandMasterValue)
            {
                return(c.ChannelType == EInputChannelType.RANGE);
            }
            if (!executorIds.Contains(executor.ID.MetadataID))
            {
                return(false);
            }
            switch (meta.Name)
            {
            case "Fader": return(c.ChannelType == EInputChannelType.RANGE);

            default: return(c.ChannelType == EInputChannelType.BUTTON);
            }
        }
Beispiel #2
0
        public InputLayerChangedCallback AttachInputChannel(InputChannelMetadata c, InputListenerMetadata meta)
        {
            if (meta.ID.MetadataID == ExecutorWindow_PGDn)
            {
                return (j, newValue) => { if (object.Equals(newValue, 1.0))
                                          {
                                              ExecutorWindowPgUp(false); return true;
                                          }
                                          return false; }
            }
            ;
            if (meta.ID.MetadataID == ExecutorWindow_PGUp)
            {
                return (j, newValue) => { if (object.Equals(newValue, 1.0))
                                          {
                                              ExecutorWindowPgUp(true); return true;
                                          }
                                          return false; }
            }
            ;
            if (meta.ID.MetadataID == ModifierKeyValue)
            {
                return (j, newValue) =>
                       {
                           if (object.Equals(newValue, 1.0))
                           {
                               modifierKey = true;
                               return true;
                           }
                           modifierKey = false;
                           return false;
                       }
            }
            ;
            if (meta.ID.MetadataID == GrandMasterValue)
            {
                return (j, newValue) =>
                       {
                           if (ConnectionManager.getInstance().Connected)
                           {
                               ICommand cmd = ConnectionManager.getInstance().GuiSession.getCommandInstance("Kernel", "setGrandMaster");
                               cmd.execute(new object[]
                        {
                            newValue
                        });
                               return true;
                           }
                           return false;
                       }
            }
            ;
            var executor = meta.Parent;
            var dynExc   = dynExecutors.FirstOrDefault(j => j.GUID == executor.ID.MetadataID);

            if (dynExc == null)
            {
                return(null);
            }
            return(dynExc.AttachInputChannel(c, meta));
        }
Beispiel #3
0
            public InputLayerChangedCallback AttachInputChannel(InputChannelMetadata c, InputListenerMetadata meta)
            {
                string metadataID = meta.ID.MetadataID;

                if (c.ChannelType == EInputChannelType.BUTTON)
                {
                    switch (metadataID)
                    {
                    case "Go":
                        return((id, newValue) =>
                        {
                            if (assignedExecutor != null && object.Equals(newValue, 1.0))
                            {
                                assignedExecutor.go();
                                return true;
                            }
                            return false;
                        });

                    case "Stop":
                        return((id, newValue) =>
                        {
                            if (assignedExecutor != null && object.Equals(newValue, 1.0))
                            {
                                assignedExecutor.stop();
                                return true;
                            }
                            return false;
                        });

                    case "GoStop":
                        return((id, newValue) =>
                        {
                            if (assignedExecutor != null)
                            {
                                if (object.Equals(newValue, 1.0))
                                {
                                    assignedExecutor.go();
                                    return true;
                                }
                                else if (object.Equals(newValue, 0.0))
                                {
                                    assignedExecutor.stop();
                                    return true;
                                }
                            }
                            return false;
                        });

                    case "Back":
                        return((id, newValue) =>
                        {
                            if (assignedExecutor != null && object.Equals(newValue, 1.0))
                            {
                                assignedExecutor.goBack();
                                return true;
                            }
                            return false;
                        });

                    case "Pause":
                        return((id, newValue) =>
                        {
                            if (assignedExecutor != null && object.Equals(newValue, 1.0))
                            {
                                assignedExecutor.go();
                                return true;
                            }
                            return false;
                        });

                    case "PauseBack":
                        return((id, newValue) =>
                        {
                            if (assignedExecutor != null && object.Equals(newValue, 1.0))
                            {
                                assignedExecutor.pauseBack();
                                return true;
                            }
                            return false;
                        });

                    case "Flash":
                        return((id, newValue) =>
                        {
                            if (assignedExecutor != null)
                            {
                                if (object.Equals(newValue, 1.0))
                                {
                                    assignedExecutor.flash(true);
                                    return true;
                                }
                                else if (object.Equals(newValue, 0.0))
                                {
                                    assignedExecutor.flash(false);
                                    return true;
                                }
                            }
                            return false;
                        });

                    case "Select":
                        return((id, newValue) =>
                        {
                            if (assignedExecutor != null)
                            {
                                if (object.Equals(newValue, 1.0))
                                {
                                    if (WindowManager.getInstance().StoreActive)
                                    {
                                        if (IsModifierKeyPressed() || assignedExecutor.HasOption(EExecutorOptions.SHOW__PROGRAMMER__FILTER))
                                        {
                                            ProgrammerFilterPredicate predicate;
                                            if (ProgrammerFilter.ShowFilter(out predicate))
                                            {
                                                assignedExecutor.storeProgrammerAtExecutor(assignedExecutor.SceneCount, predicate);
                                            }
                                            return false;
                                        }
                                        else
                                        {
                                            assignedExecutor.storeProgrammerAtExecutor(assignedExecutor.SceneCount, null);
                                        }
                                        WindowManager.getInstance().ElementStored();
                                    }
                                    else
                                    {
                                        SceneListWindowManager.getInstance().openSceneList(assignedExecutor.SceneList, IsModifierKeyPressed());
                                        return true;
                                    }
                                }
                            }
                            return false;
                        });

                    default:
                        return(null);
                    }
                }
                else if (c.ChannelType == EInputChannelType.RANGE)
                {
                    if (metadataID == "Fader")
                    {
                        return (id, newValue) =>
                               {
                                   if (assignedExecutor != null)
                                   {
                                       if (Tolerance <= 0 || Math.Abs((double)assignedExecutor.FaderValue - (double)newValue) < Tolerance) //toleranz ggf. abschaltbar machen pro dynamic
                                       {
                                           assignedExecutor.FaderValue = (double)newValue;
                                       }
                                       return true;
                                   }
                                   return false;
                               }
                    }
                    ;
                    else if (metadataID == "Timing")
                    {
                        return (id, newValue) =>
                               {
                                   if (assignedExecutor != null)
                                   {
                                       //FIXME
                                       return true;
                                   }
                                   return false;
                               }
                    }
                    ;
                }

                return(null);
            }
Beispiel #4
0
 public void DetachInputChannel(InputChannelMetadata c, InputListenerMetadata meta)
 {
     /* Nothing to do here */
 }