/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/powerdisplay/PowerDisplay.Lib/Models/MonitorOperationResult.cs
58 строк
2 KB
moooyo
Introduce new utility PowerDisplay to control your monitor settings (#42642)
03 фев 2026, 08:53
Не верифицирован
03 фев 2026, 08:53
18efa05
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; namespace PowerDisplay.Common.Models { /// <summary> /// Monitor operation result /// </summary> public readonly struct MonitorOperationResult { /// <summary> /// Gets a value indicating whether the operation was successful /// </summary> public bool IsSuccess { get; } /// <summary> /// Gets error message /// </summary> public string? ErrorMessage { get; } /// <summary> /// Gets system error code /// </summary> public int? ErrorCode { get; } /// <summary> /// Gets operation timestamp /// </summary> public DateTime Timestamp { get; } private MonitorOperationResult(bool isSuccess, string? errorMessage = null, int? errorCode = null) { IsSuccess = isSuccess; ErrorMessage = errorMessage; ErrorCode = errorCode; Timestamp = DateTime.Now; } /// <summary> /// Creates a successful result /// </summary> public static MonitorOperationResult Success() => new(true); /// <summary> /// Creates a failed result /// </summary> public static MonitorOperationResult Failure(string errorMessage, int? errorCode = null) => new(false, errorMessage, errorCode); public override string ToString() { return IsSuccess ? "Success" : $"Failed: {ErrorMessage}"; } } }