Ejemplo n.º 1
0
        /// <summary>
        /// The Memory Low event callback function.
        /// </summary>
        /// <param name="source">The application instance.</param>
        /// <param name="e">The event argument for MemoryLow.</param>
        private void OnMemoryLow(object source, NUIApplicationMemoryLowEventArgs e)
        {
            Log.Info("NUI", "NUICorebackend OnMemoryLow Called");
            var handler = Handlers[EventType.LowMemory] as Action <LowMemoryEventArgs>;

            switch (e.MemoryStatus)
            {
            case Application.MemoryStatus.Normal:
            {
                handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.None));
                break;
            }

            case Application.MemoryStatus.Low:
            {
                handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.SoftWarning));
                break;
            }

            case Application.MemoryStatus.CriticallyLow:
            {
                handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.HardWarning));
                break;
            }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Memory Low event callback function.
        /// </summary>
        /// <param name="source">Application instance</param>
        /// <param name="e">Event argument for MemoryLow</param>
        private void OnMemoryLow(object source, NUIApplicationMemoryLowEventArgs e)
        {
            Log.Debug("NUI", "NUIWatchCorebackend OnMemoryLow Called");
            var handler = Handlers[EventType.LowMemory] as Action <LowMemoryEventArgs>;

            // Need to make new signal return in native to return right value.
            handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.None));
        }
Ejemplo n.º 3
0
        // Callback for Application MemoryLowSignal
        private void OnNUIApplicationMemoryLow(MemoryStatus status)
        {
            lock (this)
            {
                NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();

                // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
                e.MemoryStatus = status;
                _applicationMemoryLowEventHandler?.Invoke(this, e);
            }
        }