Permalink
Browse files

Move everything to src directory

  • Loading branch information...
1 parent 61cbc2e commit 3fd629bfaf781a154e89e2b9e84cb791e1becf12 @paulcbetts committed Jan 15, 2010
View
22 App.xaml → src/App.xaml 100755 → 100644
@@ -1,11 +1,11 @@
-<Application x:Class="InstallQueuer.App"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- StartupUri="MainWindow.xaml">
- <Application.Resources>
-
- </Application.Resources>
-</Application>
-
-<!-- vim: ts=4:sts=4:sw=4:et
--->
+<Application x:Class="InstallQueuer.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ StartupUri="MainWindow.xaml">
+ <Application.Resources>
+
+ </Application.Resources>
+</Application>
+
+<!-- vim: ts=4:sts=4:sw=4:et
+-->
View
370 App.xaml.cs → src/App.xaml.cs 100755 → 100644
@@ -1,185 +1,185 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.IO;
-using System.Windows;
-using System.ComponentModel;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition;
-
-namespace InstallQueuer
-{
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : Application
- {
- }
-
- class AppViewModel : INotifyPropertyChanged
- {
- public AppViewModel(IInputElement view) { currentWindow = view; }
-
- [ImportMany]
- public IEnumerable<IPackageInstallerFactory> PackageInstallers { get; set; }
-
- readonly ObservableCollection<InstallableItem> InstallQueue = new ObservableCollection<InstallableItem>();
-
- readonly IInputElement currentWindow;
-
- BackgroundWorker _CurrentRunningJob = null;
- public BackgroundWorker CurrentRunningJob {
- get { return _CurrentRunningJob; }
- set {
- if (_CurrentRunningJob == value)
- return;
- _CurrentRunningJob = value;
- notifyPropertyChanged("CurrentRunningJob");
- notifyPropertyChanged("IsRunning");
- }
- }
-
- public bool IsRunning {
- get { return (CurrentRunningJob != null); }
- }
-
- void continueProcessNextItem()
- {
- var current = InstallQueue.FirstOrDefault(x => x.State == InstallableItemState.Queued);
- if (current == null) // Empty or all items complete
- return;
- if (IsRunning)
- throw new Exception("continueProcessNextItem called when already running");
-
- CurrentRunningJob = current.DoInstallAsync();
- CurrentRunningJob.RunWorkerCompleted += (o,e) => {
- CurrentRunningJob = null;
- ((FrameworkElement)currentWindow).Dispatcher.BeginInvoke(new Action(continueProcessNextItem));
- };
-
- CurrentRunningJob.RunWorkerAsync();
- }
-
-
- //
- // INotifyPropertyChanged stuff
- //
-
- void notifyPropertyChanged(String property)
- {
- if (PropertyChanged != null) {
- PropertyChanged(this, new PropertyChangedEventArgs(property));
- }
- }
- public event PropertyChangedEventHandler PropertyChanged;
- }
-
- enum InstallableItemState {
- Initializing,
- Queued,
- Running,
- Succeeded,
- Failed,
- }
-
- class InstallableItem : INotifyPropertyChanged
- {
- public InstallableItem(IPackageInstaller installer) { PackageInstaller = installer; }
-
- InstallableItemState _State;
- public InstallableItemState State {
- get { return _State; }
- set {
- if (_State == value)
- return;
- _State = value;
- notifypropertychanged("State");
- }
- }
-
- public bool SupportsQuietInstall {
- get { return (PackageInstaller.SupportedFeatures & PackageInstallerSupportedFeatures.UnattendInstall) != 0; }
- }
-
- bool _ShouldQuietInstall;
- public bool ShouldQuietInstall {
- get { return _ShouldQuietInstall; }
- set {
- if (_ShouldQuietInstall == value)
- return;
- _ShouldQuietInstall = value;
- notifyPropertyChanged("ShouldQuietInstall");
- }
- }
-
- public string FullPath {
- get { return PackageInstaller.FilePath; }
- }
-
- public string FileName {
- get { return Path.GetFileName(FullPath); }
- }
-
- string _ErrorMessage
- public string ErrorMessage {
- get { return _ErrorMessage; }
- set {
- if (_ErrorMessage == value)
- return;
- _ErrorMessage = value;
- notifypropertychanged("ErrorMessage");
- }
- }
-
- public readonly IPackageInstaller PackageInstaller;
-
- public BackgroundWorker DoInstallAsync()
- {
- if (State != InstallableItemState.Queued)
- throw new Exception("Only queued items can be started");
-
- State = InstallableItemState.Running;
-
- var ret = new BackgroundWorker();
- ret.DoWork += (o,e) => {
- var opts = new Dictionary<PackageInstallerSupportedFeatures, object>();
- if (SupportsQuietInstall && ShouldQuietInstall)
- opts[PackageInstallerSupportedFeatures.UnattendInstall] = true;
-
- try {
- PackageInstaller.InstallPackage(opts);
- } catch(Exception ex) {
- e.Result = ex;
- }
- };
-
- ret.RunWorkerCompleted += (o,e) => {
- var ex = e.Result as Exception;
-
- if (ex != null)
- ErrorMessage = ex.Message;
-
- State = (ex != null ? InstallableItemState.Failed : InstallableItemState.Succeeded);
- };
-
- return ret;
- }
-
-
- //
- // INotifyPropertyChanged stuff
- //
-
- void notifyPropertyChanged(String property)
- {
- if (PropertyChanged != null) {
- PropertyChanged(this, new PropertyChangedEventArgs(property));
- }
- }
- public event PropertyChangedEventHandler PropertyChanged;
- }
-}
-
-// vim: ts=4:sts=4:sw=4:et
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.IO;
+using System.Windows;
+using System.ComponentModel;
+using System.Collections.ObjectModel;
+using System.ComponentModel.Composition;
+
+namespace InstallQueuer
+{
+ /// <summary>
+ /// Interaction logic for App.xaml
+ /// </summary>
+ public partial class App : Application
+ {
+ }
+
+ class AppViewModel : INotifyPropertyChanged
+ {
+ public AppViewModel(IInputElement view) { currentWindow = view; }
+
+ [ImportMany]
+ public IEnumerable<IPackageInstallerFactory> PackageInstallers { get; set; }
+
+ readonly ObservableCollection<InstallableItem> InstallQueue = new ObservableCollection<InstallableItem>();
+
+ readonly IInputElement currentWindow;
+
+ BackgroundWorker _CurrentRunningJob = null;
+ public BackgroundWorker CurrentRunningJob {
+ get { return _CurrentRunningJob; }
+ set {
+ if (_CurrentRunningJob == value)
+ return;
+ _CurrentRunningJob = value;
+ notifyPropertyChanged("CurrentRunningJob");
+ notifyPropertyChanged("IsRunning");
+ }
+ }
+
+ public bool IsRunning {
+ get { return (CurrentRunningJob != null); }
+ }
+
+ void continueProcessNextItem()
+ {
+ var current = InstallQueue.FirstOrDefault(x => x.State == InstallableItemState.Queued);
+ if (current == null) // Empty or all items complete
+ return;
+ if (IsRunning)
+ throw new Exception("continueProcessNextItem called when already running");
+
+ CurrentRunningJob = current.DoInstallAsync();
+ CurrentRunningJob.RunWorkerCompleted += (o,e) => {
+ CurrentRunningJob = null;
+ ((FrameworkElement)currentWindow).Dispatcher.BeginInvoke(new Action(continueProcessNextItem));
+ };
+
+ CurrentRunningJob.RunWorkerAsync();
+ }
+
+
+ //
+ // INotifyPropertyChanged stuff
+ //
+
+ void notifyPropertyChanged(String property)
+ {
+ if (PropertyChanged != null) {
+ PropertyChanged(this, new PropertyChangedEventArgs(property));
+ }
+ }
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+
+ enum InstallableItemState {
+ Initializing,
+ Queued,
+ Running,
+ Succeeded,
+ Failed,
+ }
+
+ class InstallableItem : INotifyPropertyChanged
+ {
+ public InstallableItem(IPackageInstaller installer) { PackageInstaller = installer; }
+
+ InstallableItemState _State;
+ public InstallableItemState State {
+ get { return _State; }
+ set {
+ if (_State == value)
+ return;
+ _State = value;
+ notifypropertychanged("State");
+ }
+ }
+
+ public bool SupportsQuietInstall {
+ get { return (PackageInstaller.SupportedFeatures & PackageInstallerSupportedFeatures.UnattendInstall) != 0; }
+ }
+
+ bool _ShouldQuietInstall;
+ public bool ShouldQuietInstall {
+ get { return _ShouldQuietInstall; }
+ set {
+ if (_ShouldQuietInstall == value)
+ return;
+ _ShouldQuietInstall = value;
+ notifyPropertyChanged("ShouldQuietInstall");
+ }
+ }
+
+ public string FullPath {
+ get { return PackageInstaller.FilePath; }
+ }
+
+ public string FileName {
+ get { return Path.GetFileName(FullPath); }
+ }
+
+ string _ErrorMessage
+ public string ErrorMessage {
+ get { return _ErrorMessage; }
+ set {
+ if (_ErrorMessage == value)
+ return;
+ _ErrorMessage = value;
+ notifypropertychanged("ErrorMessage");
+ }
+ }
+
+ public readonly IPackageInstaller PackageInstaller;
+
+ public BackgroundWorker DoInstallAsync()
+ {
+ if (State != InstallableItemState.Queued)
+ throw new Exception("Only queued items can be started");
+
+ State = InstallableItemState.Running;
+
+ var ret = new BackgroundWorker();
+ ret.DoWork += (o,e) => {
+ var opts = new Dictionary<PackageInstallerSupportedFeatures, object>();
+ if (SupportsQuietInstall && ShouldQuietInstall)
+ opts[PackageInstallerSupportedFeatures.UnattendInstall] = true;
+
+ try {
+ PackageInstaller.InstallPackage(opts);
+ } catch(Exception ex) {
+ e.Result = ex;
+ }
+ };
+
+ ret.RunWorkerCompleted += (o,e) => {
+ var ex = e.Result as Exception;
+
+ if (ex != null)
+ ErrorMessage = ex.Message;
+
+ State = (ex != null ? InstallableItemState.Failed : InstallableItemState.Succeeded);
+ };
+
+ return ret;
+ }
+
+
+ //
+ // INotifyPropertyChanged stuff
+ //
+
+ void notifyPropertyChanged(String property)
+ {
+ if (PropertyChanged != null) {
+ PropertyChanged(this, new PropertyChangedEventArgs(property));
+ }
+ }
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+}
+
+// vim: ts=4:sts=4:sw=4:et
Oops, something went wrong.

0 comments on commit 3fd629b

Please sign in to comment.