windows: implement Add page
This commit is contained in:
parent
466a2146f3
commit
cfde4a8c8e
|
@ -244,7 +244,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void UIHasLoaded ()
|
public void UIHasLoaded ()
|
||||||
{
|
{
|
||||||
// if (FirstRun)
|
if (FirstRun)
|
||||||
ShowSetupWindow (PageType.Setup);
|
ShowSetupWindow (PageType.Setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,17 +16,9 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
#if __MonoCS__
|
#if __MonoCS__
|
||||||
using Mono.Unix;
|
using Mono.Unix;
|
||||||
//using Mono.Unix.Native;
|
|
||||||
#endif
|
#endif
|
||||||
using SparkleLib;
|
using SparkleLib;
|
||||||
|
|
||||||
|
@ -42,22 +34,19 @@ namespace SparkleShare {
|
||||||
// Short alias for the translations
|
// Short alias for the translations
|
||||||
public static string _ (string s)
|
public static string _ (string s)
|
||||||
{
|
{
|
||||||
#if __MonoCS__
|
#if __MonoCS__
|
||||||
return Catalog.GetString (s);
|
return Catalog.GetString (s);
|
||||||
#else
|
#else
|
||||||
return Strings.T(s);
|
return Strings.T (s);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !__MonoCS__
|
||||||
#if !__MonoCS__
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
#endif
|
#endif
|
||||||
public static void Main (string [] args)
|
public static void Main (string [] args)
|
||||||
{
|
{
|
||||||
SetUiCulture();
|
|
||||||
|
|
||||||
// Parse the command line options
|
// Parse the command line options
|
||||||
bool show_help = false;
|
bool show_help = false;
|
||||||
OptionSet option_set = new OptionSet () {
|
OptionSet option_set = new OptionSet () {
|
||||||
|
@ -88,19 +77,11 @@ namespace SparkleShare {
|
||||||
UI.Run ();
|
UI.Run ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !__MonoCS__
|
#if !__MonoCS__
|
||||||
// For now we must do GC.Collect to free some internal handles, otherwise
|
// Suppress assertion messages in debug mode
|
||||||
// in debug mode you can got assertion message.
|
|
||||||
GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
|
GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
|
||||||
GC.WaitForPendingFinalizers ();
|
GC.WaitForPendingFinalizers ();
|
||||||
CefSharp.CEF.Shutdown (); // Shutdown CEF.
|
#endif
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetUiCulture()
|
|
||||||
{
|
|
||||||
//var culture = CultureInfo.GetCultureInfo ("en"); // FIXME: test only
|
|
||||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,10 +97,10 @@ namespace SparkleShare {
|
||||||
Console.WriteLine (_("This is free software, and you are welcome to redistribute it "));
|
Console.WriteLine (_("This is free software, and you are welcome to redistribute it "));
|
||||||
Console.WriteLine (_("under certain conditions. Please read the GNU GPLv3 for details."));
|
Console.WriteLine (_("under certain conditions. Please read the GNU GPLv3 for details."));
|
||||||
Console.WriteLine (" ");
|
Console.WriteLine (" ");
|
||||||
Console.WriteLine (_("SparkleShare automatically syncs Git repositories in "));
|
Console.WriteLine (_("SparkleShare is a collaboration and sharing tool that is "));
|
||||||
Console.WriteLine (_("the ~/SparkleShare folder with their remote origins."));
|
Console.WriteLine (_("designed to keep things simple and to stay out of your way."));
|
||||||
Console.WriteLine (" ");
|
Console.WriteLine (" ");
|
||||||
Console.WriteLine (_("Usage: sparkleshare [start|stop|restart] [OPTION]..."));
|
Console.WriteLine (_("Usage: sparkleshare [start|stop|restart|version] [OPTION]..."));
|
||||||
Console.WriteLine (_("Sync SparkleShare folder with remote repositories."));
|
Console.WriteLine (_("Sync SparkleShare folder with remote repositories."));
|
||||||
Console.WriteLine (" ");
|
Console.WriteLine (" ");
|
||||||
Console.WriteLine (_("Arguments:"));
|
Console.WriteLine (_("Arguments:"));
|
||||||
|
@ -129,32 +110,10 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Prints the version information
|
|
||||||
public static void PrintVersion ()
|
public static void PrintVersion ()
|
||||||
{
|
{
|
||||||
Console.WriteLine (_("SparkleShare " + Defines.VERSION));
|
Console.WriteLine (_("SparkleShare " + Defines.VERSION));
|
||||||
Environment.Exit (0);
|
Environment.Exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __MonoCS__
|
|
||||||
// Strange magic needed by SetProcessName ()
|
|
||||||
[DllImport ("libc")]
|
|
||||||
private static extern int prctl (int option, byte [] arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Sets the Unix process name to 'sparkleshare' instead of 'mono'
|
|
||||||
private static void SetProcessName (string name)
|
|
||||||
{
|
|
||||||
#if __MonoCS__
|
|
||||||
try {
|
|
||||||
if (prctl (15, Encoding.ASCII.GetBytes (name + "\0"), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero) != 0)
|
|
||||||
throw new ApplicationException ("Error setting process name: " +
|
|
||||||
Mono.Unix.Native.Stdlib.GetLastError ());
|
|
||||||
|
|
||||||
} catch (EntryPointNotFoundException) {
|
|
||||||
Console.WriteLine ("SetProcessName: Entry point not found");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,11 +96,7 @@ namespace SparkleShare {
|
||||||
Height = 260
|
Height = 260
|
||||||
};
|
};
|
||||||
|
|
||||||
image.Source =
|
image.Source = SparkleUIHelpers.GetBitmap ("about");
|
||||||
System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
|
|
||||||
Icons.about.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty,
|
|
||||||
BitmapSizeOptions.FromWidthAndHeight(640, 260));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Label version = new Label () {
|
Label version = new Label () {
|
||||||
|
@ -112,7 +108,7 @@ namespace SparkleShare {
|
||||||
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))
|
Foreground = new SolidColorBrush (Color.FromRgb (45, 62, 81))
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock credits = new TextBlock () {
|
TextBlock credits = new TextBlock () {
|
||||||
|
|
|
@ -16,12 +16,18 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Media;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Forms.Integration;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Media;
|
||||||
|
using WPF = System.Windows.Controls;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
@ -67,7 +73,6 @@ namespace SparkleShare {
|
||||||
TextBox name_box = new TextBox () {
|
TextBox name_box = new TextBox () {
|
||||||
Text = Controller.GuessedUserName,
|
Text = Controller.GuessedUserName,
|
||||||
Width = 175
|
Width = 175
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,6 +146,70 @@ namespace SparkleShare {
|
||||||
Header = "Where's your project hosted?";
|
Header = "Where's your project hosted?";
|
||||||
|
|
||||||
|
|
||||||
|
ListView list_view = new ListView () {
|
||||||
|
Width = 419,
|
||||||
|
Height = 195,
|
||||||
|
SelectionMode = SelectionMode.Single
|
||||||
|
};
|
||||||
|
|
||||||
|
GridView grid_view = new GridView ();
|
||||||
|
|
||||||
|
grid_view.Columns.Add (
|
||||||
|
new GridViewColumn {
|
||||||
|
DisplayMemberBinding = new Binding ("Text")
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
// - Disable column headers
|
||||||
|
// - Add plugin images
|
||||||
|
// - Nicer markup: <b>Name</b>\n<small>Description</small>
|
||||||
|
foreach (SparklePlugin plugin in Controller.Plugins) {
|
||||||
|
list_view.Items.Add (
|
||||||
|
new {
|
||||||
|
Text = plugin.Name + "\n" + plugin.Description
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
list_view.View = grid_view;
|
||||||
|
list_view.SelectedIndex = Controller.SelectedPluginIndex;
|
||||||
|
|
||||||
|
|
||||||
|
TextBlock address_label = new TextBlock () {
|
||||||
|
Text = "Address:",
|
||||||
|
FontWeight = FontWeights.Bold
|
||||||
|
};
|
||||||
|
|
||||||
|
TextBox address_box = new TextBox () {
|
||||||
|
Width = 200,
|
||||||
|
Text = Controller.PreviousAddress
|
||||||
|
};
|
||||||
|
|
||||||
|
TextBlock address_help_label = new TextBlock () {
|
||||||
|
Text = "",
|
||||||
|
FontSize = 11,
|
||||||
|
Foreground = new SolidColorBrush (Color.FromRgb (128, 128, 128))
|
||||||
|
};
|
||||||
|
|
||||||
|
TextBlock path_label = new TextBlock () {
|
||||||
|
Text = "Remote Path:",
|
||||||
|
FontWeight = FontWeights.Bold,
|
||||||
|
Width = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
TextBox path_box = new TextBox () {
|
||||||
|
Width = 200,
|
||||||
|
Text = Controller.PreviousPath
|
||||||
|
};
|
||||||
|
|
||||||
|
TextBlock path_help_label = new TextBlock () {
|
||||||
|
Text = "",
|
||||||
|
FontSize = 11,
|
||||||
|
Width = 200,
|
||||||
|
Foreground = new SolidColorBrush (Color.FromRgb (128, 128, 128))
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
Button cancel_button = new Button () {
|
Button cancel_button = new Button () {
|
||||||
Content = "Cancel"
|
Content = "Cancel"
|
||||||
};
|
};
|
||||||
|
@ -150,24 +219,104 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ContentCanvas.Children.Add (list_view);
|
||||||
|
Canvas.SetTop (list_view, 70);
|
||||||
|
Canvas.SetLeft (list_view, 185);
|
||||||
|
|
||||||
|
ContentCanvas.Children.Add (address_label);
|
||||||
|
Canvas.SetTop (address_label, 285);
|
||||||
|
Canvas.SetLeft (address_label, 185);
|
||||||
|
|
||||||
|
ContentCanvas.Children.Add (address_box);
|
||||||
|
Canvas.SetTop (address_box, 305);
|
||||||
|
Canvas.SetLeft (address_box, 185);
|
||||||
|
|
||||||
|
ContentCanvas.Children.Add (address_help_label);
|
||||||
|
Canvas.SetTop (address_help_label, 330);
|
||||||
|
Canvas.SetLeft (address_help_label, 185);
|
||||||
|
|
||||||
|
ContentCanvas.Children.Add (path_label);
|
||||||
|
Canvas.SetTop (path_label, 285);
|
||||||
|
Canvas.SetRight (path_label, 30);
|
||||||
|
|
||||||
|
ContentCanvas.Children.Add (path_box);
|
||||||
|
Canvas.SetTop (path_box, 305);
|
||||||
|
Canvas.SetRight (path_box, 30);
|
||||||
|
|
||||||
|
ContentCanvas.Children.Add (path_help_label);
|
||||||
|
Canvas.SetTop (path_help_label, 330);
|
||||||
|
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,
|
||||||
|
string example_text, FieldState state) {
|
||||||
|
|
||||||
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
|
address_box.Text = text;
|
||||||
|
address_box.IsEnabled = (state == FieldState.Enabled);
|
||||||
|
address_help_label.Text = example_text;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Controller.ChangePathFieldEvent += delegate (string text,
|
||||||
|
string example_text, FieldState state) {
|
||||||
|
|
||||||
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
|
path_box.Text = text;
|
||||||
|
path_box.IsEnabled = (state == FieldState.Enabled);
|
||||||
|
path_help_label.Text = example_text;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
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 {
|
||||||
|
Controller.SelectedPluginChanged (list_view.SelectedIndex);
|
||||||
|
};
|
||||||
|
|
||||||
|
list_view.KeyDown += delegate {
|
||||||
|
Controller.SelectedPluginChanged (list_view.SelectedIndex);
|
||||||
|
};
|
||||||
|
|
||||||
|
address_box.TextChanged += delegate {
|
||||||
|
Controller.CheckAddPage (
|
||||||
|
address_box.Text,
|
||||||
|
path_box.Text,
|
||||||
|
list_view.SelectedIndex
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
path_box.TextChanged += delegate {
|
||||||
|
Controller.CheckAddPage (
|
||||||
|
address_box.Text,
|
||||||
|
path_box.Text,
|
||||||
|
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 ("github.com", "hbons/Stuff"); // TODO
|
Controller.AddPageCompleted (address_box.Text, path_box.Text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Controller.CheckAddPage (
|
||||||
|
address_box.Text,
|
||||||
|
path_box.Text,
|
||||||
|
list_view.SelectedIndex
|
||||||
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,6 +461,7 @@ namespace SparkleShare {
|
||||||
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.";
|
||||||
|
|
||||||
|
|
||||||
Button continue_button = new Button () {
|
Button continue_button = new Button () {
|
||||||
Content = "Continue"
|
Content = "Continue"
|
||||||
};
|
};
|
||||||
|
@ -335,8 +485,21 @@ namespace SparkleShare {
|
||||||
Content = "Continue"
|
Content = "Continue"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
WPF.Image slide_image = new WPF.Image () {
|
||||||
|
Width = 350,
|
||||||
|
Height = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
slide_image.Source = SparkleUIHelpers.GetBitmap ("tutorial-slide-3-windows");
|
||||||
|
|
||||||
|
|
||||||
|
ContentCanvas.Children.Add (slide_image);
|
||||||
|
Canvas.SetLeft (slide_image, 215);
|
||||||
|
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 ();
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,6 @@ using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
@ -74,11 +73,9 @@ namespace SparkleShare {
|
||||||
Height = 482
|
Height = 482
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.side_splash.Source = SparkleUIHelpers.GetBitmap ("side-splash");
|
this.side_splash.Source = SparkleUIHelpers.GetBitmap ("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);
|
||||||
|
|
|
@ -104,9 +104,6 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ApplicationSchemeHandler.cs" />
|
<Compile Include="ApplicationSchemeHandler.cs" />
|
||||||
<Compile Include="AssemblyInfo.cs" />
|
<Compile Include="AssemblyInfo.cs" />
|
||||||
<Compile Include="controls\ExampleTextBox.cs">
|
|
||||||
<SubType>Component</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="FileSchemeHandler.cs" />
|
<Compile Include="FileSchemeHandler.cs" />
|
||||||
<Compile Include="Icons.Designer.cs">
|
<Compile Include="Icons.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
|
@ -126,11 +123,9 @@
|
||||||
<Compile Include="SparkleController.cs" />
|
<Compile Include="SparkleController.cs" />
|
||||||
<Compile Include="SparkleEventLog.cs" />
|
<Compile Include="SparkleEventLog.cs" />
|
||||||
<Compile Include="SparkleSetup.cs" />
|
<Compile Include="SparkleSetup.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="SparkleStatusIcon.cs" />
|
<Compile Include="SparkleStatusIcon.cs" />
|
||||||
<Compile Include="SparkleUIHelpers.cs" />
|
<Compile Include="SparkleUIHelpers.cs" />
|
||||||
<Compile Include="controls\TablessControl.cs">
|
|
||||||
<SubType>Component</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Strings.cs">
|
<Compile Include="Strings.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
@ -140,9 +135,6 @@
|
||||||
<Link>SparkleEventLogController.cs</Link>
|
<Link>SparkleEventLogController.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="SparkleSetupWindow.cs" />
|
<Compile Include="SparkleSetupWindow.cs" />
|
||||||
<Compile Include="..\Program.cs">
|
|
||||||
<Link>Program.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\SparkleLib\windows\SparkleLib.csproj">
|
<ProjectReference Include="..\..\SparkleLib\windows\SparkleLib.csproj">
|
||||||
|
@ -215,9 +207,22 @@
|
||||||
<DependentUpon>SparkleSetup.cs</DependentUpon>
|
<DependentUpon>SparkleSetup.cs</DependentUpon>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="..\..\data\about.png">
|
||||||
|
<Link>Pixmaps\about.png</Link>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="..\..\data\side-splash.png">
|
<EmbeddedResource Include="..\..\data\side-splash.png">
|
||||||
<Link>Pixmaps\side-splash.png</Link>
|
<Link>Pixmaps\side-splash.png</Link>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="..\..\data\tutorial-slide-1-windows.png">
|
||||||
|
<Link>Pixmaps\tutorial-slide-1-windows.png</Link>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="..\..\data\tutorial-slide-3-windows.png">
|
||||||
|
<Link>Pixmaps\tutorial-slide-3-windows.png</Link>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="..\..\data\plugins\bitbucket.png">
|
||||||
|
<Link>plugins\bitbucket.png</Link>
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Icons.tt">
|
<None Include="Icons.tt">
|
||||||
|
@ -226,10 +231,6 @@
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\data\plugins\bitbucket.png">
|
|
||||||
<Link>plugins\bitbucket.png</Link>
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="..\..\data\plugins\github.png">
|
<None Include="..\..\data\plugins\github.png">
|
||||||
<Link>plugins\github.png</Link>
|
<Link>plugins\github.png</Link>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
@ -393,7 +394,6 @@
|
||||||
<Content Include="..\..\data\icons\sparkleshare.ico" />
|
<Content Include="..\..\data\icons\sparkleshare.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="New Folder\" />
|
|
||||||
<Folder Include="Pixmaps\" />
|
<Folder Include="Pixmaps\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -25,6 +25,7 @@ using System.Windows.Controls;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
|
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleStatusIcon : Control {
|
public class SparkleStatusIcon : Control {
|
||||||
|
@ -40,7 +41,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
private WinForms.NotifyIcon notify_icon = new WinForms.NotifyIcon () {
|
private WinForms.NotifyIcon notify_icon = new WinForms.NotifyIcon () {
|
||||||
Text = "SparkleShare",
|
Text = "SparkleShare",
|
||||||
|
|
||||||
Visible = true
|
Visible = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,6 +55,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleStatusIcon ()
|
public SparkleStatusIcon ()
|
||||||
{
|
{
|
||||||
|
LostFocus += delegate {
|
||||||
|
|
||||||
|
this.context_menu.IsOpen = false;
|
||||||
|
};
|
||||||
|
|
||||||
notify_icon.Icon = Icon.FromHandle(Icons.document_added_12.GetHicon());
|
notify_icon.Icon = Icon.FromHandle(Icons.document_added_12.GetHicon());
|
||||||
AnimationFrames = CreateAnimationFrames ();
|
AnimationFrames = CreateAnimationFrames ();
|
||||||
Animation = CreateAnimation ();
|
Animation = CreateAnimation ();
|
||||||
|
@ -65,7 +70,6 @@ namespace SparkleShare {
|
||||||
SetNormalState ();
|
SetNormalState ();
|
||||||
|
|
||||||
|
|
||||||
//TODO quit item event
|
|
||||||
|
|
||||||
Controller.UpdateQuitItemEvent += delegate (bool enable) {
|
Controller.UpdateQuitItemEvent += delegate (bool enable) {
|
||||||
Dispatcher.Invoke ((Action) delegate {
|
Dispatcher.Invoke ((Action) delegate {
|
||||||
|
@ -404,3 +408,10 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace SparkleShare.controls {
|
|
||||||
public class ExampleTextBox : TextBox {
|
|
||||||
|
|
||||||
private bool ExampleTextActive = true;
|
|
||||||
private bool OnTextChangedActive = true;
|
|
||||||
private bool _focused = false;
|
|
||||||
|
|
||||||
private string _ExampleText = "";
|
|
||||||
public string ExampleText
|
|
||||||
{
|
|
||||||
get { return _ExampleText; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_ExampleText = value;
|
|
||||||
if (ExampleTextActive)
|
|
||||||
ActivateExampleText ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string Text
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (ExampleTextActive)
|
|
||||||
return "";
|
|
||||||
return base.Text;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (String.IsNullOrEmpty (value)) {
|
|
||||||
ActivateExampleText ();
|
|
||||||
} else {
|
|
||||||
ExampleTextActive = false;
|
|
||||||
ForeColor = System.Drawing.SystemColors.WindowText;
|
|
||||||
base.Text = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ActivateExampleText ()
|
|
||||||
{
|
|
||||||
OnTextChangedActive = false;
|
|
||||||
base.Text = ExampleText;
|
|
||||||
OnTextChangedActive = true;
|
|
||||||
ExampleTextActive = true;
|
|
||||||
ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnTextChanged (EventArgs e)
|
|
||||||
{
|
|
||||||
if (!OnTextChangedActive)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool Empty = String.IsNullOrEmpty (base.Text);
|
|
||||||
if (Empty) {
|
|
||||||
ActivateExampleText ();
|
|
||||||
SelectAll ();
|
|
||||||
} else if (ExampleTextActive) {
|
|
||||||
ExampleTextActive = false;
|
|
||||||
ForeColor = System.Drawing.SystemColors.WindowText;
|
|
||||||
}
|
|
||||||
base.OnTextChanged (e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnEnter (EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnEnter (e);
|
|
||||||
if (ExampleTextActive && MouseButtons == MouseButtons.None) {
|
|
||||||
SelectAll ();
|
|
||||||
_focused = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnLeave (EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnLeave (e);
|
|
||||||
_focused = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnMouseUp (MouseEventArgs mevent)
|
|
||||||
{
|
|
||||||
base.OnMouseUp (mevent);
|
|
||||||
if (!_focused) {
|
|
||||||
if (ExampleTextActive && SelectionLength == 0)
|
|
||||||
SelectAll ();
|
|
||||||
_focused = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace SparkleShare.controls {
|
|
||||||
public class TablessControl : TabControl {
|
|
||||||
protected override void WndProc (ref Message m)
|
|
||||||
{
|
|
||||||
if (m.Msg == 0x1328 && !DesignMode)
|
|
||||||
m.Result = (IntPtr)1;
|
|
||||||
else
|
|
||||||
base.WndProc (ref m);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue