Replace tabs with spaces in project
This commit is contained in:
parent
98695afbf4
commit
b11f6af166
|
@ -59,7 +59,7 @@ namespace SparkleLib {
|
||||||
public SparkleConfig (string config_path, string config_file_name)
|
public SparkleConfig (string config_path, string config_file_name)
|
||||||
{
|
{
|
||||||
FullPath = Path.Combine (config_path, config_file_name);
|
FullPath = Path.Combine (config_path, config_file_name);
|
||||||
LogFilePath = Path.Combine (config_path, "debug.log");
|
LogFilePath = Path.Combine (@"C:\Users\Hylke\Desktop", "debug.log");
|
||||||
|
|
||||||
if (File.Exists (LogFilePath)) {
|
if (File.Exists (LogFilePath)) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -291,7 +291,7 @@ namespace SparkleLib {
|
||||||
// that OpenSSH still likes without resorting to Mono.Unix
|
// that OpenSSH still likes without resorting to Mono.Unix
|
||||||
FileInfo file_info = new FileInfo (file_path);
|
FileInfo file_info = new FileInfo (file_path);
|
||||||
file_info.Attributes = FileAttributes.ReadOnly;
|
file_info.Attributes = FileAttributes.ReadOnly;
|
||||||
file_info.Attributes = FileAttributes.Normal;
|
file_info.Attributes = FileAttributes.Normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ namespace SparkleLib {
|
||||||
this.thread.Join ();
|
this.thread.Join ();
|
||||||
|
|
||||||
if (this.socket != null)
|
if (this.socket != null)
|
||||||
this.socket.Close ();
|
this.socket.Close ();
|
||||||
|
|
||||||
base.Dispose ();
|
base.Dispose ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,8 +266,8 @@ namespace SparkleLib {
|
||||||
|
|
||||||
if (!Directory.Exists (notes_path)) {
|
if (!Directory.Exists (notes_path)) {
|
||||||
Directory.CreateDirectory (notes_path);
|
Directory.CreateDirectory (notes_path);
|
||||||
File.SetAttributes (notes_path, FileAttributes.Directory | FileAttributes.Hidden);
|
File.SetAttributes (notes_path, FileAttributes.Directory | FileAttributes.Hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
Regex regex_notes = new Regex (@"<name>(.+)</name>.*" +
|
Regex regex_notes = new Regex (@"<name>(.+)</name>.*" +
|
||||||
"<email>(.+)</email>.*" +
|
"<email>(.+)</email>.*" +
|
||||||
|
@ -454,11 +454,11 @@ namespace SparkleLib {
|
||||||
this.progress_percentage = 0.0;
|
this.progress_percentage = 0.0;
|
||||||
this.progress_speed = "";
|
this.progress_speed = "";
|
||||||
|
|
||||||
string notes_path = Path.Combine (LocalPath, ".notes");
|
string notes_path = Path.Combine (LocalPath, ".notes");
|
||||||
|
|
||||||
if (Directory.Exists (notes_path))
|
if (Directory.Exists (notes_path))
|
||||||
File.SetAttributes (notes_path,
|
File.SetAttributes (notes_path,
|
||||||
FileAttributes.Directory | FileAttributes.Hidden);
|
FileAttributes.Directory | FileAttributes.Hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -238,11 +238,11 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UIHasLoaded ()
|
public void UIHasLoaded ()
|
||||||
{
|
{
|
||||||
if (FirstRun)
|
if (FirstRun)
|
||||||
ShowSetupWindow (PageType.Setup);
|
ShowSetupWindow (PageType.Setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowSetupWindow (PageType page_type)
|
public void ShowSetupWindow (PageType page_type)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -204,9 +204,9 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetupPageCancelled ()
|
public void SetupPageCancelled ()
|
||||||
{
|
{
|
||||||
Program.Controller.Quit ();
|
Program.Controller.Quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,12 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
Title = "About SparkleShare";
|
Title = "About SparkleShare";
|
||||||
ResizeMode = ResizeMode.NoResize;
|
ResizeMode = ResizeMode.NoResize;
|
||||||
Height = 288;
|
Height = 288;
|
||||||
Width = 640;
|
Width = 640;
|
||||||
|
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
|
||||||
Closing += Close;
|
Closing += Close;
|
||||||
|
|
||||||
CreateAbout ();
|
CreateAbout ();
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ namespace SparkleShare {
|
||||||
Controller.ShowWindowEvent += delegate {
|
Controller.ShowWindowEvent += delegate {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
Show ();
|
Show ();
|
||||||
Activate ();
|
Activate ();
|
||||||
BringIntoView ();
|
BringIntoView ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,21 +69,21 @@ namespace SparkleShare {
|
||||||
Controller.NewVersionEvent += delegate (string new_version) {
|
Controller.NewVersionEvent += delegate (string new_version) {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
this.updates.Content = "A newer version (" + new_version + ") is available!";
|
this.updates.Content = "A newer version (" + new_version + ") is available!";
|
||||||
this.updates.UpdateLayout ();
|
this.updates.UpdateLayout ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.VersionUpToDateEvent += delegate {
|
Controller.VersionUpToDateEvent += delegate {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
this.updates.Content = "You are running the latest version.";
|
this.updates.Content = "You are running the latest version.";
|
||||||
this.updates.UpdateLayout ();
|
this.updates.UpdateLayout ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.CheckingForNewVersionEvent += delegate {
|
Controller.CheckingForNewVersionEvent += delegate {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
this.updates.Content = "Checking for updates...";
|
this.updates.Content = "Checking for updates...";
|
||||||
this.updates.UpdateLayout ();
|
this.updates.UpdateLayout ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -91,57 +91,57 @@ namespace SparkleShare {
|
||||||
|
|
||||||
private void CreateAbout ()
|
private void CreateAbout ()
|
||||||
{
|
{
|
||||||
Image image = new Image () {
|
Image image = new Image () {
|
||||||
Width = 640,
|
Width = 640,
|
||||||
Height = 260
|
Height = 260
|
||||||
};
|
};
|
||||||
|
|
||||||
image.Source = SparkleUIHelpers.GetImageSource ("about");
|
image.Source = SparkleUIHelpers.GetImageSource ("about");
|
||||||
|
|
||||||
|
|
||||||
Label version = new Label () {
|
Label version = new Label () {
|
||||||
Content = "version " + Controller.RunningVersion,
|
Content = "version " + Controller.RunningVersion,
|
||||||
FontSize = 11,
|
FontSize = 11,
|
||||||
Foreground = new SolidColorBrush (Colors.White)
|
Foreground = new SolidColorBrush (Colors.White)
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updates = new Label () {
|
this.updates = new Label () {
|
||||||
Content = "Checking for updates...",
|
Content = "Checking for updates...",
|
||||||
FontSize = 11,
|
FontSize = 11,
|
||||||
Foreground = new SolidColorBrush (Color.FromRgb (45, 62, 81)) // TODO: color looks off
|
Foreground = new SolidColorBrush (Color.FromRgb (45, 62, 81)) // TODO: color looks off
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock credits = new TextBlock () {
|
TextBlock credits = new TextBlock () {
|
||||||
FontSize = 11,
|
FontSize = 11,
|
||||||
Foreground = new SolidColorBrush (Colors.White),
|
Foreground = new SolidColorBrush (Colors.White),
|
||||||
Text = "Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others.\n" +
|
Text = "Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others.\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"SparkleShare is Free and Open Source Software. You are free to use, modify, " +
|
"SparkleShare is Free and Open Source Software. You are free to use, modify, " +
|
||||||
"and redistribute it under the GNU General Public License version 3 or later.",
|
"and redistribute it under the GNU General Public License version 3 or later.",
|
||||||
TextWrapping = TextWrapping.Wrap,
|
TextWrapping = TextWrapping.Wrap,
|
||||||
Width = 318
|
Width = 318
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Canvas canvas = new Canvas ();
|
Canvas canvas = new Canvas ();
|
||||||
|
|
||||||
canvas.Children.Add (image);
|
canvas.Children.Add (image);
|
||||||
Canvas.SetLeft (image, 0);
|
Canvas.SetLeft (image, 0);
|
||||||
Canvas.SetTop (image, 0);
|
Canvas.SetTop (image, 0);
|
||||||
|
|
||||||
canvas.Children.Add (version);
|
canvas.Children.Add (version);
|
||||||
Canvas.SetLeft (version, 289);
|
Canvas.SetLeft (version, 289);
|
||||||
Canvas.SetTop (version, 92);
|
Canvas.SetTop (version, 92);
|
||||||
|
|
||||||
canvas.Children.Add (this.updates);
|
canvas.Children.Add (this.updates);
|
||||||
Canvas.SetLeft (this.updates, 289);
|
Canvas.SetLeft (this.updates, 289);
|
||||||
Canvas.SetTop (this.updates, 109);
|
Canvas.SetTop (this.updates, 109);
|
||||||
|
|
||||||
canvas.Children.Add (credits);
|
canvas.Children.Add (credits);
|
||||||
Canvas.SetLeft (credits, 294);
|
Canvas.SetLeft (credits, 294);
|
||||||
Canvas.SetTop (credits, 142);
|
Canvas.SetTop (credits, 142);
|
||||||
|
|
||||||
Content = canvas;
|
Content = canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace SparkleShare {
|
||||||
public SparkleBubbles ()
|
public SparkleBubbles ()
|
||||||
{
|
{
|
||||||
Controller.ShowBubbleEvent += delegate (string title,
|
Controller.ShowBubbleEvent += delegate (string title,
|
||||||
string subtext, string image_path) {
|
string subtext, string image_path) {
|
||||||
|
|
||||||
SparkleUI.StatusIcon.ShowBalloon (title, subtext, image_path);
|
SparkleUI.StatusIcon.ShowBalloon (title, subtext, image_path);
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,8 +53,8 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void Initialize ()
|
public override void Initialize ()
|
||||||
{
|
{
|
||||||
Settings settings = new Settings ();
|
Settings settings = new Settings ();
|
||||||
BrowserSettings browser_settings = new BrowserSettings ();
|
BrowserSettings browser_settings = new BrowserSettings ();
|
||||||
|
|
||||||
|
@ -66,29 +66,29 @@ namespace SparkleShare {
|
||||||
CEF.RegisterScheme ("application", "sparkleshare", new ApplicationSchemeHandlerFactory ());
|
CEF.RegisterScheme ("application", "sparkleshare", new ApplicationSchemeHandlerFactory ());
|
||||||
CEF.RegisterScheme ("application", "file", new FileSchemeHandlerFactory ());
|
CEF.RegisterScheme ("application", "file", new FileSchemeHandlerFactory ());
|
||||||
|
|
||||||
Application.EnableVisualStyles ();
|
Application.EnableVisualStyles ();
|
||||||
Application.SetCompatibleTextRenderingDefault (false);
|
Application.SetCompatibleTextRenderingDefault (false);
|
||||||
|
|
||||||
// Add msysgit to path, as we cannot asume it is added to the path
|
// Add msysgit to path, as we cannot asume it is added to the path
|
||||||
// Asume it is installed in @"<exec dir>\msysgit\bin"
|
// Asume it is installed in @"<exec dir>\msysgit\bin"
|
||||||
string executable_dir = Path.GetDirectoryName (Application.ExecutablePath);
|
string executable_dir = Path.GetDirectoryName (Application.ExecutablePath);
|
||||||
string msysgit = Path.Combine (executable_dir, "msysgit");
|
string msysgit = Path.Combine (executable_dir, "msysgit");
|
||||||
|
|
||||||
string new_PATH = msysgit + @"\bin" + ";" +
|
string new_PATH = msysgit + @"\bin" + ";" +
|
||||||
msysgit + @"\mingw\bin" + ";" +
|
msysgit + @"\mingw\bin" + ";" +
|
||||||
msysgit + @"\cmd" + ";" +
|
msysgit + @"\cmd" + ";" +
|
||||||
Environment.ExpandEnvironmentVariables ("%PATH%");
|
Environment.ExpandEnvironmentVariables ("%PATH%");
|
||||||
|
|
||||||
Environment.SetEnvironmentVariable ("PATH", new_PATH);
|
Environment.SetEnvironmentVariable ("PATH", new_PATH);
|
||||||
Environment.SetEnvironmentVariable ("PLINK_PROTOCOL", "ssh");
|
Environment.SetEnvironmentVariable ("PLINK_PROTOCOL", "ssh");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("HOME")))
|
if (string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("HOME")))
|
||||||
Environment.SetEnvironmentVariable ("HOME",
|
Environment.SetEnvironmentVariable ("HOME",
|
||||||
Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%"));
|
Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%"));
|
||||||
|
|
||||||
StartSSH ();
|
StartSSH ();
|
||||||
base.Initialize ();
|
base.Initialize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override string EventLogHTML
|
public override string EventLogHTML
|
||||||
|
@ -117,14 +117,14 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void CreateStartupItem ()
|
public override void CreateStartupItem ()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void InstallProtocolHandler()
|
public override void InstallProtocolHandler()
|
||||||
{
|
{
|
||||||
// Get assembly location
|
// Get assembly location
|
||||||
string location = System.Reflection.Assembly.GetExecutingAssembly ().Location;
|
string location = System.Reflection.Assembly.GetExecutingAssembly ().Location;
|
||||||
string folder = Path.GetDirectoryName (location);
|
string folder = Path.GetDirectoryName (location);
|
||||||
|
@ -141,17 +141,17 @@ namespace SparkleShare {
|
||||||
|
|
||||||
string action_key = "HKEY_CLASSES_ROOT\\sparkleshare\\shell\\open\\command";
|
string action_key = "HKEY_CLASSES_ROOT\\sparkleshare\\shell\\open\\command";
|
||||||
Registry.SetValue (action_key, "", "\"" + invite_exe + "\" \"%1\"");
|
Registry.SetValue (action_key, "", "\"" + invite_exe + "\" \"%1\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void AddToBookmarks ()
|
public override void AddToBookmarks ()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override bool CreateSparkleShareFolder ()
|
public override bool CreateSparkleShareFolder ()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) {
|
if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) {
|
||||||
Directory.CreateDirectory(SparkleConfig.DefaultConfig.FoldersPath);
|
Directory.CreateDirectory(SparkleConfig.DefaultConfig.FoldersPath);
|
||||||
Directory.CreateDirectory(SparkleConfig.DefaultConfig.TmpPath);
|
Directory.CreateDirectory(SparkleConfig.DefaultConfig.TmpPath);
|
||||||
|
@ -161,12 +161,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// TODO: Set a custom SparkleShare folder icon
|
// TODO: Set a custom SparkleShare folder icon
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OpenFile (string url)
|
public override void OpenFile (string url)
|
||||||
|
@ -179,15 +179,15 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OpenSparkleShareFolder (string subfolder)
|
public override void OpenSparkleShareFolder (string subfolder)
|
||||||
{
|
{
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "explorer";
|
process.StartInfo.FileName = "explorer";
|
||||||
process.StartInfo.Arguments = ",/root," +
|
process.StartInfo.Arguments = ",/root," +
|
||||||
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, subfolder);
|
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, subfolder);
|
||||||
|
|
||||||
process.Start();
|
process.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void Quit ()
|
public override void Quit ()
|
||||||
|
@ -197,50 +197,50 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void StartSSH ()
|
private void StartSSH ()
|
||||||
{
|
{
|
||||||
string auth_sock = Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK");
|
string auth_sock = Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (auth_sock)) {
|
if (string.IsNullOrEmpty (auth_sock)) {
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "ssh-agent";
|
process.StartInfo.FileName = "ssh-agent";
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
process.StartInfo.CreateNoWindow = true;
|
process.StartInfo.CreateNoWindow = true;
|
||||||
|
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
string output = process.StandardOutput.ReadToEnd ();
|
string output = process.StandardOutput.ReadToEnd ();
|
||||||
process.WaitForExit ();
|
process.WaitForExit ();
|
||||||
|
|
||||||
Match auth_sock_match = new Regex (@"SSH_AUTH_SOCK=([^;\n\r]*)").Match (output);
|
Match auth_sock_match = new Regex (@"SSH_AUTH_SOCK=([^;\n\r]*)").Match (output);
|
||||||
|
|
||||||
if (auth_sock_match.Success)
|
if (auth_sock_match.Success)
|
||||||
Environment.SetEnvironmentVariable ("SSH_AUTH_SOCK",
|
Environment.SetEnvironmentVariable ("SSH_AUTH_SOCK",
|
||||||
auth_sock_match.Groups [1].Value);
|
auth_sock_match.Groups [1].Value);
|
||||||
|
|
||||||
Match ssh_pid_match =
|
Match ssh_pid_match =
|
||||||
new Regex (@"SSH_AGENT_PID=([^;\n\r]*)").Match (output);
|
new Regex (@"SSH_AGENT_PID=([^;\n\r]*)").Match (output);
|
||||||
|
|
||||||
if (ssh_pid_match.Success) {
|
if (ssh_pid_match.Success) {
|
||||||
string ssh_pid = ssh_pid_match.Groups [1].Value;
|
string ssh_pid = ssh_pid_match.Groups [1].Value;
|
||||||
|
|
||||||
Int32.TryParse (ssh_pid, out this.ssh_agent_pid);
|
Int32.TryParse (ssh_pid, out this.ssh_agent_pid);
|
||||||
Environment.SetEnvironmentVariable ("SSH_AGENT_PID", ssh_pid);
|
Environment.SetEnvironmentVariable ("SSH_AGENT_PID", ssh_pid);
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Controller",
|
SparkleHelpers.DebugInfo ("Controller",
|
||||||
"ssh-agent started, PID=" + ssh_pid);
|
"ssh-agent started, PID=" + ssh_pid);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SparkleHelpers.DebugInfo ("Controller",
|
SparkleHelpers.DebugInfo ("Controller",
|
||||||
"ssh-agent started, PID=unknown");
|
"ssh-agent started, PID=unknown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void StopSSH ()
|
private void StopSSH ()
|
||||||
{
|
{
|
||||||
if (ssh_agent_pid != 0) {
|
if (ssh_agent_pid != 0) {
|
||||||
try {
|
try {
|
||||||
Process.GetProcessById (this.ssh_agent_pid).Kill ();
|
Process.GetProcessById (this.ssh_agent_pid).Kill ();
|
||||||
|
@ -250,6 +250,6 @@ namespace SparkleShare {
|
||||||
"Could not stop SSH: the process isn't running");
|
"Could not stop SSH: the process isn't running");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleEventLogController Controller = new SparkleEventLogController ();
|
public SparkleEventLogController Controller = new SparkleEventLogController ();
|
||||||
|
|
||||||
private Canvas canvas;
|
private Canvas canvas;
|
||||||
private Label size_label_value;
|
private Label size_label_value;
|
||||||
private Label history_label_value;
|
private Label history_label_value;
|
||||||
private ComboBox combo_box;
|
private ComboBox combo_box;
|
||||||
private WebBrowser web_browser;
|
private WebBrowser web_browser;
|
||||||
|
|
||||||
|
|
||||||
// Short alias for the translations
|
// Short alias for the translations
|
||||||
|
@ -48,95 +48,95 @@ namespace SparkleShare {
|
||||||
public SparkleEventLog ()
|
public SparkleEventLog ()
|
||||||
{
|
{
|
||||||
Title = "Recent Changes";
|
Title = "Recent Changes";
|
||||||
Height = 640;
|
Height = 640;
|
||||||
Width = 480;
|
Width = 480;
|
||||||
ResizeMode = ResizeMode.NoResize;
|
ResizeMode = ResizeMode.NoResize;
|
||||||
Background = new SolidColorBrush (Color.FromRgb (240, 240, 240));
|
Background = new SolidColorBrush (Color.FromRgb (240, 240, 240));
|
||||||
|
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
|
||||||
Closing += Close;
|
Closing += Close;
|
||||||
|
|
||||||
|
|
||||||
Label size_label = new Label () {
|
Label size_label = new Label () {
|
||||||
Content = "Size:"
|
Content = "Size:"
|
||||||
};
|
};
|
||||||
|
|
||||||
this.size_label_value = new Label () {
|
this.size_label_value = new Label () {
|
||||||
Content = Controller.Size,
|
Content = Controller.Size,
|
||||||
FontWeight = FontWeights.Bold
|
FontWeight = FontWeights.Bold
|
||||||
};
|
};
|
||||||
|
|
||||||
size_label.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
|
size_label.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
|
||||||
Rect size_label_rect = new Rect (size_label.DesiredSize);
|
Rect size_label_rect = new Rect (size_label.DesiredSize);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Label history_label = new Label () {
|
Label history_label = new Label () {
|
||||||
Content = "History:"
|
Content = "History:"
|
||||||
};
|
};
|
||||||
|
|
||||||
this.history_label_value = new Label () {
|
this.history_label_value = new Label () {
|
||||||
Content = Controller.HistorySize,
|
Content = Controller.HistorySize,
|
||||||
FontWeight = FontWeights.Bold
|
FontWeight = FontWeights.Bold
|
||||||
};
|
};
|
||||||
|
|
||||||
history_label.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
|
history_label.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
|
||||||
Rect history_label_rect = new Rect (history_label.DesiredSize);
|
Rect history_label_rect = new Rect (history_label.DesiredSize);
|
||||||
|
|
||||||
|
|
||||||
Rectangle line = new Rectangle () {
|
Rectangle line = new Rectangle () {
|
||||||
Width = Width,
|
Width = Width,
|
||||||
Height = 1,
|
Height = 1,
|
||||||
Fill = new SolidColorBrush (Color.FromRgb (223, 223, 223))
|
Fill = new SolidColorBrush (Color.FromRgb (223, 223, 223))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.web_browser = new WebBrowser () {
|
this.web_browser = new WebBrowser () {
|
||||||
Width = Width - 7,
|
Width = Width - 7,
|
||||||
Height = Height - 36 - 12
|
Height = Height - 36 - 12
|
||||||
};
|
};
|
||||||
|
|
||||||
this.web_browser.Navigating += delegate (object sender, NavigatingCancelEventArgs e) {
|
this.web_browser.Navigating += delegate (object sender, NavigatingCancelEventArgs e) {
|
||||||
string url = e.Uri.ToString ();
|
string url = e.Uri.ToString ();
|
||||||
Controller.LinkClicked (url);
|
Controller.LinkClicked (url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.canvas = new Canvas ();
|
this.canvas = new Canvas ();
|
||||||
Content = this.canvas;
|
Content = this.canvas;
|
||||||
|
|
||||||
this.canvas.Children.Add (size_label);
|
this.canvas.Children.Add (size_label);
|
||||||
Canvas.SetLeft (size_label, 12);
|
Canvas.SetLeft (size_label, 12);
|
||||||
Canvas.SetTop (size_label, 4);
|
Canvas.SetTop (size_label, 4);
|
||||||
|
|
||||||
this.canvas.Children.Add (this.size_label_value);
|
this.canvas.Children.Add (this.size_label_value);
|
||||||
Canvas.SetLeft (this.size_label_value, 12 + size_label_rect.Width);
|
Canvas.SetLeft (this.size_label_value, 12 + size_label_rect.Width);
|
||||||
Canvas.SetTop (this.size_label_value, 4);
|
Canvas.SetTop (this.size_label_value, 4);
|
||||||
|
|
||||||
|
|
||||||
this.canvas.Children.Add (history_label);
|
this.canvas.Children.Add (history_label);
|
||||||
Canvas.SetLeft (history_label, 120);
|
Canvas.SetLeft (history_label, 120);
|
||||||
Canvas.SetTop (history_label, 4);
|
Canvas.SetTop (history_label, 4);
|
||||||
|
|
||||||
this.canvas.Children.Add (this.history_label_value);
|
this.canvas.Children.Add (this.history_label_value);
|
||||||
Canvas.SetLeft (this.history_label_value, 120 + history_label_rect.Width);
|
Canvas.SetLeft (this.history_label_value, 120 + history_label_rect.Width);
|
||||||
Canvas.SetTop (this.history_label_value, 4);
|
Canvas.SetTop (this.history_label_value, 4);
|
||||||
|
|
||||||
|
|
||||||
this.canvas.Children.Add (line);
|
this.canvas.Children.Add (line);
|
||||||
Canvas.SetLeft (line, 0);
|
Canvas.SetLeft (line, 0);
|
||||||
Canvas.SetTop (line, 35);
|
Canvas.SetTop (line, 35);
|
||||||
|
|
||||||
|
|
||||||
Controller.ShowWindowEvent += delegate {
|
Controller.ShowWindowEvent += delegate {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
Show ();
|
Show ();
|
||||||
Activate ();
|
Activate ();
|
||||||
BringIntoView ();
|
BringIntoView ();
|
||||||
|
|
||||||
UpdateContent (null);
|
UpdateContent (null);
|
||||||
UpdateChooser (null);
|
UpdateChooser (null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -146,18 +146,18 @@ namespace SparkleShare {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) {
|
Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
this.size_label_value.Content = size;
|
this.size_label_value.Content = size;
|
||||||
this.size_label_value.UpdateLayout ();
|
this.size_label_value.UpdateLayout ();
|
||||||
|
|
||||||
this.history_label_value.Content = history_size;
|
this.history_label_value.Content = history_size;
|
||||||
this.history_label_value.UpdateLayout ();
|
this.history_label_value.UpdateLayout ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.UpdateChooserEvent += delegate (string [] folders) {
|
Controller.UpdateChooserEvent += delegate (string [] folders) {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
UpdateChooser (folders);
|
UpdateChooser (folders);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -170,59 +170,59 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Controller.ContentLoadingEvent += delegate {
|
Controller.ContentLoadingEvent += delegate {
|
||||||
if (this.canvas.Children.Contains (this.web_browser))
|
if (this.canvas.Children.Contains (this.web_browser))
|
||||||
this.canvas.Children.Remove (this.web_browser);
|
this.canvas.Children.Remove (this.web_browser);
|
||||||
|
|
||||||
// ContentView.AddSubview (this.progress_indicator); //TODO spinner
|
// ContentView.AddSubview (this.progress_indicator); //TODO spinner
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateChooser (string [] folders)
|
public void UpdateChooser (string [] folders)
|
||||||
{
|
{
|
||||||
if (folders == null)
|
if (folders == null)
|
||||||
folders = Controller.Folders;
|
folders = Controller.Folders;
|
||||||
|
|
||||||
if (this.combo_box != null)
|
if (this.combo_box != null)
|
||||||
this.canvas.Children.Remove (this.combo_box);
|
this.canvas.Children.Remove (this.combo_box);
|
||||||
|
|
||||||
this.combo_box = new ComboBox () {
|
this.combo_box = new ComboBox () {
|
||||||
Width = 160
|
Width = 160
|
||||||
};
|
};
|
||||||
|
|
||||||
ComboBoxItem item = new ComboBoxItem () {
|
ComboBoxItem item = new ComboBoxItem () {
|
||||||
Content = "All Projects"
|
Content = "All Projects"
|
||||||
};
|
};
|
||||||
|
|
||||||
this.combo_box.Items.Add (item);
|
this.combo_box.Items.Add (item);
|
||||||
this.combo_box.SelectedItem = combo_box.Items [0];
|
this.combo_box.SelectedItem = combo_box.Items [0];
|
||||||
this.combo_box.Items.Add (new Separator ());
|
this.combo_box.Items.Add (new Separator ());
|
||||||
|
|
||||||
foreach (string folder in folders) {
|
foreach (string folder in folders) {
|
||||||
this.combo_box.Items.Add (
|
this.combo_box.Items.Add (
|
||||||
new ComboBoxItem () { Content = folder }
|
new ComboBoxItem () { Content = folder }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.combo_box.SelectionChanged += delegate {
|
this.combo_box.SelectionChanged += delegate {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
int index = this.combo_box.SelectedIndex;
|
int index = this.combo_box.SelectedIndex;
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
Controller.SelectedFolder = null;
|
Controller.SelectedFolder = null;
|
||||||
else
|
else
|
||||||
Controller.SelectedFolder = (string)
|
Controller.SelectedFolder = (string)
|
||||||
(this.combo_box.Items [index] as ComboBoxItem).Content;
|
(this.combo_box.Items [index] as ComboBoxItem).Content;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.canvas.Children.Add (combo_box);
|
this.canvas.Children.Add (combo_box);
|
||||||
Canvas.SetLeft (this.combo_box, Width - 18 - this.combo_box.Width);
|
Canvas.SetLeft (this.combo_box, Width - 18 - this.combo_box.Width);
|
||||||
Canvas.SetTop (this.combo_box, 6);
|
Canvas.SetTop (this.combo_box, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateContent (string html)
|
public void UpdateContent (string html)
|
||||||
{
|
{
|
||||||
Thread thread = new Thread (new ThreadStart (delegate {
|
Thread thread = new Thread (new ThreadStart (delegate {
|
||||||
if (html == null)
|
if (html == null)
|
||||||
html = Controller.HTML;
|
html = Controller.HTML;
|
||||||
|
@ -259,18 +259,18 @@ namespace SparkleShare {
|
||||||
//if (this.progress_indicator.Superview == ContentView) TODO: spinner
|
//if (this.progress_indicator.Superview == ContentView) TODO: spinner
|
||||||
// this.progress_indicator.RemoveFromSuperview ();
|
// this.progress_indicator.RemoveFromSuperview ();
|
||||||
|
|
||||||
this.web_browser.NavigateToString (html);
|
this.web_browser.NavigateToString (html);
|
||||||
|
|
||||||
if (!this.canvas.Children.Contains (this.web_browser)) {
|
if (!this.canvas.Children.Contains (this.web_browser)) {
|
||||||
this.canvas.Children.Add (this.web_browser);
|
this.canvas.Children.Add (this.web_browser);
|
||||||
Canvas.SetLeft (this.web_browser, 0);
|
Canvas.SetLeft (this.web_browser, 0);
|
||||||
Canvas.SetTop (this.web_browser, 36);
|
Canvas.SetTop (this.web_browser, 36);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
thread.Start ();
|
thread.Start ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Close (object sender, CancelEventArgs args)
|
private void Close (object sender, CancelEventArgs args)
|
||||||
|
|
|
@ -33,16 +33,16 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleSetup : SparkleSetupWindow {
|
public class SparkleSetup : SparkleSetupWindow {
|
||||||
|
|
||||||
public SparkleSetupController Controller = new SparkleSetupController ();
|
public SparkleSetupController Controller = new SparkleSetupController ();
|
||||||
|
|
||||||
|
|
||||||
public SparkleSetup ()
|
public SparkleSetup ()
|
||||||
{
|
{
|
||||||
Controller.ShowWindowEvent += delegate {
|
Controller.ShowWindowEvent += delegate {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
Show ();
|
Show ();
|
||||||
Activate ();
|
Activate ();
|
||||||
BringIntoView ();
|
BringIntoView ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,283 +53,283 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.ChangePageEvent += delegate (PageType type, string [] warnings) {
|
Controller.ChangePageEvent += delegate (PageType type, string [] warnings) {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
Reset ();
|
Reset ();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PageType.Setup: {
|
case PageType.Setup: {
|
||||||
Header = "Welcome to SparkleShare!";
|
Header = "Welcome to SparkleShare!";
|
||||||
Description = "Before we get started, what's your name and email?\n" +
|
Description = "Before we get started, what's your name and email?\n" +
|
||||||
"Don't worry, this information will only visible to any team members.";
|
"Don't worry, this information will only visible to any team members.";
|
||||||
|
|
||||||
|
|
||||||
TextBlock name_label = new TextBlock () {
|
TextBlock name_label = new TextBlock () {
|
||||||
Text = "Full Name:",
|
Text = "Full Name:",
|
||||||
Width = 150,
|
Width = 150,
|
||||||
TextAlignment = TextAlignment.Right,
|
TextAlignment = TextAlignment.Right,
|
||||||
FontWeight = FontWeights.Bold
|
FontWeight = FontWeights.Bold
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBox name_box = new TextBox () {
|
TextBox name_box = new TextBox () {
|
||||||
Text = Controller.GuessedUserName,
|
Text = Controller.GuessedUserName,
|
||||||
Width = 175
|
Width = 175
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
TextBlock email_label = new TextBlock () {
|
TextBlock email_label = new TextBlock () {
|
||||||
Text = "Email:",
|
Text = "Email:",
|
||||||
Width = 150,
|
Width = 150,
|
||||||
TextAlignment = TextAlignment.Right,
|
TextAlignment = TextAlignment.Right,
|
||||||
FontWeight = FontWeights.Bold
|
FontWeight = FontWeights.Bold
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBox email_box = new TextBox () {
|
TextBox email_box = new TextBox () {
|
||||||
Width = 175,
|
Width = 175,
|
||||||
Text = Controller.GuessedUserEmail
|
Text = Controller.GuessedUserEmail
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Button cancel_button = new Button () {
|
Button cancel_button = new Button () {
|
||||||
Content = "Cancel"
|
Content = "Cancel"
|
||||||
};
|
};
|
||||||
|
|
||||||
Button continue_button = new Button () {
|
Button continue_button = new Button () {
|
||||||
Content = "Continue",
|
Content = "Continue",
|
||||||
IsEnabled = false
|
IsEnabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (name_label);
|
ContentCanvas.Children.Add (name_label);
|
||||||
Canvas.SetLeft (name_label, 180);
|
Canvas.SetLeft (name_label, 180);
|
||||||
Canvas.SetTop (name_label, 200 + 3);
|
Canvas.SetTop (name_label, 200 + 3);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (name_box);
|
ContentCanvas.Children.Add (name_box);
|
||||||
Canvas.SetLeft (name_box, 340);
|
Canvas.SetLeft (name_box, 340);
|
||||||
Canvas.SetTop (name_box, 200);
|
Canvas.SetTop (name_box, 200);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (email_label);
|
ContentCanvas.Children.Add (email_label);
|
||||||
Canvas.SetLeft (email_label, 180);
|
Canvas.SetLeft (email_label, 180);
|
||||||
Canvas.SetTop (email_label, 230 + 3);
|
Canvas.SetTop (email_label, 230 + 3);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (email_box);
|
ContentCanvas.Children.Add (email_box);
|
||||||
Canvas.SetLeft (email_box, 340);
|
Canvas.SetLeft (email_box, 340);
|
||||||
Canvas.SetTop (email_box, 230);
|
Canvas.SetTop (email_box, 230);
|
||||||
|
|
||||||
Buttons.Add (continue_button);
|
Buttons.Add (continue_button);
|
||||||
Buttons.Add (cancel_button);
|
Buttons.Add (cancel_button);
|
||||||
|
|
||||||
|
|
||||||
Controller.UpdateSetupContinueButtonEvent += delegate (bool enabled) {
|
Controller.UpdateSetupContinueButtonEvent += delegate (bool enabled) {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
continue_button.IsEnabled = enabled;
|
continue_button.IsEnabled = enabled;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
name_box.TextChanged += delegate {
|
name_box.TextChanged += delegate {
|
||||||
Controller.CheckSetupPage (name_box.Text, email_box.Text);
|
Controller.CheckSetupPage (name_box.Text, email_box.Text);
|
||||||
};
|
};
|
||||||
|
|
||||||
email_box.TextChanged += delegate {
|
email_box.TextChanged += delegate {
|
||||||
Controller.CheckSetupPage (name_box.Text, email_box.Text);
|
Controller.CheckSetupPage (name_box.Text, email_box.Text);
|
||||||
};
|
};
|
||||||
|
|
||||||
cancel_button.Click += delegate {
|
cancel_button.Click += delegate {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
SparkleUI.StatusIcon.Dispose ();
|
SparkleUI.StatusIcon.Dispose ();
|
||||||
Controller.SetupPageCancelled ();
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.CheckSetupPage (name_box.Text, email_box.Text);
|
Controller.CheckSetupPage (name_box.Text, email_box.Text);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PageType.Invite: {
|
case PageType.Invite: {
|
||||||
Header = "You've received an invite!";
|
Header = "You've received an invite!";
|
||||||
Description = "Do you want to add this project to SparkleShare?";
|
Description = "Do you want to add this project to SparkleShare?";
|
||||||
|
|
||||||
|
|
||||||
TextBlock address_label = new TextBlock () {
|
TextBlock address_label = new TextBlock () {
|
||||||
Text = "Address:",
|
Text = "Address:",
|
||||||
Width = 150,
|
Width = 150,
|
||||||
TextAlignment = TextAlignment.Right
|
TextAlignment = TextAlignment.Right
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock address_value = new TextBlock () {
|
TextBlock address_value = new TextBlock () {
|
||||||
Text = Controller.PendingInvite.Address,
|
Text = Controller.PendingInvite.Address,
|
||||||
Width = 175,
|
Width = 175,
|
||||||
FontWeight = FontWeights.Bold
|
FontWeight = FontWeights.Bold
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
TextBlock path_label = new TextBlock () {
|
TextBlock path_label = new TextBlock () {
|
||||||
Text = "Remote Path:",
|
Text = "Remote Path:",
|
||||||
Width = 150,
|
Width = 150,
|
||||||
TextAlignment = TextAlignment.Right
|
TextAlignment = TextAlignment.Right
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock path_value = new TextBlock () {
|
TextBlock path_value = new TextBlock () {
|
||||||
Width = 175,
|
Width = 175,
|
||||||
Text = Controller.PendingInvite.RemotePath,
|
Text = Controller.PendingInvite.RemotePath,
|
||||||
FontWeight = FontWeights.Bold
|
FontWeight = FontWeights.Bold
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Button cancel_button = new Button () {
|
Button cancel_button = new Button () {
|
||||||
Content = "Cancel"
|
Content = "Cancel"
|
||||||
};
|
};
|
||||||
|
|
||||||
Button add_button = new Button () {
|
Button add_button = new Button () {
|
||||||
Content = "Add"
|
Content = "Add"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (address_label);
|
ContentCanvas.Children.Add (address_label);
|
||||||
Canvas.SetLeft (address_label, 180);
|
Canvas.SetLeft (address_label, 180);
|
||||||
Canvas.SetTop (address_label, 200);
|
Canvas.SetTop (address_label, 200);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (address_value);
|
ContentCanvas.Children.Add (address_value);
|
||||||
Canvas.SetLeft (address_value, 340);
|
Canvas.SetLeft (address_value, 340);
|
||||||
Canvas.SetTop (address_value, 200);
|
Canvas.SetTop (address_value, 200);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (path_label);
|
ContentCanvas.Children.Add (path_label);
|
||||||
Canvas.SetLeft (path_label, 180);
|
Canvas.SetLeft (path_label, 180);
|
||||||
Canvas.SetTop (path_label, 225);
|
Canvas.SetTop (path_label, 225);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (path_value);
|
ContentCanvas.Children.Add (path_value);
|
||||||
Canvas.SetLeft (path_value, 340);
|
Canvas.SetLeft (path_value, 340);
|
||||||
Canvas.SetTop (path_value, 225);
|
Canvas.SetTop (path_value, 225);
|
||||||
|
|
||||||
Buttons.Add (add_button);
|
Buttons.Add (add_button);
|
||||||
Buttons.Add (cancel_button);
|
Buttons.Add (cancel_button);
|
||||||
|
|
||||||
|
|
||||||
cancel_button.Click += delegate {
|
cancel_button.Click += delegate {
|
||||||
Controller.PageCancelled ();
|
Controller.PageCancelled ();
|
||||||
};
|
};
|
||||||
|
|
||||||
add_button.Click += delegate {
|
add_button.Click += delegate {
|
||||||
Controller.InvitePageCompleted ();
|
Controller.InvitePageCompleted ();
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PageType.Add: {
|
case PageType.Add: {
|
||||||
Header = "Where's your project hosted?";
|
Header = "Where's your project hosted?";
|
||||||
|
|
||||||
|
|
||||||
ListView list_view = new ListView () {
|
ListView list_view = new ListView () {
|
||||||
Width = 419,
|
Width = 419,
|
||||||
Height = 195,
|
Height = 195,
|
||||||
SelectionMode = SelectionMode.Single
|
SelectionMode = SelectionMode.Single
|
||||||
};
|
};
|
||||||
|
|
||||||
GridView grid_view = new GridView ();
|
GridView grid_view = new GridView ();
|
||||||
|
|
||||||
grid_view.Columns.Add (
|
grid_view.Columns.Add (
|
||||||
new GridViewColumn {
|
new GridViewColumn {
|
||||||
DisplayMemberBinding = new Binding ("Text")
|
DisplayMemberBinding = new Binding ("Text")
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - Disable column headers
|
// - Disable column headers
|
||||||
// - Add plugin images
|
// - Add plugin images
|
||||||
// - Nicer markup: <b>Name</b>\n<small>Description</small>
|
// - Nicer markup: <b>Name</b>\n<small>Description</small>
|
||||||
foreach (SparklePlugin plugin in Controller.Plugins) {
|
foreach (SparklePlugin plugin in Controller.Plugins) {
|
||||||
list_view.Items.Add (
|
list_view.Items.Add (
|
||||||
new {
|
new {
|
||||||
Text = plugin.Name + "\n" + plugin.Description
|
Text = plugin.Name + "\n" + plugin.Description
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
list_view.View = grid_view;
|
list_view.View = grid_view;
|
||||||
list_view.SelectedIndex = Controller.SelectedPluginIndex;
|
list_view.SelectedIndex = Controller.SelectedPluginIndex;
|
||||||
|
|
||||||
|
|
||||||
TextBlock address_label = new TextBlock () {
|
TextBlock address_label = new TextBlock () {
|
||||||
Text = "Address:",
|
Text = "Address:",
|
||||||
FontWeight = FontWeights.Bold
|
FontWeight = FontWeights.Bold
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBox address_box = new TextBox () {
|
TextBox address_box = new TextBox () {
|
||||||
Width = 200,
|
Width = 200,
|
||||||
Text = Controller.PreviousAddress
|
Text = Controller.PreviousAddress
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock address_help_label = new TextBlock () {
|
TextBlock address_help_label = new TextBlock () {
|
||||||
Text = "",
|
Text = "",
|
||||||
FontSize = 11,
|
FontSize = 11,
|
||||||
Foreground = new SolidColorBrush (Color.FromRgb (128, 128, 128))
|
Foreground = new SolidColorBrush (Color.FromRgb (128, 128, 128))
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock path_label = new TextBlock () {
|
TextBlock path_label = new TextBlock () {
|
||||||
Text = "Remote Path:",
|
Text = "Remote Path:",
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Width = 200
|
Width = 200
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBox path_box = new TextBox () {
|
TextBox path_box = new TextBox () {
|
||||||
Width = 200,
|
Width = 200,
|
||||||
Text = Controller.PreviousPath
|
Text = Controller.PreviousPath
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock path_help_label = new TextBlock () {
|
TextBlock path_help_label = new TextBlock () {
|
||||||
Text = "",
|
Text = "",
|
||||||
FontSize = 11,
|
FontSize = 11,
|
||||||
Width = 200,
|
Width = 200,
|
||||||
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"
|
||||||
};
|
};
|
||||||
|
|
||||||
Button add_button = new Button () {
|
Button add_button = new Button () {
|
||||||
Content = "Add"
|
Content = "Add"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (list_view);
|
ContentCanvas.Children.Add (list_view);
|
||||||
Canvas.SetTop (list_view, 70);
|
Canvas.SetTop (list_view, 70);
|
||||||
Canvas.SetLeft (list_view, 185);
|
Canvas.SetLeft (list_view, 185);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (address_label);
|
ContentCanvas.Children.Add (address_label);
|
||||||
Canvas.SetTop (address_label, 285);
|
Canvas.SetTop (address_label, 285);
|
||||||
Canvas.SetLeft (address_label, 185);
|
Canvas.SetLeft (address_label, 185);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (address_box);
|
ContentCanvas.Children.Add (address_box);
|
||||||
Canvas.SetTop (address_box, 305);
|
Canvas.SetTop (address_box, 305);
|
||||||
Canvas.SetLeft (address_box, 185);
|
Canvas.SetLeft (address_box, 185);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (address_help_label);
|
ContentCanvas.Children.Add (address_help_label);
|
||||||
Canvas.SetTop (address_help_label, 330);
|
Canvas.SetTop (address_help_label, 330);
|
||||||
Canvas.SetLeft (address_help_label, 185);
|
Canvas.SetLeft (address_help_label, 185);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (path_label);
|
ContentCanvas.Children.Add (path_label);
|
||||||
Canvas.SetTop (path_label, 285);
|
Canvas.SetTop (path_label, 285);
|
||||||
Canvas.SetRight (path_label, 30);
|
Canvas.SetRight (path_label, 30);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (path_box);
|
ContentCanvas.Children.Add (path_box);
|
||||||
Canvas.SetTop (path_box, 305);
|
Canvas.SetTop (path_box, 305);
|
||||||
Canvas.SetRight (path_box, 30);
|
Canvas.SetRight (path_box, 30);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (path_help_label);
|
ContentCanvas.Children.Add (path_help_label);
|
||||||
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);
|
||||||
|
|
||||||
|
|
||||||
Controller.ChangeAddressFieldEvent += delegate (string text,
|
Controller.ChangeAddressFieldEvent += delegate (string text,
|
||||||
|
@ -353,82 +353,82 @@ namespace SparkleShare {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
|
Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
add_button.IsEnabled = button_enabled;
|
add_button.IsEnabled = button_enabled;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
list_view.SelectionChanged += delegate {
|
list_view.SelectionChanged += delegate {
|
||||||
Controller.SelectedPluginChanged (list_view.SelectedIndex);
|
Controller.SelectedPluginChanged (list_view.SelectedIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
list_view.KeyDown += delegate {
|
list_view.KeyDown += delegate {
|
||||||
Controller.SelectedPluginChanged (list_view.SelectedIndex);
|
Controller.SelectedPluginChanged (list_view.SelectedIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
address_box.TextChanged += delegate {
|
address_box.TextChanged += delegate {
|
||||||
Controller.CheckAddPage (
|
Controller.CheckAddPage (
|
||||||
address_box.Text,
|
address_box.Text,
|
||||||
path_box.Text,
|
path_box.Text,
|
||||||
list_view.SelectedIndex
|
list_view.SelectedIndex
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
path_box.TextChanged += delegate {
|
path_box.TextChanged += delegate {
|
||||||
Controller.CheckAddPage (
|
Controller.CheckAddPage (
|
||||||
address_box.Text,
|
address_box.Text,
|
||||||
path_box.Text,
|
path_box.Text,
|
||||||
list_view.SelectedIndex
|
list_view.SelectedIndex
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
cancel_button.Click += delegate {
|
cancel_button.Click += delegate {
|
||||||
Controller.PageCancelled ();
|
Controller.PageCancelled ();
|
||||||
};
|
};
|
||||||
|
|
||||||
add_button.Click += delegate {
|
add_button.Click += delegate {
|
||||||
Controller.AddPageCompleted (address_box.Text, path_box.Text);
|
Controller.AddPageCompleted (address_box.Text, path_box.Text);
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.CheckAddPage (
|
Controller.CheckAddPage (
|
||||||
address_box.Text,
|
address_box.Text,
|
||||||
path_box.Text,
|
path_box.Text,
|
||||||
list_view.SelectedIndex
|
list_view.SelectedIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case PageType.Syncing: {
|
case PageType.Syncing: {
|
||||||
Header = "Adding project ‘" + Controller.SyncingFolder + "’…";
|
Header = "Adding project ‘" + Controller.SyncingFolder + "’…";
|
||||||
Description = "This may take a while.\n" +
|
Description = "This may take a while.\n" +
|
||||||
"Are you sure it’s not coffee o'clock?";
|
"Are you sure it’s not coffee o'clock?";
|
||||||
|
|
||||||
|
|
||||||
Button finish_button = new Button () {
|
Button finish_button = new Button () {
|
||||||
Content = "Finish",
|
Content = "Finish",
|
||||||
IsEnabled = false
|
IsEnabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
Button cancel_button = new Button () {
|
Button cancel_button = new Button () {
|
||||||
Content = "Cancel"
|
Content = "Cancel"
|
||||||
};
|
};
|
||||||
|
|
||||||
ProgressBar progress_bar = new ProgressBar () {
|
ProgressBar progress_bar = new ProgressBar () {
|
||||||
Width = 414,
|
Width = 414,
|
||||||
Height = 15,
|
Height = 15,
|
||||||
Value = 1
|
Value = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (progress_bar);
|
ContentCanvas.Children.Add (progress_bar);
|
||||||
Canvas.SetLeft (progress_bar, 185);
|
Canvas.SetLeft (progress_bar, 185);
|
||||||
Canvas.SetTop (progress_bar, 150);
|
Canvas.SetTop (progress_bar, 150);
|
||||||
|
|
||||||
Buttons.Add (finish_button);
|
Buttons.Add (finish_button);
|
||||||
Buttons.Add (cancel_button);
|
Buttons.Add (cancel_button);
|
||||||
|
|
||||||
|
|
||||||
Controller.UpdateProgressBarEvent += delegate (double percentage) {
|
Controller.UpdateProgressBarEvent += delegate (double percentage) {
|
||||||
|
@ -441,51 +441,51 @@ namespace SparkleShare {
|
||||||
Controller.SyncingCancelled ();
|
Controller.SyncingCancelled ();
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case PageType.Error: {
|
case PageType.Error: {
|
||||||
Header = "Something went wrong…";
|
Header = "Something went wrong…";
|
||||||
Description = "Please check the following:";
|
Description = "Please check the following:";
|
||||||
|
|
||||||
// TODO: Bullet points
|
// TODO: Bullet points
|
||||||
|
|
||||||
|
|
||||||
Button cancel_button = new Button () {
|
Button cancel_button = new Button () {
|
||||||
Content = "Cancel"
|
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);
|
Buttons.Add (cancel_button);
|
||||||
|
|
||||||
|
|
||||||
cancel_button.Click += delegate {
|
cancel_button.Click += delegate {
|
||||||
Controller.PageCancelled ();
|
Controller.PageCancelled ();
|
||||||
};
|
};
|
||||||
|
|
||||||
try_again_button.Click += delegate {
|
try_again_button.Click += delegate {
|
||||||
Controller.ErrorPageCompleted ();
|
Controller.ErrorPageCompleted ();
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PageType.Finished: {
|
case PageType.Finished: {
|
||||||
Header = "Project ‘" + Path.GetFileName (Controller.PreviousPath) +
|
Header = "Project ‘" + Path.GetFileName (Controller.PreviousPath) +
|
||||||
"’ succesfully added!";
|
"’ succesfully added!";
|
||||||
|
|
||||||
Description = "Access the files from your SparkleShare folder.";
|
Description = "Access the files from your SparkleShare folder.";
|
||||||
|
|
||||||
|
|
||||||
// TODO: warnings
|
// TODO: warnings
|
||||||
|
|
||||||
Button finish_button = new Button () {
|
Button finish_button = new Button () {
|
||||||
Content = "Finish"
|
Content = "Finish"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -494,45 +494,45 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Buttons.Add (finish_button);
|
Buttons.Add (finish_button);
|
||||||
Buttons.Add (open_folder_button);
|
Buttons.Add (open_folder_button);
|
||||||
|
|
||||||
|
|
||||||
finish_button.Click += delegate {
|
finish_button.Click += delegate {
|
||||||
Controller.FinishPageCompleted ();
|
Controller.FinishPageCompleted ();
|
||||||
};
|
};
|
||||||
|
|
||||||
open_folder_button.Click += delegate {
|
open_folder_button.Click += delegate {
|
||||||
Controller.OpenFolderClicked ();
|
Controller.OpenFolderClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SystemSounds.Exclamation.Play ();
|
SystemSounds.Exclamation.Play ();
|
||||||
// TODO: Catch attention without having to raise the window
|
// TODO: Catch attention without having to raise the window
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PageType.Tutorial: {
|
case PageType.Tutorial: {
|
||||||
|
|
||||||
switch (Controller.TutorialPageNumber) {
|
switch (Controller.TutorialPageNumber) {
|
||||||
case 1: {
|
case 1: {
|
||||||
Header = "What's happening next?";
|
Header = "What's happening next?";
|
||||||
Description = "SparkleShare creates a special folder on your computer " +
|
Description = "SparkleShare creates a special folder on your computer " +
|
||||||
"that will keep track of your projects.";
|
"that will keep track of your projects.";
|
||||||
|
|
||||||
|
|
||||||
WPF.Image slide_image = new WPF.Image () {
|
WPF.Image slide_image = new WPF.Image () {
|
||||||
Width = 350,
|
Width = 350,
|
||||||
Height = 200
|
Height = 200
|
||||||
};
|
};
|
||||||
|
|
||||||
slide_image.Source = SparkleUIHelpers.GetImageSource ("tutorial-slide-1-windows");
|
slide_image.Source = SparkleUIHelpers.GetImageSource ("tutorial-slide-1-windows");
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (slide_image);
|
ContentCanvas.Children.Add (slide_image);
|
||||||
Canvas.SetLeft (slide_image, 215);
|
Canvas.SetLeft (slide_image, 215);
|
||||||
Canvas.SetTop (slide_image, 130);
|
Canvas.SetTop (slide_image, 130);
|
||||||
|
|
||||||
Button skip_tutorial_button = new Button () {
|
Button skip_tutorial_button = new Button () {
|
||||||
Content = "Skip tutorial"
|
Content = "Skip tutorial"
|
||||||
|
@ -543,24 +543,24 @@ namespace SparkleShare {
|
||||||
Content = "Continue"
|
Content = "Continue"
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Add slides
|
// TODO: Add slides
|
||||||
|
|
||||||
Buttons.Add (continue_button);
|
Buttons.Add (continue_button);
|
||||||
Buttons.Add (skip_tutorial_button);
|
Buttons.Add (skip_tutorial_button);
|
||||||
|
|
||||||
|
|
||||||
skip_tutorial_button.Click += delegate {
|
skip_tutorial_button.Click += delegate {
|
||||||
Controller.TutorialSkipped ();
|
Controller.TutorialSkipped ();
|
||||||
};
|
};
|
||||||
|
|
||||||
continue_button.Click += delegate {
|
continue_button.Click += delegate {
|
||||||
Controller.TutorialPageCompleted ();
|
Controller.TutorialPageCompleted ();
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2: {
|
case 2: {
|
||||||
Header = "Sharing files with others";
|
Header = "Sharing files with others";
|
||||||
Description = "All files added to your project folders are synced automatically with " +
|
Description = "All files added to your project folders are synced automatically with " +
|
||||||
"the host and your team members.";
|
"the host and your team members.";
|
||||||
|
@ -570,30 +570,30 @@ namespace SparkleShare {
|
||||||
Content = "Continue"
|
Content = "Continue"
|
||||||
};
|
};
|
||||||
|
|
||||||
WPF.Image slide_image = new WPF.Image () {
|
WPF.Image slide_image = new WPF.Image () {
|
||||||
Width = 350,
|
Width = 350,
|
||||||
Height = 200
|
Height = 200
|
||||||
};
|
};
|
||||||
|
|
||||||
slide_image.Source = SparkleUIHelpers.GetImageSource ("tutorial-slide-2-windows");
|
slide_image.Source = SparkleUIHelpers.GetImageSource ("tutorial-slide-2-windows");
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (slide_image);
|
ContentCanvas.Children.Add (slide_image);
|
||||||
Canvas.SetLeft (slide_image, 215);
|
Canvas.SetLeft (slide_image, 215);
|
||||||
Canvas.SetTop (slide_image, 130);
|
Canvas.SetTop (slide_image, 130);
|
||||||
|
|
||||||
Buttons.Add (continue_button);
|
Buttons.Add (continue_button);
|
||||||
|
|
||||||
|
|
||||||
continue_button.Click += delegate {
|
continue_button.Click += delegate {
|
||||||
Controller.TutorialPageCompleted ();
|
Controller.TutorialPageCompleted ();
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3: {
|
case 3: {
|
||||||
Header = "The status icon is here to help";
|
Header = "The status icon is here to help";
|
||||||
Description = "It shows the syncing progress, provides easy access to " +
|
Description = "It shows the syncing progress, provides easy access to " +
|
||||||
"your projects and let's you view recent changes.";
|
"your projects and let's you view recent changes.";
|
||||||
|
|
||||||
|
@ -602,80 +602,80 @@ namespace SparkleShare {
|
||||||
Content = "Continue"
|
Content = "Continue"
|
||||||
};
|
};
|
||||||
|
|
||||||
WPF.Image slide_image = new WPF.Image () {
|
WPF.Image slide_image = new WPF.Image () {
|
||||||
Width = 350,
|
Width = 350,
|
||||||
Height = 200
|
Height = 200
|
||||||
};
|
};
|
||||||
|
|
||||||
slide_image.Source = SparkleUIHelpers.GetImageSource ("tutorial-slide-3-windows");
|
slide_image.Source = SparkleUIHelpers.GetImageSource ("tutorial-slide-3-windows");
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (slide_image);
|
ContentCanvas.Children.Add (slide_image);
|
||||||
Canvas.SetLeft (slide_image, 215);
|
Canvas.SetLeft (slide_image, 215);
|
||||||
Canvas.SetTop (slide_image, 130);
|
Canvas.SetTop (slide_image, 130);
|
||||||
|
|
||||||
Buttons.Add (continue_button);
|
Buttons.Add (continue_button);
|
||||||
|
|
||||||
|
|
||||||
continue_button.Click += delegate {
|
continue_button.Click += delegate {
|
||||||
Controller.TutorialPageCompleted ();
|
Controller.TutorialPageCompleted ();
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 4: {
|
case 4: {
|
||||||
Header = "Adding projects to SparkleShare";
|
Header = "Adding projects to SparkleShare";
|
||||||
Description = "You can do this through the status icon menu, or by clicking " +
|
Description = "You can do this through the status icon menu, or by clicking " +
|
||||||
"magic buttons on webpages that look like this:";
|
"magic buttons on webpages that look like this:";
|
||||||
|
|
||||||
|
|
||||||
Button finish_button = new Button () {
|
Button finish_button = new Button () {
|
||||||
Content = "Finish"
|
Content = "Finish"
|
||||||
};
|
};
|
||||||
|
|
||||||
WPF.Image slide_image = new WPF.Image () {
|
WPF.Image slide_image = new WPF.Image () {
|
||||||
Width = 350,
|
Width = 350,
|
||||||
Height = 64
|
Height = 64
|
||||||
};
|
};
|
||||||
|
|
||||||
slide_image.Source = SparkleUIHelpers.GetImageSource ("tutorial-slide-4");
|
slide_image.Source = SparkleUIHelpers.GetImageSource ("tutorial-slide-4");
|
||||||
|
|
||||||
CheckBox check_box = new CheckBox () {
|
CheckBox check_box = new CheckBox () {
|
||||||
Content = "Add SparkleShare to startup items",
|
Content = "Add SparkleShare to startup items",
|
||||||
IsChecked = true
|
IsChecked = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (slide_image);
|
ContentCanvas.Children.Add (slide_image);
|
||||||
Canvas.SetLeft (slide_image, 215);
|
Canvas.SetLeft (slide_image, 215);
|
||||||
Canvas.SetTop (slide_image, 130);
|
Canvas.SetTop (slide_image, 130);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (check_box);
|
ContentCanvas.Children.Add (check_box);
|
||||||
Canvas.SetLeft (check_box, 185);
|
Canvas.SetLeft (check_box, 185);
|
||||||
Canvas.SetBottom (check_box, 12);
|
Canvas.SetBottom (check_box, 12);
|
||||||
|
|
||||||
Buttons.Add (finish_button);
|
Buttons.Add (finish_button);
|
||||||
|
|
||||||
|
|
||||||
check_box.Click += delegate {
|
check_box.Click += delegate {
|
||||||
Controller.StartupItemChanged (check_box.IsChecked.Value);
|
Controller.StartupItemChanged (check_box.IsChecked.Value);
|
||||||
};
|
};
|
||||||
|
|
||||||
finish_button.Click += delegate {
|
finish_button.Click += delegate {
|
||||||
Controller.TutorialPageCompleted ();
|
Controller.TutorialPageCompleted ();
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,80 +31,80 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleSetupWindow : Window {
|
public class SparkleSetupWindow : Window {
|
||||||
|
|
||||||
public Canvas ContentCanvas = new Canvas ();
|
public Canvas ContentCanvas = new Canvas ();
|
||||||
public List <Button> Buttons = new List <Button> ();
|
public List <Button> Buttons = new List <Button> ();
|
||||||
public string Header;
|
public string Header;
|
||||||
public string Description;
|
public string Description;
|
||||||
|
|
||||||
private Image side_splash;
|
private Image side_splash;
|
||||||
private Rectangle bar;
|
private Rectangle bar;
|
||||||
|
|
||||||
private Rectangle line;
|
private Rectangle line;
|
||||||
|
|
||||||
|
|
||||||
public SparkleSetupWindow ()
|
public SparkleSetupWindow ()
|
||||||
{
|
{
|
||||||
Title = "SparkleShare Setup";
|
Title = "SparkleShare Setup";
|
||||||
Width = 640;
|
Width = 640;
|
||||||
Height = 440;
|
Height = 440;
|
||||||
ResizeMode = ResizeMode.NoResize;
|
ResizeMode = ResizeMode.NoResize;
|
||||||
Background = new SolidColorBrush (Colors.WhiteSmoke);
|
Background = new SolidColorBrush (Colors.WhiteSmoke);
|
||||||
|
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
Content = ContentCanvas;
|
Content = ContentCanvas;
|
||||||
|
|
||||||
Closing += Close;
|
Closing += Close;
|
||||||
|
|
||||||
this.bar = new Rectangle () {
|
this.bar = new Rectangle () {
|
||||||
Width = Width,
|
Width = Width,
|
||||||
Height = 40,
|
Height = 40,
|
||||||
Fill = new SolidColorBrush (Color.FromRgb (240, 240, 240))
|
Fill = new SolidColorBrush (Color.FromRgb (240, 240, 240))
|
||||||
};
|
};
|
||||||
|
|
||||||
this.line = new Rectangle () {
|
this.line = new Rectangle () {
|
||||||
Width = Width,
|
Width = Width,
|
||||||
Height = 1,
|
Height = 1,
|
||||||
Fill = new SolidColorBrush (Color.FromRgb (223, 223, 223))
|
Fill = new SolidColorBrush (Color.FromRgb (223, 223, 223))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.side_splash = new Image () {
|
this.side_splash = new Image () {
|
||||||
Width = 150,
|
Width = 150,
|
||||||
Height = 482
|
Height = 482
|
||||||
};
|
};
|
||||||
|
|
||||||
this.side_splash.Source = SparkleUIHelpers.GetImageSource ("side-splash");
|
this.side_splash.Source = SparkleUIHelpers.GetImageSource ("side-splash");
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (this.bar);
|
ContentCanvas.Children.Add (this.bar);
|
||||||
Canvas.SetRight (bar, 0);
|
Canvas.SetRight (bar, 0);
|
||||||
Canvas.SetBottom (bar, 0);
|
Canvas.SetBottom (bar, 0);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (this.line);
|
ContentCanvas.Children.Add (this.line);
|
||||||
Canvas.SetRight (this.line, 0);
|
Canvas.SetRight (this.line, 0);
|
||||||
Canvas.SetBottom (this.line, 40);
|
Canvas.SetBottom (this.line, 40);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (this.side_splash);
|
ContentCanvas.Children.Add (this.side_splash);
|
||||||
Canvas.SetLeft (this.side_splash, 0);
|
Canvas.SetLeft (this.side_splash, 0);
|
||||||
Canvas.SetBottom (this.side_splash, 0);
|
Canvas.SetBottom (this.side_splash, 0);
|
||||||
|
|
||||||
// TODO: enable keyboard navigation
|
// TODO: enable keyboard navigation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Reset ()
|
public void Reset ()
|
||||||
{
|
{
|
||||||
ContentCanvas.Children.Remove (this.bar);
|
ContentCanvas.Children.Remove (this.bar);
|
||||||
|
|
||||||
ContentCanvas.Children.Remove (this.line);
|
ContentCanvas.Children.Remove (this.line);
|
||||||
|
|
||||||
ContentCanvas.Children.Remove (this.side_splash);
|
ContentCanvas.Children.Remove (this.side_splash);
|
||||||
ContentCanvas = new Canvas ();
|
ContentCanvas = new Canvas ();
|
||||||
Content = ContentCanvas;
|
Content = ContentCanvas;
|
||||||
|
|
||||||
ContentCanvas.Children.Add (this.bar);
|
ContentCanvas.Children.Add (this.bar);
|
||||||
ContentCanvas.Children.Add (this.line);
|
ContentCanvas.Children.Add (this.line);
|
||||||
ContentCanvas.Children.Add (this.side_splash);
|
ContentCanvas.Children.Add (this.side_splash);
|
||||||
|
|
||||||
Buttons = new List <Button> ();
|
Buttons = new List <Button> ();
|
||||||
Header = "";
|
Header = "";
|
||||||
|
@ -112,59 +112,59 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowAll ()
|
public void ShowAll ()
|
||||||
{
|
{
|
||||||
Label header_label = new Label () {
|
Label header_label = new Label () {
|
||||||
Content = Header,
|
Content = Header,
|
||||||
Foreground = new SolidColorBrush (Color.FromRgb (0, 51, 153)),
|
Foreground = new SolidColorBrush (Color.FromRgb (0, 51, 153)),
|
||||||
FontSize = 16
|
FontSize = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock description_label = new TextBlock () {
|
TextBlock description_label = new TextBlock () {
|
||||||
Text = Description,
|
Text = Description,
|
||||||
TextWrapping = TextWrapping.Wrap,
|
TextWrapping = TextWrapping.Wrap,
|
||||||
Width = 375
|
Width = 375
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ContentCanvas.Children.Add (header_label);
|
ContentCanvas.Children.Add (header_label);
|
||||||
Canvas.SetLeft (header_label, 180);
|
Canvas.SetLeft (header_label, 180);
|
||||||
Canvas.SetTop (header_label, 18);
|
Canvas.SetTop (header_label, 18);
|
||||||
|
|
||||||
ContentCanvas.Children.Add (description_label);
|
ContentCanvas.Children.Add (description_label);
|
||||||
Canvas.SetLeft (description_label, 185);
|
Canvas.SetLeft (description_label, 185);
|
||||||
Canvas.SetTop (description_label, 60);
|
Canvas.SetTop (description_label, 60);
|
||||||
|
|
||||||
|
|
||||||
if (Buttons.Count > 0) {
|
if (Buttons.Count > 0) {
|
||||||
Buttons [0].IsDefault = true;
|
Buttons [0].IsDefault = true;
|
||||||
|
|
||||||
int right = 9;
|
int right = 9;
|
||||||
|
|
||||||
foreach (Button button in Buttons) {
|
foreach (Button button in Buttons) {
|
||||||
button.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
|
button.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
|
||||||
Rect rect = new Rect (button.DesiredSize);
|
Rect rect = new Rect (button.DesiredSize);
|
||||||
|
|
||||||
button.Width = rect.Width + 26;
|
button.Width = rect.Width + 26;
|
||||||
|
|
||||||
if (button.Width < 75)
|
if (button.Width < 75)
|
||||||
button.Width = 75;
|
button.Width = 75;
|
||||||
|
|
||||||
ContentCanvas.Children.Add (button);
|
ContentCanvas.Children.Add (button);
|
||||||
Canvas.SetRight (button, right);
|
Canvas.SetRight (button, right);
|
||||||
Canvas.SetBottom (button, 9);
|
Canvas.SetBottom (button, 9);
|
||||||
|
|
||||||
right += (int) button.Width + 9;
|
right += (int) button.Width + 9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ElementHost.EnableModelessKeyboardInterop (this);
|
ElementHost.EnableModelessKeyboardInterop (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Close (object sender, CancelEventArgs args)
|
private void Close (object sender, CancelEventArgs args)
|
||||||
{
|
{
|
||||||
args.Cancel = true;
|
args.Cancel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,17 +31,17 @@ namespace SparkleShare {
|
||||||
|
|
||||||
private Forms.Timer Animation;
|
private Forms.Timer Animation;
|
||||||
private Icon [] AnimationFrames;
|
private Icon [] AnimationFrames;
|
||||||
private Icon ErrorIcon;
|
private Icon ErrorIcon;
|
||||||
private int FrameNumber;
|
private int FrameNumber;
|
||||||
private string StateText;
|
private string StateText;
|
||||||
private ContextMenu context_menu;
|
private ContextMenu context_menu;
|
||||||
private SparkleMenuItem status_item;
|
private SparkleMenuItem status_item;
|
||||||
private SparkleMenuItem exit_item;
|
private SparkleMenuItem exit_item;
|
||||||
|
|
||||||
private Forms.NotifyIcon notify_icon = new Forms.NotifyIcon () {
|
private Forms.NotifyIcon notify_icon = new Forms.NotifyIcon () {
|
||||||
Text = "SparkleShare",
|
Text = "SparkleShare",
|
||||||
Visible = true
|
Visible = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Short alias for the translations
|
// Short alias for the translations
|
||||||
|
@ -51,19 +51,19 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SparkleStatusIcon ()
|
public SparkleStatusIcon ()
|
||||||
{
|
{
|
||||||
AnimationFrames = CreateAnimationFrames ();
|
AnimationFrames = CreateAnimationFrames ();
|
||||||
Animation = CreateAnimation ();
|
Animation = CreateAnimation ();
|
||||||
this.notify_icon.Icon = AnimationFrames [0];
|
this.notify_icon.Icon = AnimationFrames [0];
|
||||||
ErrorIcon = GetIconFromBitmap (SparkleUIHelpers.GetBitmap ("sparkleshare-syncing-error-windows"));
|
ErrorIcon = GetIconFromBitmap (SparkleUIHelpers.GetBitmap ("sparkleshare-syncing-error-windows"));
|
||||||
|
|
||||||
this.notify_icon.MouseClick += delegate {
|
this.notify_icon.MouseClick += delegate {
|
||||||
this.context_menu.Placement = PlacementMode.Mouse;
|
this.context_menu.Placement = PlacementMode.Mouse;
|
||||||
this.context_menu.IsOpen = true;
|
this.context_menu.IsOpen = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Controller.Folders.Length == 0)
|
if (Controller.Folders.Length == 0)
|
||||||
StateText = _("Welcome to SparkleShare!");
|
StateText = _("Welcome to SparkleShare!");
|
||||||
else
|
else
|
||||||
StateText = _("Files up to date") + Controller.FolderSize;
|
StateText = _("Files up to date") + Controller.FolderSize;
|
||||||
|
@ -71,12 +71,12 @@ namespace SparkleShare {
|
||||||
CreateMenu ();
|
CreateMenu ();
|
||||||
|
|
||||||
|
|
||||||
Controller.UpdateQuitItemEvent += delegate (bool enable) {
|
Controller.UpdateQuitItemEvent += delegate (bool enable) {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
this.exit_item.IsEnabled = enable;
|
this.exit_item.IsEnabled = enable;
|
||||||
this.exit_item.UpdateLayout ();
|
this.exit_item.UpdateLayout ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Controller.UpdateMenuEvent += delegate (IconState state) {
|
Controller.UpdateMenuEvent += delegate (IconState state) {
|
||||||
|
@ -93,12 +93,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
this.status_item.Header = StateText;
|
this.status_item.Header = StateText;
|
||||||
this.notify_icon.Icon = AnimationFrames [0];
|
this.notify_icon.Icon = AnimationFrames [0];
|
||||||
|
|
||||||
CreateMenu ();
|
CreateMenu ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IconState.Syncing: {
|
case IconState.Syncing: {
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ namespace SparkleShare {
|
||||||
Animation.Start ();
|
Animation.Start ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IconState.Error: {
|
case IconState.Error: {
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.status_item.UpdateLayout ();
|
this.status_item.UpdateLayout ();
|
||||||
});
|
});
|
||||||
|
@ -176,128 +176,128 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void CreateMenu ()
|
public void CreateMenu ()
|
||||||
{
|
{
|
||||||
this.context_menu = new ContextMenu ();
|
this.context_menu = new ContextMenu ();
|
||||||
|
|
||||||
status_item = new SparkleMenuItem () {
|
status_item = new SparkleMenuItem () {
|
||||||
Header = StateText,
|
Header = StateText,
|
||||||
IsEnabled = false
|
IsEnabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
System.Windows.Controls.Image i = new System.Windows.Controls.Image();
|
System.Windows.Controls.Image i = new System.Windows.Controls.Image();
|
||||||
i.Source = SparkleUIHelpers.GetImageSource ("folder-sparkleshare-windows-16");
|
i.Source = SparkleUIHelpers.GetImageSource ("folder-sparkleshare-windows-16");
|
||||||
i.Width = 16;
|
i.Width = 16;
|
||||||
i.Height = 16;
|
i.Height = 16;
|
||||||
|
|
||||||
SparkleMenuItem folder_item = new SparkleMenuItem () {
|
SparkleMenuItem folder_item = new SparkleMenuItem () {
|
||||||
Header = "SparkleShare",
|
Header = "SparkleShare",
|
||||||
Icon = i
|
Icon = i
|
||||||
};
|
};
|
||||||
|
|
||||||
folder_item.Click += delegate {
|
folder_item.Click += delegate {
|
||||||
Controller.SparkleShareClicked ();
|
Controller.SparkleShareClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
SparkleMenuItem add_item = new SparkleMenuItem () {
|
SparkleMenuItem add_item = new SparkleMenuItem () {
|
||||||
Header = "Add Hosted Project…",
|
Header = "Add Hosted Project…",
|
||||||
IsEnabled = (!Program.Controller.FirstRun)
|
IsEnabled = (!Program.Controller.FirstRun)
|
||||||
};
|
};
|
||||||
|
|
||||||
add_item.Click += delegate {
|
add_item.Click += delegate {
|
||||||
Controller.AddHostedProjectClicked ();
|
Controller.AddHostedProjectClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
SparkleMenuItem log_item = new SparkleMenuItem () {
|
SparkleMenuItem log_item = new SparkleMenuItem () {
|
||||||
Header = "View Recent Changes…",
|
Header = "View Recent Changes…",
|
||||||
IsEnabled = (Program.Controller.Folders.Count > 0)
|
IsEnabled = (Program.Controller.Folders.Count > 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
log_item.Click += delegate {
|
log_item.Click += delegate {
|
||||||
Controller.OpenRecentEventsClicked ();
|
Controller.OpenRecentEventsClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
SparkleMenuItem notify_item = new SparkleMenuItem ();
|
SparkleMenuItem notify_item = new SparkleMenuItem ();
|
||||||
|
|
||||||
if (Program.Controller.NotificationsEnabled)
|
if (Program.Controller.NotificationsEnabled)
|
||||||
notify_item = new SparkleMenuItem () { Header = "Turn Notifications Off" };
|
notify_item = new SparkleMenuItem () { Header = "Turn Notifications Off" };
|
||||||
else
|
else
|
||||||
notify_item = new SparkleMenuItem () { Header = "Turn Notifications On" };
|
notify_item = new SparkleMenuItem () { Header = "Turn Notifications On" };
|
||||||
|
|
||||||
notify_item.Click += delegate {
|
notify_item.Click += delegate {
|
||||||
Program.Controller.ToggleNotifications ();
|
Program.Controller.ToggleNotifications ();
|
||||||
CreateMenu ();
|
CreateMenu ();
|
||||||
};
|
};
|
||||||
|
|
||||||
SparkleMenuItem about_item = new SparkleMenuItem () {
|
SparkleMenuItem about_item = new SparkleMenuItem () {
|
||||||
Header = "About SparkleShare"
|
Header = "About SparkleShare"
|
||||||
};
|
};
|
||||||
|
|
||||||
about_item.Click += delegate {
|
about_item.Click += delegate {
|
||||||
Controller.AboutClicked ();
|
Controller.AboutClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
exit_item = new SparkleMenuItem () {
|
exit_item = new SparkleMenuItem () {
|
||||||
Header = "Exit"
|
Header = "Exit"
|
||||||
};
|
};
|
||||||
|
|
||||||
this.exit_item.Click += delegate {
|
this.exit_item.Click += delegate {
|
||||||
this.notify_icon.Dispose ();
|
this.notify_icon.Dispose ();
|
||||||
Controller.QuitClicked ();
|
Controller.QuitClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.context_menu.Items.Add (status_item);
|
this.context_menu.Items.Add (status_item);
|
||||||
this.context_menu.Items.Add (new Separator ());
|
this.context_menu.Items.Add (new Separator ());
|
||||||
this.context_menu.Items.Add (folder_item);
|
this.context_menu.Items.Add (folder_item);
|
||||||
|
|
||||||
if (Program.Controller.Folders.Count > 0) {
|
if (Program.Controller.Folders.Count > 0) {
|
||||||
foreach (string folder_name in Program.Controller.Folders) {
|
foreach (string folder_name in Program.Controller.Folders) {
|
||||||
SparkleMenuItem subfolder_item = new SparkleMenuItem () {
|
SparkleMenuItem subfolder_item = new SparkleMenuItem () {
|
||||||
Header = folder_name
|
Header = folder_name
|
||||||
};
|
};
|
||||||
|
|
||||||
subfolder_item.Click += OpenFolderDelegate (folder_name);
|
subfolder_item.Click += OpenFolderDelegate (folder_name);
|
||||||
|
|
||||||
System.Windows.Controls.Image i2 = new System.Windows.Controls.Image();
|
System.Windows.Controls.Image i2 = new System.Windows.Controls.Image();
|
||||||
i2.Source = SparkleUIHelpers.GetImageSource ("folder-windows-16");
|
i2.Source = SparkleUIHelpers.GetImageSource ("folder-windows-16");
|
||||||
i2.Width = 16;
|
i2.Width = 16;
|
||||||
i2.Height = 16;
|
i2.Height = 16;
|
||||||
subfolder_item.Icon = i2;
|
subfolder_item.Icon = i2;
|
||||||
/*
|
/*
|
||||||
if (Program.Controller.UnsyncedFolders.Contains (folder_name))
|
if (Program.Controller.UnsyncedFolders.Contains (folder_name))
|
||||||
subfolder_item.Icon = Icons.dialog_error_16;
|
subfolder_item.Icon = Icons.dialog_error_16;
|
||||||
else
|
else
|
||||||
subfolder_item.Icon = Icons.sparkleshare_windows_status;
|
subfolder_item.Icon = Icons.sparkleshare_windows_status;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.context_menu.Items.Add (subfolder_item);
|
this.context_menu.Items.Add (subfolder_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SparkleMenuItem no_folders_item = new SparkleMenuItem () {
|
SparkleMenuItem no_folders_item = new SparkleMenuItem () {
|
||||||
Header = "No projects yet",
|
Header = "No projects yet",
|
||||||
IsEnabled = false
|
IsEnabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
this.context_menu.Items.Add (no_folders_item);
|
this.context_menu.Items.Add (no_folders_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.context_menu.Items.Add (new Separator ());
|
this.context_menu.Items.Add (new Separator ());
|
||||||
this.context_menu.Items.Add (add_item);
|
this.context_menu.Items.Add (add_item);
|
||||||
this.context_menu.Items.Add (new Separator ());
|
this.context_menu.Items.Add (new Separator ());
|
||||||
this.context_menu.Items.Add (log_item);
|
this.context_menu.Items.Add (log_item);
|
||||||
this.context_menu.Items.Add (notify_item);
|
this.context_menu.Items.Add (notify_item);
|
||||||
this.context_menu.Items.Add (new Separator ());
|
this.context_menu.Items.Add (new Separator ());
|
||||||
this.context_menu.Items.Add (about_item);
|
this.context_menu.Items.Add (about_item);
|
||||||
this.context_menu.Items.Add (new Separator ());
|
this.context_menu.Items.Add (new Separator ());
|
||||||
this.context_menu.Items.Add (this.exit_item);
|
this.context_menu.Items.Add (this.exit_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowBalloon (string title, string subtext, string image_path)
|
public void ShowBalloon (string title, string subtext, string image_path)
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
// - Use the image pointed to by image_path
|
// - Use the image pointed to by image_path
|
||||||
// - Find a way to use the prettier (Win7?) balloons
|
// - Find a way to use the prettier (Win7?) balloons
|
||||||
this.notify_icon.ShowBalloonTip (5 * 1000, title, subtext, Forms.ToolTipIcon.Info);
|
this.notify_icon.ShowBalloonTip (5 * 1000, title, subtext, Forms.ToolTipIcon.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,16 +328,16 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[DllImport("user32.dll", EntryPoint = "DestroyIcon")]
|
[DllImport("user32.dll", EntryPoint = "DestroyIcon")]
|
||||||
static extern bool DestroyIcon (IntPtr hIcon);
|
static extern bool DestroyIcon (IntPtr hIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SparkleMenuItem : MenuItem {
|
public class SparkleMenuItem : MenuItem {
|
||||||
|
|
||||||
public SparkleMenuItem () : base ()
|
public SparkleMenuItem () : base ()
|
||||||
{
|
{
|
||||||
Padding = new Thickness (6, 3, 4, 0);
|
Padding = new Thickness (6, 3, 4, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,10 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleUI {
|
public class SparkleUI {
|
||||||
|
|
||||||
public static SparkleSetup Setup;
|
public static SparkleSetup Setup;
|
||||||
public static SparkleEventLog EventLog;
|
public static SparkleEventLog EventLog;
|
||||||
public static SparkleBubbles Bubbles;
|
public static SparkleBubbles Bubbles;
|
||||||
public static SparkleStatusIcon StatusIcon;
|
public static SparkleStatusIcon StatusIcon;
|
||||||
public static SparkleAbout About;
|
public static SparkleAbout About;
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ namespace SparkleShare {
|
||||||
Bubbles = new SparkleBubbles ();
|
Bubbles = new SparkleBubbles ();
|
||||||
StatusIcon = new SparkleStatusIcon ();
|
StatusIcon = new SparkleStatusIcon ();
|
||||||
|
|
||||||
Program.Controller.UIHasLoaded ();
|
Program.Controller.UIHasLoaded ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,19 +31,19 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static BitmapFrame GetImageSource (string name)
|
public static BitmapFrame GetImageSource (string name)
|
||||||
{
|
{
|
||||||
Assembly assembly = Assembly.GetExecutingAssembly ();
|
Assembly assembly = Assembly.GetExecutingAssembly ();
|
||||||
Stream image_stream = assembly.GetManifestResourceStream ("SparkleShare.Pixmaps." + name + ".png");
|
Stream image_stream = assembly.GetManifestResourceStream ("SparkleShare.Pixmaps." + name + ".png");
|
||||||
return BitmapFrame.Create (image_stream);
|
return BitmapFrame.Create (image_stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Bitmap GetBitmap (string name)
|
public static Bitmap GetBitmap (string name)
|
||||||
{
|
{
|
||||||
Assembly assembly = Assembly.GetExecutingAssembly ();
|
Assembly assembly = Assembly.GetExecutingAssembly ();
|
||||||
Stream image_stream = assembly.GetManifestResourceStream ("SparkleShare.Pixmaps." + name + ".png");
|
Stream image_stream = assembly.GetManifestResourceStream ("SparkleShare.Pixmaps." + name + ".png");
|
||||||
return (Bitmap) Bitmap.FromStream (image_stream);
|
return (Bitmap) Bitmap.FromStream (image_stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace SparkleShare
|
||||||
{
|
{
|
||||||
public class Strings
|
public class Strings
|
||||||
{
|
{
|
||||||
private static Object resourceManLock = new Object();
|
private static Object resourceManLock = new Object();
|
||||||
private static System.Resources.ResourceManager resourceMan;
|
private static System.Resources.ResourceManager resourceMan;
|
||||||
private static System.Globalization.CultureInfo resourceCulture;
|
private static System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ namespace SparkleShare
|
||||||
|
|
||||||
private static string GetSetting(string setting, string defaultValue)
|
private static string GetSetting(string setting, string defaultValue)
|
||||||
{
|
{
|
||||||
var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings");
|
var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings");
|
||||||
if (section == null) return defaultValue;
|
if (section == null) return defaultValue;
|
||||||
else return section[setting] ?? defaultValue;
|
else return section[setting] ?? defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,15 +65,15 @@ namespace SparkleShare
|
||||||
|
|
||||||
if (object.ReferenceEquals(resourceMan, null))
|
if (object.ReferenceEquals(resourceMan, null))
|
||||||
{
|
{
|
||||||
lock (resourceManLock)
|
lock (resourceManLock)
|
||||||
{
|
{
|
||||||
if (object.ReferenceEquals(resourceMan, null))
|
if (object.ReferenceEquals(resourceMan, null))
|
||||||
{
|
{
|
||||||
var directory = resourcesDir;
|
var directory = resourcesDir;
|
||||||
var mgr = new global::Gettext.Cs.GettextResourceManager(ResourceName, directory, fileFormat);
|
var mgr = new global::Gettext.Cs.GettextResourceManager(ResourceName, directory, fileFormat);
|
||||||
resourceMan = mgr;
|
resourceMan = mgr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<#@ assembly name="System.Configuration" #>
|
<#@ assembly name="System.Configuration" #>
|
||||||
|
|
||||||
<#
|
<#
|
||||||
this.ClassName = "Strings";
|
this.ClassName = "Strings";
|
||||||
this.ResourceName = "Strings";
|
this.ResourceName = "Strings";
|
||||||
this.NamespaceName = "SparkleShare";
|
this.NamespaceName = "SparkleShare";
|
||||||
this.DefaultResourceDir = "po";
|
this.DefaultResourceDir = "po";
|
||||||
this.DefaultFileFormat = "{{culture}}.po";
|
this.DefaultFileFormat = "{{culture}}.po";
|
||||||
|
|
Loading…
Reference in a new issue