Hourglass.Timing.TimerOptions.ToTimerOptionsInfo C# (CSharp) Method

ToTimerOptionsInfo() public method

Returns the representation of the TimerOptions used for XML serialization.
public ToTimerOptionsInfo ( ) : TimerOptionsInfo
return Hourglass.Serialization.TimerOptionsInfo
        public TimerOptionsInfo ToTimerOptionsInfo()
        {
            return new TimerOptionsInfo
            {
                Title = this.title,
                AlwaysOnTop = this.alwaysOnTop,
                PromptOnExit = this.promptOnExit,
                DoNotKeepComputerAwake = this.doNotKeepComputerAwake,
                ShowTimeElapsed = this.showTimeElapsed,
                LoopTimer = this.loopTimer,
                PopUpWhenExpired = this.popUpWhenExpired,
                CloseWhenExpired = this.closeWhenExpired,
                ShutDownWhenExpired = this.shutDownWhenExpired,
                ThemeIdentifier = this.theme?.Identifier,
                SoundIdentifier = this.sound?.Identifier,
                LoopSound = this.loopSound,
                WindowTitleMode = this.windowTitleMode,
                WindowSize = WindowSizeInfo.FromWindowSize(this.windowSize)
            };
        }

Usage Example

        /// <summary>
        /// Returns a <see cref="TimerOptionsInfo"/> for the specified <see cref="TimerOptions"/>.
        /// </summary>
        /// <param name="options">A <see cref="TimerOptions"/>.</param>
        /// <returns>A <see cref="TimerOptionsInfo"/> for the specified <see cref="TimerOptions"/>.</returns>
        public static TimerOptionsInfo FromTimerOptions(TimerOptions options)
        {
            if (options == null)
            {
                return null;
            }

            return options.ToTimerOptionsInfo();
        }