Browse files

merged in wyUpdate branch

  • Loading branch information...
2 parents b5392ff + b4925c7 commit 18318080815cf969cd95095fbbddb2d5a0f7e36b @shiftbot shiftbot committed Mar 22, 2012
View
BIN lib/AutomaticUpdaterWPF.dll
Binary file not shown.
View
9 src/MarkPad.XAML/MarkPad.XAML.csproj
@@ -43,13 +43,14 @@
<Reference Include="Awesomium.Windows.Controls, Version=1.6.3.0, Culture=neutral, PublicKeyToken=7a34e179b8b61c39, processorArchitecture=x86">
<HintPath>..\..\lib\Awesomium.Windows.Controls.dll</HintPath>
</Reference>
- <Reference Include="MahApps.Metro">
- <HintPath>..\..\packages\MahApps.Metro.0.4.0.17\lib\net40\MahApps.Metro.dll</HintPath>
+ <Reference Include="MahApps.Metro, Version=0.7.2.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\packages\MahApps.Metro.0.7.2.0\lib\net40\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
- <Reference Include="System.Windows.Interactivity">
- <HintPath>..\..\packages\MahApps.Metro.0.4.0.17\lib\net40\System.Windows.Interactivity.dll</HintPath>
+ <Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\MahApps.Metro.0.7.2.0\lib\net40\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
View
8 src/MarkPad.XAML/packages.config
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Analects.XAMLConverters" version="1.0" />
- <package id="MahApps.Metro" version="0.4.0.17" />
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Analects.XAMLConverters" version="1.0" />
+ <package id="MahApps.Metro" version="0.7.2.0" />
</packages>
View
BIN src/MarkPad/Fonts/Entypo.ttf
Binary file not shown.
View
30 src/MarkPad/Loader.cs
@@ -10,6 +10,7 @@ namespace MarkPad
internal class Loader
{
const string LibsFolder = "Libs";
+ private const string UpdatesFolder = "Updater";
static readonly Dictionary<string, Assembly> Libraries = new Dictionary<string, Assembly>();
static readonly Dictionary<string, Assembly> ReflectionOnlyLibraries = new Dictionary<string, Assembly>();
@@ -84,6 +85,35 @@ private static void PreloadUnmanagedLibraries()
LoadHunspellLibrary(pointer);
}
}
+
+ var thisFolder = Directory.GetCurrentDirectory();
+ var updates = Assembly.GetExecutingAssembly().GetManifestResourceNames()
+ .Where(s => s.StartsWith(String.Format("{0}.{1}", assemblyName.Name, UpdatesFolder)))
+ .ToArray();
+
+ foreach (var u in updates)
+ {
+ string dllPath = Path.Combine(thisFolder, String.Join(".", u.Split('.').Skip(2)));
+
+ if (!File.Exists(dllPath))
+ {
+ using (Stream stm = Assembly.GetExecutingAssembly().GetManifestResourceStream(u))
+ {
+ // Copy the assembly to the temporary file
+ try
+ {
+ using (Stream outFile = File.Create(dllPath))
+ {
+ stm.CopyTo(outFile);
+ }
+ }
+ catch
+ {
+
+ }
+ }
+ }
+ }
}
private static void LoadHunspellLibrary(IntPtr pointer)
View
31 src/MarkPad/MarkPad.csproj
@@ -68,6 +68,9 @@
<Reference Include="Autofac.Configuration">
<HintPath>..\..\packages\Autofac.2.5.2.830\lib\NET40\Autofac.Configuration.dll</HintPath>
</Reference>
+ <Reference Include="AutomaticUpdaterWPF">
+ <HintPath>..\..\lib\AutomaticUpdaterWPF.dll</HintPath>
+ </Reference>
<Reference Include="Awesomium.Core, Version=1.6.3.0, Culture=neutral, PublicKeyToken=e1a0d7c8071a5214, processorArchitecture=x86">
<HintPath>..\..\lib\Awesomium.Core.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
@@ -91,7 +94,7 @@
<HintPath>..\..\packages\AvalonEdit.4.1.0.8000\lib\Net40\ICSharpCode.AvalonEdit.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro">
- <HintPath>..\..\packages\MahApps.Metro.0.4.0.17\lib\net40\MahApps.Metro.dll</HintPath>
+ <HintPath>..\..\packages\MahApps.Metro.0.7.2.0\lib\net40\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="MarkdownDeep">
<HintPath>..\..\packages\MarkdownDeep.NET.1.4\lib\.NetFramework 3.5\MarkdownDeep.dll</HintPath>
@@ -112,7 +115,7 @@
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\MahApps.Metro.0.4.0.17\lib\net40\System.Windows.Interactivity.dll</HintPath>
+ <HintPath>..\..\packages\MahApps.Metro.0.7.2.0\lib\net40\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
@@ -182,6 +185,15 @@
<Compile Include="Framework\Events\SettingsCloseEvent.cs" />
<Compile Include="Framework\MarkdownHelpers.cs" />
<Compile Include="Document\SpellCheckBackgroundRenderer.cs" />
+ <Compile Include="Updater\UpdaterChangesViewModel.cs" />
+ <Compile Include="Updater\UpdaterChangesView.xaml.cs">
+ <DependentUpon>UpdaterChangesView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Updater\UpdaterView.xaml.cs">
+ <DependentUpon>UpdaterView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Updater\UpdaterViewModel.cs" />
+ <Compile Include="Updater\UpdateState.cs" />
<Page Include="About\AboutView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -249,6 +261,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Updater\UpdaterChangesView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="Updater\UpdaterView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Loader.cs" />
@@ -258,6 +278,9 @@
<EmbeddedResource Include="..\..\lib\AwesomiumProcess">
<Link>Libs\x86\AwesomiumProcess</Link>
</EmbeddedResource>
+ <EmbeddedResource Include="..\..\tools\wyUpdate\client.wyc">
+ <Link>Updater\client.wyc</Link>
+ </EmbeddedResource>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
@@ -329,6 +352,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
+ <Resource Include="Fonts\Entypo.ttf" />
<Resource Include="icon.png" />
<Resource Include="markpad.ico" />
</ItemGroup>
@@ -339,6 +363,9 @@
<EmbeddedResource Include="..\..\lib\Hunspell.0.9.6.0\lib\Hunspellx86.dll">
<Link>Libs\x86\Hunspellx86.dll</Link>
</EmbeddedResource>
+ <EmbeddedResource Include="..\..\tools\wyUpdate\wyUpdate.exe">
+ <Link>Updater\wyUpdate.exe</Link>
+ </EmbeddedResource>
<Content Include="Themes\ChaosSquirrel\style.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
View
34 src/MarkPad/Shell/ShellView.xaml
@@ -18,6 +18,8 @@
Icon="../markpad.ico"
SnapsToDevicePixels="True"
AllowDrop="True"
+ KeyDown="WindowKeyDown"
+ x:Name="window"
d:DataContext="{d:DesignInstance {x:Type Shell:ShellViewModel}}">
<Window.Resources>
@@ -401,6 +403,38 @@
<Button x:Name="OpenFromWeb" Content="OPEN FROM WEB" />
</WrapPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10" Orientation="Horizontal">
+ <!--<Controls:AutomaticUpdater
+ x:Name="au"
+ GUID="code52-markasdfpad-yawnface"
+ BeforeChecking="au_BeforeChecking"
+ BeforeDownloading="au_BeforeDownloading"
+ CheckingFailed="au_CheckingFailed"
+ DownloadingOrExtractingFailed="au_DownloadingOrExtractingFailed"
+ UpdateFailed="au_UpdateFailed"
+ UpdateType="CheckAndDownload"
+ UpdateAvailable="au_UpdateAvailable"
+ UpToDate="au_UpToDate"
+ ReadyToBeInstalled="Au_OnReadyToBeInstalled"
+ Visibility="Collapsed"
+ KeepHidden="True" />
+ <Button x:Name="CheckForUpdate" DataContext="{Binding ElementName=window}" FontFamily="/MarkPad;component/Fonts/#Entypo" Click="CheckForUpdate_OnClick" FontSize="28" Margin="0,-15,10,0">
+ <Button.Style>
+ <Style TargetType="{x:Type Button}" BasedOn="{StaticResource ChromelessButtonStyle}">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UpdateState}" Value="Unchecked">
+ <Setter Property="Button.Content" Value="d" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding UpdateState}" Value="UpToDate">
+ <Setter Property="Button.Content" Value="W" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding UpdateState}" Value="UpdatePending">
+ <Setter Property="Button.Content" Value="?" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Button.Style>
+ </Button>-->
+ <ContentControl x:Name="Updater" />
<Button Content="SETTINGS" Style="{DynamicResource ChromelessButtonStyle}" FontSize="10.667" FontWeight="Bold">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
View
41 src/MarkPad/Shell/ShellView.xaml.cs
@@ -1,10 +1,18 @@
using System.Windows;
using System.Windows.Input;
+using System.Windows.Media.Animation;
namespace MarkPad.Shell
{
public partial class ShellView
{
+ private bool CheatSheetVisible = false;
+
+ public ShellView()
+ {
+ InitializeComponent();
+ }
+
private void DragMoveWindow(object sender, MouseButtonEventArgs e)
{
if (e.RightButton != MouseButtonState.Pressed && e.MiddleButton != MouseButtonState.Pressed && e.LeftButton == MouseButtonState.Pressed)
@@ -72,5 +80,38 @@ private void WindowDragOver(object sender, DragEventArgs e)
e.Effects = isFileDrop ? DragDropEffects.Move : DragDropEffects.None;
e.Handled = true;
}
+
+ private void WindowKeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.F9)
+ {
+ ToggleCheatSheet();
+ }
+ }
+
+ private void ToggleCheatSheet()
+ {
+ if (CheatSheetVisible)
+ {
+ var sb = Resources["HideCheatSheet"] as Storyboard;
+ if (sb == null)
+ return;
+ sb.Begin();
+ }
+ else
+ {
+ var sb = Resources["ShowCheatSheet"] as Storyboard;
+ if (sb == null)
+ return;
+ sb.Begin();
+ }
+
+ CheatSheetVisible = !CheatSheetVisible;
+ }
+
+ private void DismissCheatSheet(object sender, RoutedEventArgs e)
+ {
+ ToggleCheatSheet();
+ }
}
}
View
10 src/MarkPad/Shell/ShellViewModel.cs
@@ -16,6 +16,7 @@
using MarkPad.Services.Interfaces;
using MarkPad.Settings;
using Ookii.Dialogs.Wpf;
+using MarkPad.Updater;
namespace MarkPad.Shell
{
@@ -36,6 +37,7 @@ internal class ShellViewModel : Conductor<IScreen>, IHandle<FileOpenEvent>, IHan
IEventAggregator eventAggregator,
MDIViewModel mdi,
SettingsViewModel settingsCreator,
+ UpdaterViewModel updaterViewModel,
Func<DocumentViewModel> documentCreator,
Func<AboutViewModel> aboutCreator,
Func<OpenFromWebViewModel> openFromWebCreator)
@@ -44,7 +46,8 @@ internal class ShellViewModel : Conductor<IScreen>, IHandle<FileOpenEvent>, IHan
this.dialogService = dialogService;
this.windowManager = windowManager;
this.settingsService = settingsService;
- this.MDI = mdi;
+ MDI = mdi;
+ Updater = updaterViewModel;
this.documentCreator = documentCreator;
this.aboutCreator = aboutCreator;
this.openFromWebCreator = openFromWebCreator;
@@ -69,6 +72,7 @@ public override string DisplayName
public string CurrentState { get; set; }
public MDIViewModel MDI { get; private set; }
public SettingsViewModel Settings { get; private set; }
+ public UpdaterViewModel Updater { get; set; }
public override void CanClose(Action<bool> callback)
{
@@ -78,7 +82,7 @@ public override void CanClose(Action<bool> callback)
public void Exit()
{
- this.TryClose();
+ TryClose();
}
public void NewDocument()
@@ -274,7 +278,7 @@ public void OpenFromWeb()
if (setupBlog)
ShowSettings();
- return;
+ return;
}
var openFromWeb = openFromWebCreator();
View
11 src/MarkPad/Updater/UpdateState.cs
@@ -0,0 +1,11 @@
+namespace MarkPad.Updater
+{
+ public enum UpdateState
+ {
+ Unchecked,
+ UpToDate,
+ UpdatePending,
+ Error,
+ Downloading
+ }
+}
View
37 src/MarkPad/Updater/UpdaterChangesView.xaml
@@ -0,0 +1,37 @@
+<Controls:MetroWindow x:Class="MarkPad.Updater.UpdaterChangesView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
+ ResizeMode="NoResize"
+ WindowStartupLocation="CenterOwner"
+ Height="300" Width="300"
+ ShowInTaskbar="False"
+ ShowTitleBar="false">
+ <Window.Resources>
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
+ <ResourceDictionary Source="pack://application:,,,/MarkPad;component/Styles/MarkPad.Accents.xaml" />
+ </ResourceDictionary.MergedDictionaries>
+ </ResourceDictionary>
+ </Window.Resources>
+ <Window.Background>
+ <LinearGradientBrush MappingMode="Absolute" StartPoint="0,0" EndPoint="0,150">
+ <GradientStop Color="#FFDEDEDE"/>
+ <GradientStop Color="White" Offset="1"/>
+ </LinearGradientBrush>
+ </Window.Background>
+
+ <Grid Margin="10">
+ <TextBlock TextWrapping="Wrap" FontSize="21.333" Text="update available"/>
+ <ScrollViewer Margin="0,50,0,50" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
+
+ <TextBlock x:Name="Message" TextWrapping="Wrap" Text="TextBlock"/>
+ </ScrollViewer>
+ <Button x:Name="Accept" Content="Restart Markpad and Apply" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
+ </Grid>
+</Controls:MetroWindow>
View
10 src/MarkPad/Updater/UpdaterChangesView.xaml.cs
@@ -0,0 +1,10 @@
+namespace MarkPad.Updater
+{
+ public partial class UpdaterChangesView
+ {
+ public UpdaterChangesView()
+ {
+ InitializeComponent();
+ }
+ }
+}
View
26 src/MarkPad/Updater/UpdaterChangesViewModel.cs
@@ -0,0 +1,26 @@
+using Caliburn.Micro;
+
+namespace MarkPad.Updater
+{
+ public class UpdaterChangesViewModel : Screen
+ {
+ public string Message { get; set; }
+ public bool WasCancelled { get; private set; }
+
+ public UpdaterChangesViewModel()
+ {
+ WasCancelled = true;
+ }
+
+ public void Cancel()
+ {
+ TryClose();
+ }
+
+ public void Accept()
+ {
+ WasCancelled = false;
+ TryClose();
+ }
+ }
+}
View
77 src/MarkPad/Updater/UpdaterView.xaml
@@ -0,0 +1,77 @@
+<UserControl x:Class="MarkPad.Updater.UpdaterView"
+ 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"
+ xmlns:sys="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d"
+ d:DesignHeight="300" d:DesignWidth="300">
+ <UserControl.Resources>
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
+ </ResourceDictionary.MergedDictionaries>
+ <sys:String x:Key="CheckForUpdatesTooltip">Check for updates?</sys:String>
+ <sys:String x:Key="CheckingForUpdatesTooltip">Checking for updates, please hold..</sys:String>
+ <sys:String x:Key="UpdatePendingTooltip">There is an update waiting!</sys:String>
+ <sys:String x:Key="UpToDateTooltip">Up to date</sys:String>
+ <Storyboard x:Key="rotate">
+ <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
+ <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="364"/>
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ </ResourceDictionary>
+ </UserControl.Resources>
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="{Binding Progress}" Visibility="Collapsed">
+ <TextBlock.Style>
+ <Style TargetType="{x:Type TextBlock}" >
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UpdateState}" Value="Downloading">
+ <Setter Property="TextBlock.Visibility" Value="Visible" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
+ </TextBlock>
+ <Button x:Name="CheckForUpdate" FontFamily="../Fonts/#Entypo" FontSize="28" Margin="0,-15,10,-15" RenderTransformOrigin="0.45,0.5">
+ <Button.RenderTransform>
+ <TransformGroup>
+ <ScaleTransform/>
+ <SkewTransform/>
+ <RotateTransform/>
+ <TranslateTransform/>
+ </TransformGroup>
+ </Button.RenderTransform>
+ <Button.Style>
+ <Style TargetType="{x:Type Button}" BasedOn="{StaticResource ChromelessButtonStyle}">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding UpdateState}" Value="Unchecked">
+ <Setter Property="Button.Content" Value="d" />
+ <Setter Property="Button.ToolTip" Value="{DynamicResource CheckForUpdatesTooltip}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Background}" Value="True">
+ <DataTrigger.EnterActions>
+ <BeginStoryboard x:Name="rotatestart" Storyboard="{StaticResource rotate}" />
+ </DataTrigger.EnterActions>
+ <DataTrigger.ExitActions>
+ <StopStoryboard BeginStoryboardName="rotatestart" />
+ </DataTrigger.ExitActions>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding UpdateState}" Value="UpToDate">
+ <Setter Property="Button.Content" Value="W" />
+ <Setter Property="Button.ToolTip" Value="{DynamicResource UpToDateTooltip}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding UpdateState}" Value="UpdatePending">
+ <Setter Property="Button.Content" Value="?" />
+ <Setter Property="Button.ToolTip" Value="{DynamicResource UpdatePendingTooltip}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding UpdateState}" Value="Downloading">
+ <Setter Property="Button.Content" Value="x" />
+ <Setter Property="Button.ToolTip" Value="{DynamicResource CheckingForUpdatesTooltip}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Button.Style>
+ </Button>
+ </StackPanel>
+</UserControl>
View
10 src/MarkPad/Updater/UpdaterView.xaml.cs
@@ -0,0 +1,10 @@
+namespace MarkPad.Updater
+{
+ public partial class UpdaterView
+ {
+ public UpdaterView()
+ {
+ InitializeComponent();
+ }
+ }
+}
View
112 src/MarkPad/Updater/UpdaterViewModel.cs
@@ -0,0 +1,112 @@
+using System;
+using Caliburn.Micro;
+using wyDay.Controls;
+
+namespace MarkPad.Updater
+{
+ public class UpdaterViewModel : PropertyChangedBase
+ {
+ private readonly IWindowManager windowManager;
+ private readonly Func<UpdaterChangesViewModel> changesCreator;
+ static AutomaticUpdaterBackend au;
+
+ public int Progress { get; private set; }
+ public UpdateState UpdateState { get; set; }
+ public bool Background { get; set; }
+
+ public UpdaterViewModel(IWindowManager windowManager, Func<UpdaterChangesViewModel> changesCreator)
+ {
+ this.windowManager = windowManager;
+ this.changesCreator = changesCreator;
+
+ au = new AutomaticUpdaterBackend
+ {
+ GUID = "code52-markpad",
+ UpdateType = UpdateType.CheckAndDownload,
+ };
+
+ au.ProgressChanged += AuProgressChanged;
+ au.ReadyToBeInstalled += AuReadyToBeInstalled;
+ au.UpToDate += AuUpToDate;
+ au.UpdateAvailable += AuUpdateAvailable;
+ au.UpdateSuccessful += AuUpdateSuccessful;
+
+ au.Initialize();
+ au.AppLoaded();
+ SetUpdateFlag();
+ }
+
+ void AuUpdateAvailable(object sender, EventArgs e)
+ {
+ SetUpdateFlag();
+ }
+
+ void AuUpToDate(object sender, SuccessArgs e)
+ {
+ SetUpdateFlag();
+ }
+
+ void AuProgressChanged(object sender, int progress)
+ {
+ Progress = progress;
+ }
+
+ private void AuUpdateSuccessful(object sender, SuccessArgs e)
+ {
+ SetUpdateFlag();
+ }
+
+ private void AuReadyToBeInstalled(object sender, EventArgs e)
+ {
+ SetUpdateFlag();
+ }
+
+ public void CheckForUpdate()
+ {
+ switch (au.UpdateStepOn)
+ {
+ case UpdateStepOn.UpdateReadyToInstall:
+ var vm = changesCreator();
+ vm.Message = au.Changes;
+ windowManager.ShowDialog(vm);
+ if (!vm.WasCancelled)
+ au.InstallNow();
+ break;
+
+ case UpdateStepOn.Nothing:
+ Background = true;
+ au.ForceCheckForUpdate();
+ break;
+
+ }
+ }
+
+ private void SetUpdateFlag()
+ {
+ switch (au.UpdateStepOn)
+ {
+ case UpdateStepOn.ExtractingUpdate:
+ case UpdateStepOn.DownloadingUpdate:
+ UpdateState = UpdateState.Downloading;
+ Background = true;
+ break;
+
+ case UpdateStepOn.UpdateDownloaded:
+ case UpdateStepOn.UpdateAvailable:
+ Background = false;
+ au.InstallNow();
+ break;
+
+ case UpdateStepOn.UpdateReadyToInstall:
+ UpdateState = UpdateState.UpdatePending;
+ Background = false;
+ break;
+
+ default:
+ UpdateState = UpdateState.Unchecked;
+ Background = false;
+ break;
+ }
+ }
+ }
+}
View
2 src/MarkPad/packages.config
@@ -4,7 +4,7 @@
<package id="AvalonEdit" version="4.1.0.8000" />
<package id="Caliburn.Micro" version="1.2.0" />
<package id="Caliburn.Micro.Autofac" version="1.3.0" />
- <package id="MahApps.Metro" version="0.4.0.17" />
+ <package id="MahApps.Metro" version="0.7.2.0" />
<package id="MarkdownDeep.NET" version="1.4" />
<package id="Ookii.Dialogs" version="1.0" />
<package id="xmlrpcnet" version="2.5.0" />
View
BIN tools/wyBuild.wyp
Binary file not shown.
View
BIN tools/wyUpdate/client.wyc
Binary file not shown.
View
BIN tools/wyUpdate/wyUpdate.exe
Binary file not shown.

0 comments on commit 1831808

Please sign in to comment.