Skip to content

Commit

Permalink
Merge pull request #82 from KSP-CKAN/unified_client
Browse files Browse the repository at this point in the history
`ckan gui` or `ckan` (no args) will now start the GUI.
  • Loading branch information
pjf committed Oct 17, 2014
2 parents d3e5bb0 + fc8ad9c commit c5ed1c3
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
17 changes: 17 additions & 0 deletions CKAN/CKAN.sln
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ Global
$0.DotNetNamingPolicy = $2
$2.DirectoryNamespaceAssociation = None
$2.ResourceNamePolicy = FileFormatDefault
$0.TextStylePolicy = $3
$3.inheritsSet = null
$3.scope = text/x-csharp
$0.CSharpFormattingPolicy = $4
$4.ElseIfNewLinePlacement = SameLine
$4.AfterDelegateDeclarationParameterComma = True
$4.inheritsSet = Mono
$4.inheritsScope = text/x-csharp
$4.scope = text/x-csharp
$0.TextStylePolicy = $5
$5.NoTabsAfterNonTabs = True
$5.inheritsSet = VisualStudio
$5.inheritsScope = text/plain
$5.scope = text/plain
$0.StandardHeader = $6
$6.Text =
$6.IncludeInNewFiles = True
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 4 additions & 0 deletions CKAN/CmdLine/CmdLine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,9 @@
<Project>{3B9AEA22-FA3B-4E43-9283-EABDD81CF271}</Project>
<Name>CKAN</Name>
</ProjectReference>
<ProjectReference Include="..\GUI\CKAN-GUI.csproj">
<Project>{A79F9D54-315C-472B-928F-713A5860B2BE}</Project>
<Name>CKAN-GUI</Name>
</ProjectReference>
</ItemGroup>
</Project>
23 changes: 23 additions & 0 deletions CKAN/CmdLine/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ public static int Main (string[] args) {
LogManager.GetRepository ().Threshold = Level.Warn;
log.Debug ("CKAN started");

// If we're starting with no options, invoke the GUI instead.

if (args.Length == 0) {
return Gui ();
}

Options cmdline;

try {
Expand Down Expand Up @@ -73,6 +79,9 @@ public static int Main (string[] args) {

switch (cmdline.action) {

case "gui":
return Gui();

case "version":
return Version ();

Expand Down Expand Up @@ -110,6 +119,16 @@ public static int Main (string[] args) {
}
}

static int Gui() {

// TODO: Sometimes when the GUI exits, we get a System.ArgumentException,
// but trying to catch it here doesn't seem to help. Dunno why.

GUI.Main ();

return EXIT_OK;
}

static int Version() {

// SeriouslyLongestClassNamesEverThanksMicrosoft
Expand Down Expand Up @@ -315,6 +334,9 @@ public Options( string[] args) {
// TODO: Figure out how to do per action help screens.

class Actions {
[VerbOption("gui", HelpText = "Start the CKAN GUI")]
public GuiOptions GuiOptions { get; set; }

[VerbOption("update", HelpText = "Update list of available mods")]
public UpdateOptions Update { get; set; }

Expand Down Expand Up @@ -390,6 +412,7 @@ class ListOptions : CommonOptions { }
class VersionOptions : CommonOptions { }
class CleanOptions : CommonOptions { }
class AvailableOptions : CommonOptions { }
class GuiOptions : CommonOptions { }

class UpdateOptions : CommonOptions {

Expand Down
4 changes: 2 additions & 2 deletions CKAN/GUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
namespace CKAN
{

static class Program
public static class GUI
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
public static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Expand Down

0 comments on commit c5ed1c3

Please sign in to comment.