protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            initLogging();
            _log.Debug("STARTUP");
            var settings = new SettingsFactory().Create();

            InstallerService.Initialize(this, settings, getLogger(settings));
            await InstallerService.RunAsync().ConfigureAwait(false);
        }
Exemple #2
0
        public MainWindowViewModel()
        {
            Installer = new InstallerService();

            CopyCommandLineArgs();

            ExtractDeviceInitInfo().Wait();

            AddExistingConnectionInfo();
        }
Exemple #3
0
        public async Task ShowRemoveInstallerConfirmationModal()
        {
            var RemoveInstallerConfirmationModal = Modal.Show <Confirmation>("Are you sure you want to remove this Installer");
            var result = await RemoveInstallerConfirmationModal.Result;

            if (!result.Cancelled)
            {
                await InstallerService.DeleteInstallerAsync(InstallerId);

                await ModalInstance.CloseAsync();
            }
        }
Exemple #4
0
        public frmMain()
        {
            InitializeComponent();
            setTextandImages();
            _databaseService  = new DatabaseService();
            _installerService = new InstallerService();

            _databaseService.ProgressPercent += _databaseService_ProgressPercent;
            _timerStepValue   = 0;
            _timerIsIncrement = true;
            _timer            = new Timer();
            _timer.Interval   = 300;
            _timer.Tick      += _timer_Tick;
        }
        public async Task AddNewInstallerAsync(CreateInstallerRequest InstallerRequest)
        {
            CreateInstallerRequest newInstaller = new CreateInstallerRequest
            {
                FirstName       = InstallerRequest.FirstName,
                LastName        = InstallerRequest.LastName,
                Area            = 0,
                PhoneNumber     = InstallerRequest.PhoneNumber,
                RetailerId      = RetailerId,
                SquareYardPrice = InstallerRequest.SquareYardPrice
            };

            await InstallerService.AddNewInstallerAsync(newInstaller);

            await ModalInstance.CloseAsync();
        }
        public async Task ShowRemoveRetailerModalAsync(Guid RetailerId)
        {
            var DeleteRetailerModal = Modal.Show <Confirmation>("Are you sure you want to delete this Retailer?");
            var result = await DeleteRetailerModal.Result;

            if (!result.Cancelled)
            {
                var Installers = await InstallerService.GetAllInstallersByRetailerIdAsync(RetailerId);

                foreach (var installer in Installers)
                {
                    await InstallerService.DeleteInstallerAsync(installer.Id);
                }
                await RetailerService.DeleteRetailerAsync(RetailerId);
                await Refresh();
            }
        }
        private async Task ResetClickAsync(object sender, RoutedEventArgs e)
        {
            string           msg    = ExtensionText.ResetLog;
            MessageBoxResult answer = MessageBox.Show(msg, Vsix.Name, MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (answer != MessageBoxResult.Yes)
            {
                return;
            }
            Telemetry.ResetInvoked();
            Close();
            try
            {
                await InstallerService.ResetAsync().ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
        }
Exemple #8
0
        public static InstallerService GetInstallerWebService()
        {
            var webService = new InstallerService();

            string url = AppConfigManager.AppConfiguration.GetStringSetting(ConfigKeys.Web_Service);

            if (!String.IsNullOrEmpty(url))
            {
                webService.Url = url;
            }
            else
            {
                webService.Url = "http://www.websitepanel.net/Services/InstallerService.asmx";
            }

            // check if we need to add a proxy to access Internet
            bool useProxy = AppConfigManager.AppConfiguration.GetBooleanSetting(ConfigKeys.Web_Proxy_UseProxy);

            if (useProxy)
            {
                string proxyServer = AppConfigManager.AppConfiguration.Settings[ConfigKeys.Web_Proxy_Address].Value;
                if (!String.IsNullOrEmpty(proxyServer))
                {
                    IWebProxy proxy         = new WebProxy(proxyServer);
                    string    proxyUsername = AppConfigManager.AppConfiguration.Settings[ConfigKeys.Web_Proxy_UserName].Value;
                    string    proxyPassword = AppConfigManager.AppConfiguration.Settings[ConfigKeys.Web_Proxy_Password].Value;
                    if (!String.IsNullOrEmpty(proxyUsername))
                    {
                        proxy.Credentials = new NetworkCredential(proxyUsername, proxyPassword);
                    }
                    webService.Proxy = proxy;
                }
            }

            return(webService);
        }
        public FuseBootstrapperApplication()
        {
            var myViewModel = new InstallerService(this);

            Dispatcher = Dispatcher.CurrentDispatcher;
        }
Exemple #10
0
        /// <summary>
        /// Displays process progress.
        /// </summary>
        public void ShowProcess()
        {
            progressBar.Value = 0;
            lblProcess.Text   = "Downloading installation files...";
            Update();
            try
            {
                string url            = GetCommandLineArgument("url");
                string targetFile     = GetCommandLineArgument("target");
                string fileToDownload = GetCommandLineArgument("file");
                string proxyServer    = GetCommandLineArgument("proxy");
                string user           = GetCommandLineArgument("user");
                string password       = GetCommandLineArgument("password");

                service     = new InstallerService();
                service.Url = url;

                if (!String.IsNullOrEmpty(proxyServer))
                {
                    IWebProxy proxy = new WebProxy(proxyServer);
                    if (!String.IsNullOrEmpty(user))
                    {
                        proxy.Credentials = new NetworkCredential(user, password);
                    }
                    service.Proxy = proxy;
                }

                string destinationFile = Path.GetTempFileName();
                string baseDir         = Path.GetDirectoryName(targetFile);
                // download file
                DownloadFile(fileToDownload, destinationFile, progressBar);
                progressBar.Value = 100;

                // unzip file
                lblProcess.Text   = "Unzipping files...";
                progressBar.Value = 0;

                UnzipFile(destinationFile, baseDir, progressBar);
                progressBar.Value = 100;

                FileUtils.DeleteFile(destinationFile);
                ProcessStartInfo info = new ProcessStartInfo();
                info.FileName  = targetFile;
                info.Arguments = "nocheck";
                //info.WindowStyle = ProcessWindowStyle.Normal;
                Process process = Process.Start(info);
                //activate window
                if (process.Handle != IntPtr.Zero)
                {
                    User32.SetForegroundWindow(process.Handle);

                    /*if (User32.IsIconic(process.Handle))
                     * {
                     *      User32.ShowWindowAsync(process.Handle, User32.SW_RESTORE);
                     * }
                     * else
                     * {
                     *      User32.ShowWindowAsync(process.Handle, User32.SW_SHOWNORMAL);
                     * }*/
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }
                string message = ex.ToString();

                ShowError();
                return;
            }
        }
Exemple #11
0
        public async Task Refresh()
        {
            Retailer = await RetailerService.GetOneRetailerAsync(RetailerId);

            Installers = await InstallerService.GetAllInstallersByRetailerIdAsync(RetailerId);
        }
Exemple #12
0
 public async Task Refresh()
 {
     Installer = await InstallerService.GetOneInstallerAsync(InstallerId);
 }
 public MainWindowViewModel()
 {
     Installer = new InstallerService();
 }
 public void Confirm(UpdateInstallerRequest installerRequest)
 {
     InstallerService.UpdateInstallerAsync(installerRequest);
     ModalInstance.CloseAsync();
 }
Exemple #15
0
        /// <summary>
        /// Displays process progress.
        /// </summary>
        public void ShowProcess()
        {
            progressBar.Value = 0;
            try
            {
                service = appContext.AppForm.WebService;
                string dataFolder = FileUtils.GetDataDirectory();
                string tmpFolder  = FileUtils.GetTempDirectory();

                if (!Directory.Exists(dataFolder))
                {
                    Directory.CreateDirectory(dataFolder);
                    Log.WriteInfo("Data directory created");
                }

                if (Directory.Exists(tmpFolder))
                {
                    FileUtils.DeleteTempDirectory();
                }

                if (!Directory.Exists(tmpFolder))
                {
                    Directory.CreateDirectory(tmpFolder);
                    Log.WriteInfo("Tmp directory created");
                }

                string fileToDownload = null;
                if (!string.IsNullOrEmpty(localFile))
                {
                    fileToDownload = localFile;
                }
                else
                {
                    fileToDownload = Path.GetFileName(remoteFile);
                }

                string destinationFile = Path.Combine(dataFolder, fileToDownload);
                string tmpFile         = Path.Combine(tmpFolder, fileToDownload);


                //check whether file already downloaded
                if (!File.Exists(destinationFile))
                {
                    if (string.IsNullOrEmpty(remoteFile))
                    {
                        //need to get remote file name
                        lblProcess.Text   = "Connecting...";
                        progressBar.Value = 0;
                        DataSet ds = service.GetReleaseFileInfo(componentCode, version);
                        progressBar.Value = 100;
                        if (ds != null &&
                            ds.Tables.Count > 0 &&
                            ds.Tables[0].Rows.Count > 0)
                        {
                            DataRow row = ds.Tables[0].Rows[0];
                            remoteFile      = row["FullFilePath"].ToString();
                            fileToDownload  = Path.GetFileName(remoteFile);
                            destinationFile = Path.Combine(dataFolder, fileToDownload);
                            tmpFile         = Path.Combine(tmpFolder, fileToDownload);
                        }
                        else
                        {
                            throw new Exception("Installer not found");
                        }
                    }

                    // download file to tmp folder
                    lblProcess.Text   = "Downloading setup files...";
                    progressBar.Value = 0;
                    DownloadFile(remoteFile, tmpFile, progressBar);
                    progressBar.Value = 100;

                    // copy downloaded file to data folder
                    lblProcess.Text   = "Copying setup files...";
                    progressBar.Value = 0;
                    // Ensure that the target does not exist.
                    if (File.Exists(destinationFile))
                    {
                        FileUtils.DeleteFile(destinationFile);
                    }
                    File.Move(tmpFile, destinationFile);
                    progressBar.Value = 100;
                }

                // unzip file
                lblProcess.Text   = "Please wait while Setup prepares the necessary files...";
                progressBar.Value = 0;
                UnzipFile(destinationFile, tmpFolder, progressBar);
                progressBar.Value = 100;

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }

                Log.WriteError("Installer error", ex);
                appContext.AppForm.ShowError(ex);
                this.DialogResult = DialogResult.Abort;
                this.Close();
            }
        }