Exemplo n.º 1
0
        void UpdateConnectorVisibility()
        {
            SF_NodeConnector z = GetConnectorByID("Z");
            SF_NodeConnector w = GetConnectorByID("W");

            if (!useAsFloat4)
            {
                if (z.IsConnected())
                {
                    for (int i = 0; i < z.outputCons.Count; i++)
                    {
                        Undo.RecordObject(z.outputCons[i], "disconnect");
                    }
                    Undo.RecordObject(z, "disconnect");
                    z.Disconnect();
                }
                if (w.IsConnected())
                {
                    for (int i = 0; i < w.outputCons.Count; i++)
                    {
                        Undo.RecordObject(w.outputCons[i], "disconnect");
                    }
                    Undo.RecordObject(w, "disconnect");
                    w.Disconnect();
                }
            }
            EnableState enableState = useAsFloat4 ? EnableState.Enabled : EnableState.Disabled;

            z.enableState = enableState;
            w.enableState = enableState;
        }
Exemplo n.º 2
0
    //------------------------------------------------------------------------------------------
    // イベントの開始
    //------------------------------------------------------------------------------------------
    public void StartEvent()
    {
        enableState = EnableState.True;
        time        = 0.0f;

        startEvents.Invoke();
    }
        // Event handler for when the enable buttons are clicked.
        private void EnableStateClick(object Sender, RoutedEventArgs Args)
        {
            // Set the border, depending on selection.
            EnableButton.BorderBrush  = ((Button)Sender).Name == "EnableButton" ? Brushes.Black : Brushes.DimGray;
            DisableButton.BorderBrush = ((Button)Sender).Name == "EnableButton" ? Brushes.DimGray : Brushes.Black;

            // Set the robot state too.
            RobotEnableState = ((Button)Sender).Name == "EnableButton" ? EnableState.Enable : EnableState.Disable;
        }
Exemplo n.º 4
0
            private EnableState GetEnableState(string category)
            {
                EnableState result;

                if (!EnableStates.TryGetValue(category, out result))
                {
                    EnableStates[category] = result = new EnableState();
                }
                return(result);
            }
Exemplo n.º 5
0
        internal static string ToSerializedValue(this EnableState value)
        {
            switch (value)
            {
            case EnableState.Enabled:
                return("Enabled");

            case EnableState.Disabled:
                return("Disabled");
            }
            return(null);
        }
Exemplo n.º 6
0
        public void SetVisChildVisible(bool visible)
        {
            if (visControlChild == null)
            {
                return;
            }

            EnableState targetState = visible ? EnableState.Enabled : EnableState.Hidden;

            if (visControlChild.enableState == targetState)
            {
                return;                 // Don't do anything if unchanged
            }
            if (!visible)
            {
                visControlChild.Disconnect(true, false);                // Disconnect if it goes invisible when linked
            }

            visControlChild.enableState = targetState;
        }
Exemplo n.º 7
0
 public static extern EnableState Enable(IntPtr session, EnableState bEnable);
Exemplo n.º 8
0
        /// <summary>
        /// Convenience attached method to create a new session for current database connection,
        /// attach specified table or all tables,
        /// and optionally enable watching for changes
        /// </summary>
        /// <param name="db">open SQLite database handle</param>
        /// <param name="zDb">which db to attach session to, e.g. main or temp</param>
        /// <param name="session">returns session handle on successful call</param>
        /// <param name="zTab">which table to watch, use null for all; defaults to null</param>
        /// <param name="bEnable">default is EnableState.EnableSession to begin watching for changes</param>
        /// <returns>Result.OK if successful, otherwise corresponding error code</returns>
        public static Result CreateSessionAndAttachTable(this SQLite.SQLiteConnection db, string zDb, out IntPtr session, string zTab = null, EnableState bEnable = EnableState.EnableSession)
        {
            // create a session for "zDb" database
            var result = Create(db, zDb, out session);

            if (result != Result.OK)
            {
                return(result);
            }

            // attach table
            // if null then attach to all tables [within db specified when session created]
            result = AttachToTable(session, zTab);
            if (result != Result.OK)
            {
                return(result);
            }

            // enable watching for changes with this session
            if (Enable(session, bEnable) != bEnable)
            {
                return(Result.Error);
            }

            return(result);
        }
Exemplo n.º 9
0
 public static extern void glEnable(EnableState cap);
Exemplo n.º 10
0
 public static bool IsEnabled(EnableState cap)
 {
     return Delegates.glIsEnabled(cap);
 }
Exemplo n.º 11
0
 /// <summary>
 /// enable or disable server-side GL capabilities
 /// </summary>
 /// <param name="cap">pecifies a symbolic constant indicating a GL capability.</param>
 /// <remarks>glEnable and glDisable enable and disable various capabilities. Use glIsEnabled or glGet to determine the current setting of any capability. The initial value for each capability with the exception of GL_DITHER and GL_MULTISAMPLE is GL_FALSE. The initial value for GL_DITHER and GL_MULTISAMPLE is GL_TRUE.</remarks>
 public static void Enable(EnableState cap)
 {
     Delegates.glEnable(cap);
 }
Exemplo n.º 12
0
 public static extern bool glIsEnabled(EnableState cap);
Exemplo n.º 13
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="EnableState" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => EnableState.CreateFrom(sourceValue);
Exemplo n.º 14
0
    //------------------------------------------------------------------------------------------
    // イベントの終了
    //------------------------------------------------------------------------------------------
    public void EndEvent()
    {
        enableState = (once ? EnableState.End : EnableState.False);

        endEvents.Invoke();
    }
Exemplo n.º 15
0
        /// <summary>
        /// Enable or disable a device.
        /// </summary>
        /// <param name="classGuid">The class guid of the device. Available in the device manager.</param>
        /// <param name="instanceId">The device instance id of the device. Available in the device manager.</param>
        /// <param name="enable">True to enable, False to disable.</param>
        /// <param name="matchType">Indicates whether the instanceId must have an exact or a partial match to have its enabled state changed.</param>
        /// <remarks>Will throw an exception if the device is not Disableable.</remarks>
        public static void SetDeviceEnabled(Guid classGuid, string instanceId, EnableState enable, MatchType matchType = MatchType.Exact)
        {
            SafeDeviceInfoSetHandle diSetHandle = null;
            try
            {
                // Get the handle to a device information set for all devices matching classGuid that are present on the
                // system.
                diSetHandle = NativeMethods.SetupDiGetClassDevs(ref classGuid, null, IntPtr.Zero, SetupDiGetClassDevsFlags.Present);
                // Get the device information data for each matching device.
                DeviceInfoData[] diData = GetDeviceInfoData(diSetHandle);

                if (matchType == MatchType.Exact)
                {
                    int index = GetIndexOfInstance(diSetHandle, diData, instanceId);
                    // Disable...
                    EnableDevice(diSetHandle, diData[index], enable == EnableState.Enable);
                }
                else
                {
                    foreach (DeviceInfoData data in diData)
                    {
                        if (GetInstanceMatch(diSetHandle, data, instanceId))
                        {
                            EnableDevice(diSetHandle, data, enable == EnableState.Enable);
                        }
                    }
                }
            }
            finally
            {
                if (diSetHandle?.IsClosed == false)
                {
                    diSetHandle.Close();
                }

                diSetHandle?.Dispose();
            }
        }