diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs
index 32f2ca40..5430776c 100644
--- a/SparkleShare/Windows/SparkleEventLog.cs
+++ b/SparkleShare/Windows/SparkleEventLog.cs
@@ -39,6 +39,7 @@ namespace SparkleShare {
private Label history_label_value;
private ComboBox combo_box;
private WebBrowser web_browser;
+ private SparkleSpinner spinner;
// Short alias for the translations
@@ -103,13 +104,15 @@ namespace SparkleShare {
this.web_browser.ObjectForScripting = new SparkleScriptingObject ();;
+ spinner = new SparkleSpinner (22);
+
// Disable annoying IE clicking sound
CoInternetSetFeatureEnabled (21, 0x00000002, true);
this.canvas = new Canvas ();
Content = this.canvas;
-
+
this.canvas.Children.Add (size_label);
Canvas.SetLeft (size_label, 24);
Canvas.SetTop (size_label, 4);
@@ -131,6 +134,10 @@ namespace SparkleShare {
Canvas.SetLeft (background, 0);
Canvas.SetTop (background, 36);
+ this.canvas.Children.Add (spinner);
+ Canvas.SetLeft (spinner, (Width / 2) - 15);
+ Canvas.SetTop (spinner, (Height / 2) - 22);
+
this.canvas.Children.Add (line);
Canvas.SetLeft (line, 0);
Canvas.SetTop (line, 35);
@@ -181,10 +188,10 @@ namespace SparkleShare {
};
Controller.ContentLoadingEvent += delegate {
- if (this.canvas.Children.Contains (this.web_browser))
- this.canvas.Children.Remove (this.web_browser);
-
- // ContentView.AddSubview (this.progress_indicator); //TODO spinner
+ this.spinner.Start ();
+
+ if (this.canvas.Children.Contains (this.web_browser))
+ this.canvas.Children.Remove (this.web_browser);
};
}
@@ -277,8 +284,7 @@ namespace SparkleShare {
Dispatcher.Invoke ((Action) delegate {
- //if (this.progress_indicator.Superview == ContentView) TODO: spinner
- // this.progress_indicator.RemoveFromSuperview ();
+ this.spinner.Stop ();
this.web_browser.NavigateToString (html);
diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj
index d1196264..9efde631 100644
--- a/SparkleShare/Windows/SparkleShare.csproj
+++ b/SparkleShare/Windows/SparkleShare.csproj
@@ -123,6 +123,7 @@
Program.cs
+
@@ -281,6 +282,9 @@
Pixmaps\document-moved-12.png
+
+ Pixmaps\process-working-22.png
+
diff --git a/SparkleShare/Windows/SparkleSpinner.cs b/SparkleShare/Windows/SparkleSpinner.cs
new file mode 100644
index 00000000..25139d1e
--- /dev/null
+++ b/SparkleShare/Windows/SparkleSpinner.cs
@@ -0,0 +1,122 @@
+// SparkleShare, a collaboration and sharing tool.
+// Copyright (C) 2010 Hylke Bons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using System;
+using System.Timers;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Imaging;
+
+namespace SparkleShare {
+
+ // TODO: cleanup
+ // This is a close implementation of GtkSpinner
+ public class SparkleSpinner : Image {
+
+ public bool Active;
+
+ private Image [] Images;
+ private Timer Timer;
+ private int CycleDuration;
+ private int CurrentStep;
+ private int NumSteps;
+ private int Size;
+
+
+ public SparkleSpinner (int size) : base ()
+ {
+
+ Width = size;
+ Height = size;
+ Size = size;
+
+ CycleDuration = 400;
+ CurrentStep = 0;
+
+ BitmapSource spinner_gallery = SparkleUIHelpers.GetImageSource ("process-working-22");
+
+
+ int frames_in_width = spinner_gallery.PixelWidth / Size;
+ int frames_in_height = spinner_gallery.PixelHeight / Size;
+
+ NumSteps = frames_in_width * frames_in_height;
+ Images = new Image [NumSteps - 1];
+
+ int i = 0;
+
+ for (int y = 0; y < frames_in_height; y++) {
+ for (int x = 0; x < frames_in_width; x++) {
+ if (!(y == 0 && x == 0)) {
+ CroppedBitmap crop = new CroppedBitmap (
+ spinner_gallery,
+ new Int32Rect (x*Size, y*Size, Size, Size));
+ Images [i] = new Image ();
+ Images [i].Source = crop;
+ i++;
+ }
+ }
+ }
+
+ Timer = new Timer () {
+ Interval = CycleDuration / NumSteps
+ };
+
+ Timer.Elapsed += delegate {
+ NextImage ();
+ };
+
+ Start ();
+ }
+
+
+ private void NextImage ()
+ {
+ if (CurrentStep < NumSteps - 2)
+ CurrentStep++;
+ else
+ CurrentStep = 0;
+
+ Dispatcher.Invoke ((Action)delegate { SetImage (); });
+ }
+
+
+ private void SetImage ()
+ {
+ Source = Images [CurrentStep].Source;
+ }
+
+
+ public bool IsActive ()
+ {
+ return Active;
+ }
+
+
+ public void Start ()
+ {
+ CurrentStep = 0;
+ Active = true;
+ Timer.Start ();
+ }
+
+
+ public void Stop ()
+ {
+ Active = false;
+ Timer.Stop ();
+ }
+ }
+}