示例#1
0
        public void RaiseChanges()
        {
            try
            {
                var pi = new PerformanceInformation();
                if (PsApi.GetPerformanceInfo(out pi, Marshal.SizeOf(pi)))
                {
                    this.Free  = Convert.ToInt64(pi.PhysicalAvailable.ToInt64() * pi.PageSize.ToInt64());
                    this.Total = Convert.ToInt64(pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64());
                }
            }
            catch (Exception ex)
            {
                this.logger.LogWarning(ex, "Error on resolving ram info.");
            }

            this.Info = this.format.GetFormatedString(this.Total, this.Free);

            this.RaisePropertyChanged(nameof(this.Total));
            this.RaisePropertyChanged(nameof(this.Free));
            this.RaisePropertyChanged(nameof(this.Info));
            this.RaisePropertyChanged(nameof(this.Value));
        }
#pragma warning disable 618
        public void PerformanceInformation() => PsApi.GetPerformanceInfo(out _);