예제 #1
0
 private static void GUIMain(string[] commandLine)
 {
     using (GUIProgram program = new GUIProgram(commandLine, "Eraser-BAD0DAC6-C9EE-4acc-" +
     "8701-C9B3C64BC65E-GUI-" +
     System.Security.Principal.WindowsIdentity.GetCurrent().User.ToString()))
        using (ManagerLibrary library = new ManagerLibrary(new Settings()))
        {
     program.InitInstance += OnGUIInitInstance;
     program.NextInstance += OnGUINextInstance;
     program.ExitInstance += OnGUIExitInstance;
     program.Run();
        }
 }
예제 #2
0
        private static void GUIMain(string[] commandLine)
        {
            string instanceId = "Eraser-BAD0DAC6-C9EE-4acc-8701-C9B3C64BC65E-GUI-" +
            WindowsIdentity.GetCurrent().User.ToString();

               using (GuiProgram program = new GuiProgram(commandLine, instanceId))
               using (ManagerLibrary library = new ManagerLibrary(new Settings()))
               {
            program.InitInstance += OnGUIInitInstance;
            program.NextInstance += OnGUINextInstance;
            program.ExitInstance += OnGUIExitInstance;
            program.Run();
               }
        }
예제 #3
0
 private static int CommandMain(string[] commandLine)
 {
     bool isQuiet = false;
        try
        {
     CommandLineProgram program = new CommandLineProgram(commandLine);
     isQuiet = program.Arguments.Quiet;
     using (ManagerLibrary library = new ManagerLibrary(new Settings()))
      program.Run();
     return 0;
        }
        catch (UnauthorizedAccessException)
        {
     return 5;
        }
        catch (Win32Exception e)
        {
     Console.WriteLine(e.Message);
     return e.ErrorCode;
        }
        catch (Exception e)
        {
     Console.WriteLine(e.Message);
     return 1;
        }
        finally
        {
     Console.Out.Flush();
     if (!isQuiet)
     {
      Console.Write("\nPress enter to continue . . . ");
      Console.Out.Flush();
      Console.ReadLine();
     }
     KernelApi.FreeConsole();
        }
 }
예제 #4
0
 private static int CommandMain(string[] commandLine)
 {
     using (ConsoleProgram program = new ConsoleProgram(commandLine))
        using (ManagerLibrary library = new ManagerLibrary(new Settings()))
     try
     {
      program.Handlers.Add("help",
       new ConsoleActionData(CommandHelp, new ConsoleArguments()));
      program.Handlers.Add("querymethods",
       new ConsoleActionData(CommandQueryMethods, new ConsoleArguments()));
      program.Handlers.Add("addtask",
       new ConsoleActionData(CommandAddTask, new AddTaskArguments()));
      program.Handlers.Add("importtasklist",
       new ConsoleActionData(CommandImportTaskList, new ConsoleArguments()));
      program.Run();
      return 0;
     }
     catch (UnauthorizedAccessException)
     {
      return Win32ErrorCode.AccessDenied;
     }
     catch (Win32Exception e)
     {
      Console.WriteLine(e.Message);
      return e.ErrorCode;
     }
     catch (Exception e)
     {
      Console.WriteLine(e.Message);
      return 1;
     }
 }