Ejemplo n.º 1
0
        public override DeployDialog GetNextDialog()
        {
            progressInstall.Minimum = 0;
            progressInstall.Maximum = flpApplication.Controls.Count;
            progressInstall.Value   = 0;
            progressInstall.Visible = true;

            foreach (Control item in flpApplication.Controls)
            {
                progressInstall.Value++;
                progressInstall.Update();

                IInstallationPackage package = (IInstallationPackage)((ApplicationCtrl)item).Tag;
                int action = PerformPackageAction(package, (ApplicationCtrl)item);
                ((ApplicationCtrl)item).InAction = false;
                item.Update();
                if (action == 2)
                {
                    ((ApplicationCtrl)item).StatusName = CheckState.FAILED.ToString();
                    break;
                }
                if (action == 1)
                {
                    ((ApplicationCtrl)item).State      = Localizer.GetBestTranslation("Install_stateInstalled");
                    ((ApplicationCtrl)item).Action     = Localizer.GetBestTranslation("Install_actionNothing");
                    ((ApplicationCtrl)item).StatusName = CheckState.COMPLETE.ToString();
                }
                item.Update();
                progressInstall.Update();
            }
            // PopulateListView();
            progressInstall.Visible = false;
            return(DialogFlowHandler.Instance.GetDialogInstance(DialogType.Finished));
        }
Ejemplo n.º 2
0
 public override DeployDialog GetNextDialog()
 {
     foreach (ListViewItem item in listView.Items)
     {
         IInstallationPackage package = (IInstallationPackage)item.Tag;
         int action = PerformPackageAction(package, item);
         item.UseItemStyleForSubItems = false;
         item.SubItems[1].Font        = new Font(item.SubItems[1].Font, FontStyle.Regular);
         listView.Update();
         if (action == 2)
         {
             break;
         }
         if (action == 1)
         {
             item.SubItems[1].Text = Localizer.GetBestTranslation("Install_stateInstalled");
             item.SubItems[2].Text = Localizer.GetBestTranslation("Install_actionNothing");
             item.ImageIndex       = 0;
         }
     }
     PopulateListView();
     return(DialogFlowHandler.Instance.GetDialogInstance(DialogType.Finished));
 }
Ejemplo n.º 3
0
    private void AddPackageToListView(IInstallationPackage package)
    {
      listView.SmallImageList = iconsList;
      ListViewItem item = listView.Items.Add(package.GetDisplayName());
      item.Tag = package;
      CheckResult result = package.CheckStatus();
      switch (result.state)
      {
        case CheckState.INSTALLED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateInstalled"));
          item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
          item.ImageIndex = 0;
          break;
        case CheckState.NOT_INSTALLED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateNotInstalled"));
          if (result.needsDownload)
            item.SubItems.Add(Localizer.GetBestTranslation("Install_actionDownloadInstall"));
          else
            item.SubItems.Add(Localizer.GetBestTranslation("Install_actionInstall"));
          item.ImageIndex = 1;
          break;
        case CheckState.CONFIGURED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateConfigured"));
          item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
          item.ImageIndex = 0;
          break;
        case CheckState.NOT_CONFIGURED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateNotConfigured"));
          item.SubItems.Add(Localizer.GetBestTranslation("Install_actionConfigure"));
          item.ImageIndex = 1;
          break;
        case CheckState.REMOVED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateRemoved"));
          item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
          item.ImageIndex = 0;
          break;
        case CheckState.NOT_REMOVED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateUninstall"));
          item.SubItems.Add(Localizer.GetBestTranslation("Install_actionRemove"));
          item.ImageIndex = 1;
          break;
        case CheckState.DOWNLOADED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateDownloaded"));
          item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
          item.ImageIndex = 0;
          break;
        case CheckState.NOT_DOWNLOADED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateNotDownloaded"));
          item.SubItems.Add(Localizer.GetBestTranslation("Install_actionDownload"));
          item.ImageIndex = 1;
          break;
        case CheckState.VERSION_MISMATCH:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateVersionMismatch"));
          if (result.needsDownload)
            item.SubItems.Add(Localizer.GetBestTranslation("Install_actionUninstallDownloadInstall"));
          else
          {
            if (InstallationProperties.Instance["UpdateMode"] == "yes")
            {
              item.SubItems.Add(Localizer.GetBestTranslation("Install_actionUpgradeInstall"));
            }
            else
            {
              item.SubItems.Add(Localizer.GetBestTranslation("Install_actionUninstallInstall"));
            }
          }

          item.ImageIndex = 2;
          break;
        case CheckState.SKIPPED:
          item.SubItems.Add(Localizer.GetBestTranslation("Install_stateSkipped"));
          item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
          item.ImageIndex = 0;
          break;
      }
    }
Ejemplo n.º 4
0
    private int PerformPackageAction(IInstallationPackage package, ListViewItem item)
    {
      //
      // return 0: nothing to do
      //        1: install successufull
      //        2: install error
      //
      CheckResult result = package.CheckStatus();
      if (result.state != CheckState.INSTALLED &&
          result.state != CheckState.REMOVED &&
          result.state != CheckState.DOWNLOADED &&
          result.state != CheckState.SKIPPED)
      {
        item.UseItemStyleForSubItems = false;
        item.SubItems[1].Font = new Font(item.SubItems[1].Font, FontStyle.Bold);
        switch (result.state)
        {
          case CheckState.NOT_INSTALLED:
            if (result.needsDownload)
            {
              item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgDownloading");
              listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
              listView.Update();
              if (!package.Download())
              {
                Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                             package.GetDisplayName()));
                return 2;
              }
            }
            item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgInstalling");
            listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView.Update();
            if (!package.Install())
            {
              Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                           package.GetDisplayName()));
              return 2;
            }
            break;

          case CheckState.NOT_CONFIGURED:
            item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgConfiguring");
            listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView.Update();
            if (!package.Install())
            {
              Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errConfigureFailed"),
                                           package.GetDisplayName()));
              return 2;
            }
            break;

          case CheckState.NOT_REMOVED:
            item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgUninstalling");
            listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView.Update();
            if (!package.Install())
            {
              Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errRemoveFailed"),
                                           package.GetDisplayName()));
              return 2;
            }
            break;

          case CheckState.VERSION_MISMATCH:
            item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgUninstalling");
            listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView.Update();
            if (!package.UnInstall())
            {
              Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errUinstallFailed"),
                                           package.GetDisplayName()));
              return 2;
            }
            if (result.needsDownload)
            {
              item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgDownloading");
              listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
              listView.Update();
              if (!package.Download())
              {
                Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errDownloadFailed"),
                                             package.GetDisplayName()));
                return 2;
              }
            }
            item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgInstalling");
            listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView.Update();
            if (!package.Install())
            {
              Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                           package.GetDisplayName()));
              return 2;
            }
            break;

          case CheckState.NOT_DOWNLOADED:
            item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgDownloading");
            listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView.Update();
            if (!package.Download())
            {
              Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errDownloadFailed"),
                                           package.GetDisplayName()));
              return 2;
            }
            break;
        }
        return 1;
      }
      return 0;
    }
Ejemplo n.º 5
0
        private void AddPackageToListView(IInstallationPackage package)
        {
            listView.SmallImageList = iconsList;
            ListViewItem item = listView.Items.Add(package.GetDisplayName());

            item.Tag = package;
            CheckResult result = package.CheckStatus();

            switch (result.state)
            {
            case CheckState.INSTALLED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateInstalled"));
                item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
                item.ImageIndex = 0;
                break;

            case CheckState.NOT_INSTALLED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateNotInstalled"));
                if (result.needsDownload)
                {
                    item.SubItems.Add(Localizer.GetBestTranslation("Install_actionDownloadInstall"));
                }
                else
                {
                    item.SubItems.Add(Localizer.GetBestTranslation("Install_actionInstall"));
                }
                item.ImageIndex = 1;
                break;

            case CheckState.CONFIGURED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateConfigured"));
                item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
                item.ImageIndex = 0;
                break;

            case CheckState.NOT_CONFIGURED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateNotConfigured"));
                item.SubItems.Add(Localizer.GetBestTranslation("Install_actionConfigure"));
                item.ImageIndex = 1;
                break;

            case CheckState.REMOVED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateRemoved"));
                item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
                item.ImageIndex = 0;
                break;

            case CheckState.NOT_REMOVED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateUninstall"));
                item.SubItems.Add(Localizer.GetBestTranslation("Install_actionRemove"));
                item.ImageIndex = 1;
                break;

            case CheckState.DOWNLOADED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateDownloaded"));
                item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
                item.ImageIndex = 0;
                break;

            case CheckState.NOT_DOWNLOADED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateNotDownloaded"));
                item.SubItems.Add(Localizer.GetBestTranslation("Install_actionDownload"));
                item.ImageIndex = 1;
                break;

            case CheckState.VERSION_MISMATCH:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateVersionMismatch"));
                if (result.needsDownload)
                {
                    item.SubItems.Add(Localizer.GetBestTranslation("Install_actionUninstallDownloadInstall"));
                }
                else
                {
                    if (InstallationProperties.Instance["UpdateMode"] == "yes")
                    {
                        item.SubItems.Add(Localizer.GetBestTranslation("Install_actionUpgradeInstall"));
                    }
                    else
                    {
                        item.SubItems.Add(Localizer.GetBestTranslation("Install_actionUninstallInstall"));
                    }
                }

                item.ImageIndex = 2;
                break;

            case CheckState.SKIPPED:
                item.SubItems.Add(Localizer.GetBestTranslation("Install_stateSkipped"));
                item.SubItems.Add(Localizer.GetBestTranslation("Install_actionNothing"));
                item.ImageIndex = 0;
                break;
            }
        }
Ejemplo n.º 6
0
        private int PerformPackageAction(IInstallationPackage package, ListViewItem item)
        {
            //
            // return 0: nothing to do
            //        1: install successufull
            //        2: install error
            //
            CheckResult result = package.CheckStatus();

            if (result.state != CheckState.INSTALLED &&
                result.state != CheckState.REMOVED &&
                result.state != CheckState.DOWNLOADED &&
                result.state != CheckState.SKIPPED)
            {
                item.UseItemStyleForSubItems = false;
                item.SubItems[1].Font        = new Font(item.SubItems[1].Font, FontStyle.Bold);
                switch (result.state)
                {
                case CheckState.NOT_INSTALLED:
                    if (result.needsDownload)
                    {
                        item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgDownloading");
                        listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                        listView.Update();
                        if (!package.Download())
                        {
                            Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                                         package.GetDisplayName()));
                            return(2);
                        }
                    }
                    item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgInstalling");
                    listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    listView.Update();
                    if (!package.Install())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;

                case CheckState.NOT_CONFIGURED:
                    item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgConfiguring");
                    listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    listView.Update();
                    if (!package.Install())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errConfigureFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;

                case CheckState.NOT_REMOVED:
                    item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgUninstalling");
                    listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    listView.Update();
                    if (!package.Install())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errRemoveFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;

                case CheckState.VERSION_MISMATCH:
                    item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgUninstalling");
                    listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    listView.Update();
                    if (!package.UnInstall())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errUinstallFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    if (result.needsDownload)
                    {
                        item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgDownloading");
                        listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                        listView.Update();
                        if (!package.Download())
                        {
                            Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errDownloadFailed"),
                                                         package.GetDisplayName()));
                            return(2);
                        }
                    }
                    item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgInstalling");
                    listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    listView.Update();
                    if (!package.Install())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;

                case CheckState.NOT_DOWNLOADED:
                    item.SubItems[1].Text = Localizer.GetBestTranslation("Install_msgDownloading");
                    listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    listView.Update();
                    if (!package.Download())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errDownloadFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;
                }
                return(1);
            }
            return(0);
        }
Ejemplo n.º 7
0
        private int PerformPackageAction(IInstallationPackage package, ApplicationCtrl item)
        {
            //
            // return 0: nothing to do
            //        1: install successufull
            //        2: install error
            //
            if (package == null)
            {
                return(2);
            }
            CheckResult result = package.CheckStatus();

            if (result.state != CheckState.INSTALLED &&
                result.state != CheckState.REMOVED &&
                result.state != CheckState.DOWNLOADED &&
                result.state != CheckState.SKIPPED)
            {
                item.InAction   = true;
                item.StatusName = CheckState.PROGRESS.ToString();
                switch (result.state)
                {
                case CheckState.NOT_INSTALLED:
                    if (result.needsDownload)
                    {
                        item.Action = Localizer.GetBestTranslation("Install_msgDownloading");
                        item.Update();
                        if (!package.Download())
                        {
                            Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                                         package.GetDisplayName()));
                            return(2);
                        }
                    }
                    item.Action = Localizer.GetBestTranslation("Install_msgInstalling");
                    item.Update();
                    if (!package.Install())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;

                case CheckState.NOT_CONFIGURED:
                    item.Action = Localizer.GetBestTranslation("Install_msgConfiguring");
                    item.Update();
                    if (!package.Install())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errConfigureFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;

                case CheckState.NOT_REMOVED:
                    item.Action = Localizer.GetBestTranslation("Install_msgUninstalling");
                    item.Update();
                    if (!package.Install())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errRemoveFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;

                case CheckState.VERSION_MISMATCH:
                    item.Action = Localizer.GetBestTranslation("Install_msgUninstalling");
                    item.Update();
                    if (!package.UnInstall())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errUinstallFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    if (result.needsDownload)
                    {
                        item.Action = Localizer.GetBestTranslation("Install_msgDownloading");
                        item.Update();
                        if (!package.Download())
                        {
                            Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errDownloadFailed"),
                                                         package.GetDisplayName()));
                            return(2);
                        }
                    }
                    item.Action = Localizer.GetBestTranslation("Install_msgInstalling");
                    item.Update();
                    if (!package.Install())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errInstallFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;

                case CheckState.NOT_DOWNLOADED:
                    item.Action = Localizer.GetBestTranslation("Install_msgDownloading");
                    item.Update();
                    if (!package.Download())
                    {
                        Utils.ErrorDlg(string.Format(Localizer.GetBestTranslation("Install_errDownloadFailed"),
                                                     package.GetDisplayName()));
                        return(2);
                    }
                    break;
                }
                return(1);
            }
            item.StatusName = result.state.ToString();
            return(0);
        }
Ejemplo n.º 8
0
        private void AddPackageToListView(IInstallationPackage package)
        {
            ApplicationCtrl item = new ApplicationCtrl();

            item.Name     = package.GetDisplayName();
            item.IconName = package.GetIconName();
            item.Tag      = package;
            CheckResult result = package.CheckStatus();

            item.StatusName = result.state.ToString();
            switch (result.state)
            {
            case CheckState.INSTALLED:
                item.State  = Localizer.GetBestTranslation("Install_stateInstalled");
                item.Action = Localizer.GetBestTranslation("Install_actionNothing");
                break;

            case CheckState.NOT_INSTALLED:
                item.State = Localizer.GetBestTranslation("Install_stateNotInstalled");
                if (result.needsDownload)
                {
                    item.Action = Localizer.GetBestTranslation("Install_actionDownloadInstall");
                }
                else
                {
                    item.Action = Localizer.GetBestTranslation("Install_actionInstall");
                }
                break;

            case CheckState.CONFIGURED:
                item.State  = Localizer.GetBestTranslation("Install_stateConfigured");
                item.Action = Localizer.GetBestTranslation("Install_actionNothing");
                break;

            case CheckState.NOT_CONFIGURED:
                item.State  = Localizer.GetBestTranslation("Install_stateNotConfigured");
                item.Action = Localizer.GetBestTranslation("Install_actionConfigure");
                break;

            case CheckState.REMOVED:
                item.State  = Localizer.GetBestTranslation("Install_stateRemoved");
                item.Action = Localizer.GetBestTranslation("Install_actionNothing");
                break;

            case CheckState.NOT_REMOVED:
                item.State  = Localizer.GetBestTranslation("Install_stateUninstall");
                item.Action = Localizer.GetBestTranslation("Install_actionRemove");
                break;

            case CheckState.DOWNLOADED:
                item.State  = Localizer.GetBestTranslation("Install_stateDownloaded");
                item.Action = Localizer.GetBestTranslation("Install_actionNothing");
                break;

            case CheckState.NOT_DOWNLOADED:
                item.State  = Localizer.GetBestTranslation("Install_stateNotDownloaded");
                item.Action = Localizer.GetBestTranslation("Install_actionDownload");
                break;

            case CheckState.VERSION_MISMATCH:
                item.State = Localizer.GetBestTranslation("Install_stateVersionMismatch");
                if (result.needsDownload)
                {
                    item.Action = Localizer.GetBestTranslation("Install_actionUninstallDownloadInstall");
                }
                else
                {
                    if (InstallationProperties.Instance["UpdateMode"] == "yes")
                    {
                        item.Action = Localizer.GetBestTranslation("Install_actionUpgradeInstall");
                    }
                    else
                    {
                        item.Action = Localizer.GetBestTranslation("Install_actionUninstallInstall");
                    }
                }
                break;

            case CheckState.SKIPPED:
                item.State  = Localizer.GetBestTranslation("Install_stateSkipped");
                item.Action = Localizer.GetBestTranslation("Install_actionNothing");
                break;
            }
            flpApplication.Controls.Add(item);
        }