[intro] implement even more

This commit is contained in:
Hylke Bons 2011-02-08 23:46:42 +00:00
parent d9c9c38d53
commit c343f849db
4 changed files with 60 additions and 14 deletions

View file

@ -36,6 +36,7 @@ namespace SparkleShare {
private NSButton OpenFolderButton; private NSButton OpenFolderButton;
private NSButton FinishButton; private NSButton FinishButton;
private NSForm UserInfoForm; private NSForm UserInfoForm;
private NSProgressIndicator ProgressIndicator;
private bool ServerFormOnly; private bool ServerFormOnly;
@ -69,7 +70,7 @@ namespace SparkleShare {
NextButton = new NSButton () { NextButton = new NSButton () {
Title = "Next", Title = "Next",
Enabled = false Enabled = false
}; };
@ -99,8 +100,8 @@ namespace SparkleShare {
bool name_is_correct = bool name_is_correct =
!UserInfoForm.Cells [0].StringValue.Trim ().Equals (""); !UserInfoForm.Cells [0].StringValue.Trim ().Equals ("");
bool email_is_correct = bool email_is_correct = SparkleShare.Controller.IsValidEmail
!UserInfoForm.Cells [1].StringValue.Trim ().Equals (""); (UserInfoForm.Cells [1].StringValue.Trim ());
NextButton.Enabled = (name_is_correct && email_is_correct); NextButton.Enabled = (name_is_correct && email_is_correct);
@ -137,8 +138,8 @@ namespace SparkleShare {
SyncButton = new NSButton () { SyncButton = new NSButton () {
Title = "Sync", Title = "Sync"
Enabled = false //Enabled = false TODO
}; };
Buttons.Add (SyncButton); Buttons.Add (SyncButton);
@ -151,7 +152,7 @@ namespace SparkleShare {
}; };
CancelButton.Activated += delegate { CancelButton.Activated += delegate {
PerformClose (this); Close ();
}; };
Buttons.Add (CancelButton); Buttons.Add (CancelButton);
@ -200,6 +201,37 @@ namespace SparkleShare {
} }
private void ShowSyncingPage (string name)
{
Reset ();
Header = "Syncing folder " + name + "’…";
Description = "This may take a while.\n" +
"You sure its not coffee o-clock?";
ProgressIndicator = new NSProgressIndicator (new RectangleF (200, 230, 390, 20)) {
Style = NSProgressIndicatorStyle.Bar
};
ProgressIndicator.StartAnimation (this);
ContentView.AddSubview (ProgressIndicator);
FinishButton = new NSButton () {
Title = "Finish",
Enabled = false
};
Buttons.Add (FinishButton);
ShowAll ();
}
private void ShowSuccessPage (string folder_name) private void ShowSuccessPage (string folder_name)
{ {
@ -232,6 +264,9 @@ namespace SparkleShare {
Buttons.Add (OpenFolderButton); Buttons.Add (OpenFolderButton);
ShowAll (); ShowAll ();
NSApplication.SharedApplication.RequestUserAttention
(NSRequestUserAttentionType.CriticalRequest);
} }

View file

@ -254,7 +254,8 @@ namespace SparkleShare {
SparkleUI.Intro.ShowServerForm (true); SparkleUI.Intro.ShowServerForm (true);
SparkleUI.Intro.OrderFrontRegardless (); SparkleUI.Intro.OrderFrontRegardless ();
SparkleUI.Intro.MakeKeyAndOrderFront (this);
}); });
}; };

View file

@ -42,15 +42,14 @@ namespace SparkleShare {
public SparkleWindow () : base () public SparkleWindow () : base ()
{ {
// Title = "SparkleShare Configuration";
SetFrame (new RectangleF (0, 0, 640, 480), true); SetFrame (new RectangleF (0, 0, 640, 480), true);
Center (); Center ();
StyleMask = ( StyleMask = NSWindowStyle.Titled;
NSWindowStyle.Titled);
MaxSize = new SizeF (640, 480); MaxSize = new SizeF (640, 480);
MinSize = new SizeF (640, 480); MinSize = new SizeF (640, 480);
HasShadow = true; HasShadow = true;
@ -124,7 +123,7 @@ namespace SparkleShare {
foreach (NSButton button in Buttons) { foreach (NSButton button in Buttons) {
button.BezelStyle = NSBezelStyle.Rounded; button.BezelStyle = NSBezelStyle.Rounded;
button.Frame = new RectangleF (Frame.Width - 20 - (120 * (i + 1)) - (4 * i), 12, 120, 31); button.Frame = new RectangleF (Frame.Width - 15 - (105 * (i + 1)) , 12, 105, 31);
ContentView.AddSubview (button); ContentView.AddSubview (button);
i++; i++;

View file

@ -1150,7 +1150,7 @@ namespace SparkleShare {
Quit (); Quit ();
} }
public void Quit () public void Quit ()
{ {
@ -1166,7 +1166,18 @@ namespace SparkleShare {
Environment.Exit (0); Environment.Exit (0);
} }
// Checks to see if an email address is valid
public bool IsValidEmail (string email)
{
Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase);
return regex.IsMatch (email);
}
} }