Beispiel #1
0
    void Start()
    {
        // set rawimage to file's icon
        rawImage         = GetComponent <RawImage>();
        rawImage.texture = File.icon;

        // dynamically add OSEvents event as listener-
        // since icons can't be baked into the UI, and will be instantiated at runtime,
        // can't statically set the function for OnClick to call
        button = GetComponent <Button>();
        button.onClick.AddListener(delegate { OSEvents.InputIconClicked(File); });
    }
Beispiel #2
0
        internal static OSEvents Handle(ref System.Windows.Forms.Message m)
        {
            OSEvents osevent = OSEvents.None;

            switch (m.Msg)
            {
            case WM_POWERBROADCAST:
                switch (m.WParam.ToInt32())
                {
                //value passed when system is going on standby / suspended
                case PBT_APMQUERYSUSPEND:
                    osevent = OSEvents.StandbyStarted;
                    break;

                //value passed when system is resumed after suspension.
                case PBT_APMRESUMESUSPEND:
                    osevent = OSEvents.StandbyEnd;
                    break;

                    ////value passed when system Suspend Failed
                    //case (PBT_APMQUERYSUSPENDFAILED):
                    ////value passed when system is suspended
                    //case (PBT_APMSUSPEND):
                    ////value passed when system is resumed automatically
                    //case (PBT_APMRESUMEAUTOMATIC):
                    ////value passed when system is resumed from critical
                    ////suspension possibly due to battery failure
                    //case (PBT_APMRESUMECRITICAL):
                    ////value passed when system is low on battery
                    //case (PBT_APMBATTERYLOW):
                    ////value passed when system power status changed
                    ////from battery to AC power or vice-a-versa
                    //case (PBT_APMPOWERSTATUSCHANGE):
                    ////value passed when OEM Event is fired. Not sure what that is??
                    //case (PBT_APMOEMEVENT):
                    //    break;
                }
                break;

            default:
                break;
            }

            return(osevent);
        }