Merge pull request #1584 from BarryThePenguin/pausing-windows
Windows pausing and note creation
This commit is contained in:
commit
124c882f9b
37
SparkleShare/Windows/SparkleNote.xaml
Normal file
37
SparkleShare/Windows/SparkleNote.xaml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<Window x:Class="SparkleShare.SparkleNote"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="240" d:DesignWidth="480" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Width="480" Height="240">
|
||||||
|
<Grid x:Name="cover" Margin="18">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="60" />
|
||||||
|
<RowDefinition Height="72" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="48" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Rectangle RadiusX="5" RadiusY="5" Width="48" Height="48" StrokeThickness="0" >
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<ImageBrush x:Name="user_image" />
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="1" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="left" Orientation="Vertical">
|
||||||
|
<TextBlock x:Name="user_name_text_block" TextAlignment="Left" Height="22" Width="320" Grid.Column="1" FontWeight="Bold"></TextBlock>
|
||||||
|
<TextBlock x:Name="user_email_text_field" TextAlignment="Left" Height="20" Width="320" Grid.Column="1"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBox x:Name="balloon_text_field" Grid.Row="1" Grid.ColumnSpan="2" Width="438" Height="72" BorderBrush="{x:Null}" BorderThickness="0" Padding="8,12,8,8" TextWrapping="Wrap" AcceptsReturn="True" Text="Anything to add?" >
|
||||||
|
<TextBox.Background>
|
||||||
|
<ImageBrush ImageSource="pack://application:,,,/SparkleShare;component/Pixmaps/text-balloon.png" Stretch="Uniform"></ImageBrush>
|
||||||
|
</TextBox.Background>
|
||||||
|
</TextBox>
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="2" VerticalAlignment="Bottom" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||||
|
<Button x:Name="cancel_button" Content="Cancel" Width="75" Margin="0,0,9,0" VerticalAlignment="Center" IsCancel="True"></Button>
|
||||||
|
<Button x:Name="sync_button" Content="Sync" Width="75" VerticalAlignment="Center" IsDefault="True"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
123
SparkleShare/Windows/SparkleNote.xaml.cs
Normal file
123
SparkleShare/Windows/SparkleNote.xaml.cs
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
// SparkleShare, a collaboration and sharing tool.
|
||||||
|
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Forms.Integration;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
using SparkleLib;
|
||||||
|
|
||||||
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
public partial class SparkleNote : Window {
|
||||||
|
|
||||||
|
public SparkleNoteController Controller = new SparkleNoteController ();
|
||||||
|
|
||||||
|
private readonly string default_text = "Anything to add?";
|
||||||
|
|
||||||
|
public SparkleNote()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
Background = new SolidColorBrush(Color.FromRgb(240, 240, 240));
|
||||||
|
AllowsTransparency = false;
|
||||||
|
Icon = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
|
||||||
|
Closing += this.OnClosing;
|
||||||
|
|
||||||
|
Controller.ShowWindowEvent += delegate {
|
||||||
|
Dispatcher.BeginInvoke((Action)(() => {
|
||||||
|
Show();
|
||||||
|
Activate();
|
||||||
|
CreateNote();
|
||||||
|
BringIntoView();
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
Controller.HideWindowEvent += delegate {
|
||||||
|
Dispatcher.BeginInvoke ((Action) (() => {
|
||||||
|
Hide ();
|
||||||
|
this.balloon_text_field.Clear();
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.cancel_button.Click += delegate {
|
||||||
|
Dispatcher.BeginInvoke ((Action) (() => {
|
||||||
|
Controller.CancelClicked ();
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.sync_button.Click += delegate {
|
||||||
|
Dispatcher.BeginInvoke ((Action) (() => {
|
||||||
|
string note = this.balloon_text_field.Text;
|
||||||
|
|
||||||
|
if (note.Equals (default_text, StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
|
note = String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.SyncClicked (note);
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.balloon_text_field.GotFocus += OnTextBoxGotFocus;
|
||||||
|
this.balloon_text_field.LostFocus += OnTextBoxLostFocus;
|
||||||
|
|
||||||
|
CreateNote();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateNote()
|
||||||
|
{
|
||||||
|
ImageSource avatar = SparkleUIHelpers.GetImageSource("user-icon-default");
|
||||||
|
|
||||||
|
if (File.Exists (Controller.AvatarFilePath)) {
|
||||||
|
avatar = SparkleUIHelpers.GetImage (Controller.AvatarFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.user_image.ImageSource = avatar;
|
||||||
|
this.Title = Controller.CurrentProject ?? "Add Note";
|
||||||
|
this.user_name_text_block.Text = Program.Controller.CurrentUser.Name;
|
||||||
|
this.user_email_text_field.Text = Program.Controller.CurrentUser.Email;
|
||||||
|
this.balloon_text_field.Text = default_text;
|
||||||
|
|
||||||
|
ElementHost.EnableModelessKeyboardInterop (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClosing (object sender, CancelEventArgs cancel_event_args)
|
||||||
|
{
|
||||||
|
Controller.WindowClosed ();
|
||||||
|
cancel_event_args.Cancel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTextBoxGotFocus (object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.balloon_text_field.Text.Equals (default_text, StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
|
this.balloon_text_field.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTextBoxLostFocus (object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty (this.balloon_text_field.Text)) {
|
||||||
|
this.balloon_text_field.Text = default_text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -79,6 +79,9 @@
|
||||||
<Compile Include="..\SparkleInvite.cs">
|
<Compile Include="..\SparkleInvite.cs">
|
||||||
<Link>SparkleInvite.cs</Link>
|
<Link>SparkleInvite.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\SparkleNoteController.cs">
|
||||||
|
<Link>SparkleNoteController.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\SparklePlugin.cs">
|
<Compile Include="..\SparklePlugin.cs">
|
||||||
<Link>SparklePlugin.cs</Link>
|
<Link>SparklePlugin.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -89,6 +92,9 @@
|
||||||
<Compile Include="SparkleEventLogWindow.xaml.cs">
|
<Compile Include="SparkleEventLogWindow.xaml.cs">
|
||||||
<DependentUpon>SparkleEventLogWindow.xaml</DependentUpon>
|
<DependentUpon>SparkleEventLogWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="SparkleNote.xaml.cs">
|
||||||
|
<DependentUpon>SparkleNote.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="SparkleShortcut.cs" />
|
<Compile Include="SparkleShortcut.cs" />
|
||||||
<Compile Include="SparkleUI.cs" />
|
<Compile Include="SparkleUI.cs" />
|
||||||
<Compile Include="..\SparkleAboutController.cs" />
|
<Compile Include="..\SparkleAboutController.cs" />
|
||||||
|
@ -260,6 +266,9 @@
|
||||||
<EmbeddedResource Include="Pixmaps\tutorial-slide-3.png" />
|
<EmbeddedResource Include="Pixmaps\tutorial-slide-3.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Resource Include="..\Common\Pixmaps\text-balloon.png">
|
||||||
|
<Link>Pixmaps\text-balloon.png</Link>
|
||||||
|
</Resource>
|
||||||
<Content Include="Pixmaps\sparkleshare-folder.ico" />
|
<Content Include="Pixmaps\sparkleshare-folder.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -267,6 +276,10 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="SparkleNote.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="SparkleLib\Git\SparkleLib.Git.csproj">
|
<ProjectReference Include="SparkleLib\Git\SparkleLib.Git.csproj">
|
||||||
|
|
|
@ -229,6 +229,20 @@ namespace SparkleShare {
|
||||||
subfolder_item.Items.Add(state_menu_items[i]);
|
subfolder_item.Items.Add(state_menu_items[i]);
|
||||||
subfolder_item.Items.Add(new Separator());
|
subfolder_item.Items.Add(new Separator());
|
||||||
|
|
||||||
|
SparkleMenuItem open_item = new SparkleMenuItem {
|
||||||
|
Header = "Open folder",
|
||||||
|
Icon = new Image
|
||||||
|
{
|
||||||
|
Source = SparkleUIHelpers.GetImageSource("folder"),
|
||||||
|
Width = 16,
|
||||||
|
Height = 16
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
open_item.Click += new RoutedEventHandler(Controller.OpenFolderDelegate(project.Name));
|
||||||
|
subfolder_item.Items.Add(open_item);
|
||||||
|
subfolder_item.Items.Add(new Separator());
|
||||||
|
|
||||||
if(project.IsPaused) {
|
if(project.IsPaused) {
|
||||||
SparkleMenuItem resume_item;
|
SparkleMenuItem resume_item;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace SparkleShare {
|
||||||
public SparkleBubbles Bubbles;
|
public SparkleBubbles Bubbles;
|
||||||
public SparkleStatusIcon StatusIcon;
|
public SparkleStatusIcon StatusIcon;
|
||||||
public SparkleAbout About;
|
public SparkleAbout About;
|
||||||
|
public SparkleNote Note;
|
||||||
|
|
||||||
static SparkleUI ()
|
static SparkleUI ()
|
||||||
{
|
{
|
||||||
|
@ -43,12 +44,13 @@ namespace SparkleShare {
|
||||||
// FIXME: The second time windows are shown, the windows
|
// FIXME: The second time windows are shown, the windows
|
||||||
// don't have the smooth ease in animation, but appear abruptly.
|
// don't have the smooth ease in animation, but appear abruptly.
|
||||||
// The ease out animation always seems to work
|
// The ease out animation always seems to work
|
||||||
Setup = new SparkleSetup ();
|
Setup = new SparkleSetup ();
|
||||||
EventLog = new SparkleEventLogWindow();
|
EventLog = new SparkleEventLogWindow();
|
||||||
About = new SparkleAbout ();
|
About = new SparkleAbout ();
|
||||||
Bubbles = new SparkleBubbles ();
|
Bubbles = new SparkleBubbles ();
|
||||||
StatusIcon = new SparkleStatusIcon ();
|
StatusIcon = new SparkleStatusIcon ();
|
||||||
|
Note = new SparkleNote ();
|
||||||
|
|
||||||
Program.Controller.UIHasLoaded ();
|
Program.Controller.UIHasLoaded ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,17 @@ namespace SparkleShare {
|
||||||
Stream image_stream = assembly.GetManifestResourceStream("SparkleShare.Pixmaps." + name + "." + type);
|
Stream image_stream = assembly.GetManifestResourceStream("SparkleShare.Pixmaps." + name + "." + type);
|
||||||
return BitmapFrame.Create(image_stream);
|
return BitmapFrame.Create(image_stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ImageSource GetImage(string absolutePath)
|
||||||
|
{
|
||||||
|
BitmapImage image = new BitmapImage();
|
||||||
|
image.BeginInit();
|
||||||
|
image.UriSource = new Uri(absolutePath, UriKind.Absolute);
|
||||||
|
image.CacheOption = BitmapCacheOption.OnDemand;
|
||||||
|
image.EndInit();
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
public static Drawing.Bitmap GetBitmap (string name)
|
public static Drawing.Bitmap GetBitmap (string name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue