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.RegularExpressions;
using System.Threading;
using System.Xml;
#if __MonoCS__
using Mono.Unix;
#endif
using SparkleLib;
namespace SparkleShare {
@ -1138,11 +1134,7 @@ namespace SparkleShare {
repo.Dispose ();
}
#if __MonoCS__
Environment.Exit (0);
#else
System.Windows.Forms.Application.Exit();
#endif
}

View file

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

View file

@ -159,5 +159,10 @@ namespace SparkleShare {
{
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 () {
Content = "Continue",
IsEnabled = false
@ -112,6 +117,7 @@ namespace SparkleShare {
Canvas.SetTop (email_box, 230);
Buttons.Add (continue_button);
Buttons.Add (cancel_button);
Controller.UpdateSetupContinueButtonEvent += delegate (bool enabled) {
@ -128,6 +134,13 @@ namespace SparkleShare {
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 {
Controller.SetupPageCompleted (name_box.Text, email_box.Text);
};
@ -371,13 +384,25 @@ namespace SparkleShare {
// TODO: Bullet points
Button try_again_button = new Button () {
Content = "Try again…"
Button cancel_button = new Button () {
Content = "Cancel"
};
Button try_again_button = new Button () {
Content = "Try again…"
};
Buttons.Add (try_again_button);
Buttons.Add (cancel_button);
try_again_button.Click += delegate {
cancel_button.Click += delegate {
Controller.PageCancelled ();
};
try_again_button.Click += delegate {
Controller.ErrorPageCompleted ();
};

View file

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