window setup: implement warning about global gitignore

This commit is contained in:
Hylke Bons 2012-03-09 04:03:16 +00:00
parent 512dc10c88
commit ae907e54f4
2 changed files with 36 additions and 15 deletions

View file

@ -182,8 +182,8 @@ namespace SparkleLib.Git {
} else { } else {
Warnings = new string [] { Warnings = new string [] {
string.Format ("You seem to have configured a system gitignore file. " + string.Format ("You seem to have configured a system wide gitignore file. " +
"This may interfere with SparkleShare.\n({0})", output) "This may affect SparkleShare files:\n\n{0}", output)
}; };
} }
} }

View file

@ -21,15 +21,17 @@ using System.ComponentModel;
using System.IO; using System.IO;
using System.Media; using System.Media;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Forms.Integration; using System.Windows.Forms.Integration;
using System.Windows.Controls;
using System.Windows.Markup; using System.Windows.Markup;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using Drawing = System.Drawing;
using Imaging = System.Windows.Interop.Imaging;
using WPF = System.Windows.Controls; using WPF = System.Windows.Controls;
namespace SparkleShare { namespace SparkleShare {
@ -122,6 +124,8 @@ namespace SparkleShare {
Buttons.Add (continue_button); Buttons.Add (continue_button);
Buttons.Add (cancel_button); Buttons.Add (cancel_button);
name_box.Focus ();
name_box.Select (name_box.Text.Length, 0);
Controller.UpdateSetupContinueButtonEvent += delegate (bool enabled) { Controller.UpdateSetupContinueButtonEvent += delegate (bool enabled) {
Dispatcher.Invoke ((Action) delegate { Dispatcher.Invoke ((Action) delegate {
@ -315,7 +319,6 @@ namespace SparkleShare {
Foreground = new SolidColorBrush (Color.FromRgb (128, 128, 128)) Foreground = new SolidColorBrush (Color.FromRgb (128, 128, 128))
}; };
Button cancel_button = new Button () { Button cancel_button = new Button () {
Content = "Cancel" Content = "Cancel"
}; };
@ -353,10 +356,11 @@ namespace SparkleShare {
Canvas.SetTop (path_help_label, 330); Canvas.SetTop (path_help_label, 330);
Canvas.SetRight (path_help_label, 30); Canvas.SetRight (path_help_label, 30);
Buttons.Add (add_button); Buttons.Add (add_button);
Buttons.Add (cancel_button); Buttons.Add (cancel_button);
address_box.Focus ();
address_box.Select (address_box.Text.Length, 0);
Controller.ChangeAddressFieldEvent += delegate (string text, Controller.ChangeAddressFieldEvent += delegate (string text,
string example_text, FieldState state) { string example_text, FieldState state) {
@ -368,7 +372,6 @@ namespace SparkleShare {
}); });
}; };
Controller.ChangePathFieldEvent += delegate (string text, Controller.ChangePathFieldEvent += delegate (string text,
string example_text, FieldState state) { string example_text, FieldState state) {
@ -532,8 +535,6 @@ namespace SparkleShare {
Description = "Access the files from your SparkleShare folder."; Description = "Access the files from your SparkleShare folder.";
// TODO: warnings
Button finish_button = new Button () { Button finish_button = new Button () {
Content = "Finish" Content = "Finish"
}; };
@ -542,6 +543,26 @@ namespace SparkleShare {
Content = "Open folder" Content = "Open folder"
}; };
if (warnings != null) {
Image warning_image = new Image () {
Source = Imaging.CreateBitmapSourceFromHIcon (Drawing.SystemIcons.Warning.Handle,
Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions ())
};
TextBlock warning_block = new TextBlock () {
Text = warnings [0],
Width = 310,
TextWrapping = TextWrapping.Wrap
};
ContentCanvas.Children.Add (warning_image);
Canvas.SetLeft (warning_image, 193);
Canvas.SetTop (warning_image, 100);
ContentCanvas.Children.Add (warning_block);
Canvas.SetLeft (warning_block, 240);
Canvas.SetTop (warning_block, 100);
}
Buttons.Add (finish_button); Buttons.Add (finish_button);
Buttons.Add (open_folder_button); Buttons.Add (open_folder_button);