PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Mercurial.Net/Gui/LogGuiCommand.cs

#
C# | 63 lines | 31 code | 5 blank | 27 comment | 0 complexity | 06df19b77db284f334166a05ba1b2aec MD5 | raw file
 1using System.ComponentModel;
 2using Mercurial.Attributes;
 3
 4namespace Mercurial.Gui
 5{
 6    /// <summary>
 7    /// Implements the TortoiseHg "log" command (<see href="http://tortoisehg.bitbucket.org/manual/2.0/workbench.html#from-command-line"/>):
 8    /// Repository explorer (changelog viewer.)
 9    /// </summary>
10    public sealed class LogGuiCommand : GuiCommandBase<LogGuiCommand>
11    {
12        /// <summary>
13        /// This is the backing field for the <see cref="File"/> property.
14        /// </summary>
15        private string _File = string.Empty;
16
17        /// <summary>
18        /// Initializes a new instance of the <see cref="LogGuiCommand"/> class.
19        /// </summary>
20        public LogGuiCommand()
21            : base("log")
22        {
23            // Do nothing here
24        }
25
26        /// <summary>
27        /// Gets or sets which file to show the log for.
28        /// </summary>
29        [NullableArgument]
30        [DefaultValue("")]
31        public string File
32        {
33            get
34            {
35                return _File;
36            }
37
38            set
39            {
40                _File = (value ?? string.Empty).Trim();
41            }
42        }
43
44        /// <summary>
45        /// Sets the <see cref="File"/> property to the specified value and
46        /// returns this <see cref="LogGuiCommand"/> instance.
47        /// </summary>
48        /// <param name="value">
49        /// The new value for the <see cref="File"/> property.
50        /// </param>
51        /// <returns>
52        /// This <see cref="LogGuiCommand"/> instance.
53        /// </returns>
54        /// <remarks>
55        /// This method is part of the fluent interface.
56        /// </remarks>
57        public LogGuiCommand WithFile(string value)
58        {
59            File = value;
60            return this;
61        }
62    }
63}