//  Constructors
        //  ============

        public RegistryWorker(IScriptFactory <IScriptStorageModel> scriptFactory, IMessagePrompt messagePrompt, ISettings settings, IIconPicker iconPicker)
        {
            this.scriptFactory = scriptFactory;
            this.messagePrompt = messagePrompt;
            this.settings      = settings;
            this.iconPicker    = iconPicker;
        }
Beispiel #2
0
        //  Events
        //  ======

        /// <exception cref="InvalidOperationException">Ignore.</exception>
        /// <exception cref="System.Security.SecurityException">Ignore.</exception>
        protected async override void OnStartup(StartupEventArgs e)
        {
            if (e.Args.Length == 1 && e.Args[0] == INSTALLER)
            {
                try
                {
                    ProcessStartInfo processStartInfo = new ProcessStartInfo("explorer.exe", ResourceAssembly.Location)
                    {
                        Verb = string.Empty
                    };
                    Process.Start(processStartInfo);
                }
                catch
                {
                }

                Environment.Exit(0);
                return;
            }

            container.AddExtension(new Diagnostic());

            base.OnStartup(e);
            SetUpImplementations();
            messagePrompt = container.Resolve <IMessagePrompt>();
            runner        = container.Resolve <IRunner>();
            settings      = container.Resolve <ISettings>();

            if (settings.JustInstalled)
            {
                settings.Upgrade();
                settings.JustInstalled = false;
                settings.SaveAll();
            }

            if (e.Args.Length == 0)
            {
                ShowMainWindow();
                return;
            }

            if (e.Args.Length >= 3 && (e.Args[0] == "run"))
            {
                await RunScript(e.Args);

                Environment.Exit(0);
                return;
            }

            messagePrompt.PromptOK("Unknown command arguments", "Error", MessageType.Error);
            Environment.Exit(0);
        }
        //  Constructors
        //  ============

        public UpdateWindow(IMessagePrompt messagePrompt, Asset asset)
        {
            downloadFolder   = Path.Combine(Path.GetTempPath(), DownloadFolderName);
            downloadLocation = Path.Combine(downloadFolder, DownloadFileName);

            this.messagePrompt = messagePrompt;
            Asset = asset;

            InitializeComponent();

            updateFound       = new UpdateFound(this);
            updateDownloading = new UpdateDownloading(this);

            MainControl.Content = updateFound;
        }
        //  Constructors
        //  ============

        public WindowsScriptFactory(ISettings settings, IMessagePrompt messagePrompt, IIconPicker iconPicker)
        {
            this.settings      = settings;
            this.messagePrompt = messagePrompt;
            this.iconPicker    = iconPicker;
        }
        //  Constructors
        //  ============

        public BatScriptConfig(string name, string id, ISettings settings, IMessagePrompt messagePrompt, IIconPicker iconPicker) : base(name, id, settings, messagePrompt, iconPicker)
        {
        }
        //  Constructors
        //  ============

        public WindowsUpdater(IMessagePrompt messagePrompt, IJSONConverter jsonConverter)
        {
            this.messagePrompt = messagePrompt;
            this.jsonConverter = jsonConverter;
            restClient         = new RestClient(repoURL);
        }