windows: add cancel buttons to Setup and Add pages

This commit is contained in:
Hylke Bons 2012-03-07 02:26:52 +00:00
parent b4a1b49a8b
commit d2cb17a4b3
5 changed files with 41 additions and 17 deletions

View file

@ -25,11 +25,7 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Xml;
#if __MonoCS__
using Mono.Unix;
#endif
using SparkleLib; using SparkleLib;
namespace SparkleShare { namespace SparkleShare {
@ -1138,11 +1134,7 @@ namespace SparkleShare {
repo.Dispose (); repo.Dispose ();
} }
#if __MonoCS__
Environment.Exit (0); Environment.Exit (0);
#else
System.Windows.Forms.Application.Exit();
#endif
} }

View file

@ -204,6 +204,12 @@ namespace SparkleShare {
} }
public void SetupPageCancelled ()
{
Program.Controller.Quit ();
}
public void SetupPageCompleted (string full_name, string email) public void SetupPageCompleted (string full_name, string email)
{ {
Program.Controller.UserName = full_name; Program.Controller.UserName = full_name;
@ -449,9 +455,6 @@ namespace SparkleShare {
public void ErrorPageCompleted () public void ErrorPageCompleted ()
{ {
if (ChangePageEvent == null)
return;
if (PendingInvite != null) if (PendingInvite != null)
ChangePageEvent (PageType.Invite, null); ChangePageEvent (PageType.Invite, null);
else else

View file

@ -159,5 +159,10 @@ namespace SparkleShare {
{ {
Program.Controller.ShowAboutWindow (); Program.Controller.ShowAboutWindow ();
} }
public void QuitClicked ()
{
Program.Controller.Quit ();
}
} }
} }

View file

@ -89,6 +89,11 @@ namespace SparkleShare {
}; };
Button cancel_button = new Button () {
Content = "Cancel"
};
Button continue_button = new Button () { Button continue_button = new Button () {
Content = "Continue", Content = "Continue",
IsEnabled = false IsEnabled = false
@ -112,6 +117,7 @@ namespace SparkleShare {
Canvas.SetTop (email_box, 230); Canvas.SetTop (email_box, 230);
Buttons.Add (continue_button); Buttons.Add (continue_button);
Buttons.Add (cancel_button);
Controller.UpdateSetupContinueButtonEvent += delegate (bool enabled) { Controller.UpdateSetupContinueButtonEvent += delegate (bool enabled) {
@ -128,6 +134,13 @@ namespace SparkleShare {
Controller.CheckSetupPage (name_box.Text, email_box.Text); Controller.CheckSetupPage (name_box.Text, email_box.Text);
}; };
cancel_button.Click += delegate {
Dispatcher.Invoke ((Action) delegate {
SparkleUI.StatusIcon.Dispose ();
Controller.SetupPageCancelled ();
});
};
continue_button.Click += delegate { continue_button.Click += delegate {
Controller.SetupPageCompleted (name_box.Text, email_box.Text); Controller.SetupPageCompleted (name_box.Text, email_box.Text);
}; };
@ -371,11 +384,23 @@ namespace SparkleShare {
// TODO: Bullet points // TODO: Bullet points
Button cancel_button = new Button () {
Content = "Cancel"
};
Button try_again_button = new Button () { Button try_again_button = new Button () {
Content = "Try again…" Content = "Try again…"
}; };
Buttons.Add (try_again_button); Buttons.Add (try_again_button);
Buttons.Add (cancel_button);
cancel_button.Click += delegate {
Controller.PageCancelled ();
};
try_again_button.Click += delegate { try_again_button.Click += delegate {
Controller.ErrorPageCompleted (); Controller.ErrorPageCompleted ();

View file

@ -17,7 +17,6 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@ -213,7 +212,7 @@ namespace SparkleShare {
this.exit_item.Click += delegate { this.exit_item.Click += delegate {
this.notify_icon.Dispose (); this.notify_icon.Dispose ();
Program.Controller.Quit (); Controller.QuitClicked ();
}; };