Changeset 2761


Ignore:
Timestamp:
7/2/2012 7:38:10 AM (22 months ago)
Author:
lowjoel
Message:

Change the Service project type to a Windows application, and run the Service without a Console window.

Location:
branches/eraser6/EraserService
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/EraserService/Eraser.Service/Eraser.Service.csproj

    r2743 r2761  
    77    <SchemaVersion>2.0</SchemaVersion> 
    88    <ProjectGuid>{62840616-03D1-45E8-A29B-A8EDF883A32E}</ProjectGuid> 
    9     <OutputType>Exe</OutputType> 
     9    <OutputType>WinExe</OutputType> 
    1010    <AppDesignerFolder>Properties</AppDesignerFolder> 
    1111    <RootNamespace>Eraser.Service</RootNamespace> 
     
    1515    </TargetFrameworkProfile> 
    1616    <FileAlignment>512</FileAlignment> 
    17     <SignAssembly>true</SignAssembly> 
     17    <SignAssembly>true</SignAssembly> 
    1818    <AssemblyOriginatorKeyFile>..\Strong Name.snk</AssemblyOriginatorKeyFile> 
    1919  </PropertyGroup> 
     
    6969    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules> 
    7070  </PropertyGroup> 
     71  <PropertyGroup> 
     72    <StartupObject /> 
     73  </PropertyGroup> 
    7174  <ItemGroup> 
     75    <Reference Include="CommonLibrary, Version=0.9.7.4, Culture=neutral, PublicKeyToken=3ac89a0351e689b6, processorArchitecture=MSIL"> 
     76      <HintPath>..\Dependencies\CommonLibrary.dll</HintPath> 
     77    </Reference> 
    7278    <Reference Include="System" /> 
    7379    <Reference Include="System.Core" /> 
     80    <Reference Include="System.Windows.Forms" /> 
    7481    <Reference Include="System.Xml.Linq" /> 
    7582    <Reference Include="System.Data.DataSetExtensions" /> 
    76     <Reference Include="Microsoft.CSharp" /> 
    7783    <Reference Include="System.Data" /> 
    7884    <Reference Include="System.Xml" /> 
  • branches/eraser6/EraserService/Eraser.Service/Program.cs

    r2754 r2761  
    2727using System.IO; 
    2828 
     29using ComLib.Arguments; 
     30 
    2931using Eraser.Manager; 
    3032using Eraser.Plugins; 
     33using System.Windows.Forms; 
    3134 
    3235namespace Eraser.Service 
    3336{ 
     37    /// <summary> 
     38    /// Program arguments which only apply to the Eraser Service. 
     39    /// </summary> 
     40    class ServiceArguments 
     41    { 
     42        /// <summary> 
     43        /// True if the command line specified atRestart, which should result in the 
     44        /// queueing of tasks meant for running at restart. 
     45        /// </summary> 
     46        [Arg("atRestart", "r", "The program should queue all tasks scheduled for " + 
     47            "running at the system restart.", typeof(bool), false, false)] 
     48        public bool AtRestart { get; set; } 
     49    } 
     50 
    3451    public class Program 
    3552    { 
    3653        static void Main(string[] args) 
    3754        { 
     55            //Parse the command line arguments 
     56            ServiceArguments arguments = new ServiceArguments(); 
     57            Args.Parse(args, CommandLinePrefixes, CommandLineSeparators, arguments); 
     58             
    3859            using (ManagerLibrary library = new ManagerLibrary(Settings.Get())) 
    3960            { 
     
    6889                    } 
    6990 
     91                    //Queue tasks meant for running at restart if we are given that command line. 
     92                    if (arguments.AtRestart) 
     93                        eraserClient.QueueRestartTasks(); 
     94 
    7095                    //Run the eraser client. 
    7196                    eraserClient.Run(); 
    72  
    73                     Console.ReadKey(); 
     97                    Application.Run(); 
    7498 
    7599                    //Save the task list 
     
    106130        /// </summary> 
    107131        public const string SettingsPath = @"SOFTWARE\Eraser\Eraser 6"; 
     132 
     133        /// <summary> 
     134        /// The acceptable list of command line prefixes we will accept. 
     135        /// </summary> 
     136        public const string CommandLinePrefixes = "^(/|-|--)"; 
     137 
     138        /// <summary> 
     139        /// The acceptable list of command line separators we will accept. 
     140        /// </summary> 
     141        public const string CommandLineSeparators = "(:|=)"; 
    108142    } 
    109143} 
  • branches/eraser6/EraserService/Eraser/Program.cs

    r2753 r2761  
    6262        } 
    6363 
    64         /// <summary> 
    65         /// Program arguments which only apply to the GUI program. 
    66         /// </summary> 
    67         class GuiArguments : Arguments 
    68         { 
    69             /// <summary> 
    70             /// True if the command line specified atRestart, which should result in the 
    71             /// queueing of tasks meant for running at restart. 
    72             /// </summary> 
    73             [Arg("atRestart",  "r", "The program should queue all tasks scheduled for " + 
    74                 "running at the system restart.", typeof(bool), false, false)] 
    75             public bool AtRestart { get; set; } 
    76         } 
    77  
    7864        class ConsoleArguments : Arguments 
    7965        { 
     
    679665 
    680666            //Decide whether to display any UI. 
    681             GuiArguments arguments = new GuiArguments(); 
     667            Arguments arguments = new Arguments(); 
    682668            Args.Parse(program.CommandLine, CommandLinePrefixes, CommandLineSeparators, arguments); 
    683             e.ShowMainForm = !arguments.AtRestart && !arguments.Quiet; 
    684  
    685             //Queue tasks meant for running at restart if we are given that command line. 
    686             if (arguments.AtRestart) 
    687                 eraserClient.QueueRestartTasks(); 
     669            e.ShowMainForm = !arguments.Quiet; 
    688670 
    689671            //Run the eraser client. 
     
    731713        /// The acceptable list of command line prefixes we will accept. 
    732714        /// </summary> 
    733         public const string CommandLinePrefixes = "^(/|-|--)"; 
     715        [Obsolete] 
     716        public const string CommandLinePrefixes = Service.Program.CommandLinePrefixes; 
    734717 
    735718        /// <summary> 
    736719        /// The acceptable list of command line separators we will accept. 
    737720        /// </summary> 
    738         public const string CommandLineSeparators = "(:|=)"; 
     721        [Obsolete] 
     722        public const string CommandLineSeparators = Service.Program.CommandLineSeparators; 
    739723 
    740724        /// <summary> 
Note: See TracChangeset for help on using the changeset viewer.