Esempio n. 1
0
 private void AliasApplications(int aApplicationId, InstalledApplication _targetApplication)
 {
     if (aApplicationId != _targetApplication.ApplicationID)
     {
         lApplicationsDAO.ApplicationSetAlias(aApplicationId, _targetApplication.ApplicationID);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Called to allow the user to select an application to which this application should be aliased
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnBrowseAlias_Click(object sender, EventArgs e)
        {
            FormSelectPublishersAndApplications form = new FormSelectPublishersAndApplications("", "");

            form.SelectionType = SelectApplicationsControl.eSelectionType.singleapplication;
            form.ShowIgnored   = true;
            form.ShowIncluded  = true;

            if (form.ShowDialog() == DialogResult.OK)
            {
                // Set the alias for this application
                ApplicationsDAO lwDataAccess = new ApplicationsDAO();
                lwDataAccess.ApplicationSetAlias(_installedApplication.ApplicationID, form.SelectedApplication().ApplicationID);
                tbAliasedApplication.Text = form.SelectedApplication().Name;
            }
        }
Esempio n. 3
0
        private void UnaliasApplications()
        {
            int    selectedRows = ultraGrid1.Selected.Rows.Count;
            string messageText;

            if (selectedRows == 0)
            {
                MessageBox.Show(
                    "Please select a row from the aliased applications table.",
                    "Alias Applications",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                return;
            }

            messageText = (selectedRows == 1) ? "Are you sure you want to delete this alias?" : "Are you sure you want to delete these aliases?";

            if (MessageBox.Show(messageText, "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            ApplicationsDAO lApplicationsDAO = new ApplicationsDAO();

            string[] lApplicationDetails;
            string   lSourcePublisher;
            string   lSourceName;
            string   lSourceVersion;
            int      lApplicationId;

            foreach (UltraGridRow row in ultraGrid1.Selected.Rows)
            {
                lApplicationDetails = row.Cells[0].Text.Split('|');

                lSourcePublisher = lApplicationDetails[0].Trim();
                lSourceName      = lApplicationDetails[1].Trim();
                lSourceVersion   = lApplicationDetails[2].Trim();

                lApplicationId = lApplicationsDAO.SelectIdByPublisherNameVersion(lSourcePublisher, lSourceName, lSourceVersion);
                lApplicationsDAO.ApplicationSetAlias(lApplicationId, 0);
            }

            RefreshGrid();
        }
Esempio n. 4
0
        private void AliasApplications()
        {
            ApplicationsDAO          lwDataAccess = new ApplicationsDAO();
            ApplicationPublisherList listSelectedPublishers;
            InstalledApplicationList listSelectedApplications;

            selectToAlias.GetSelectedItems(out listSelectedPublishers, out listSelectedApplications);

            // Anything selected?
            // Note that the Publisher list will always be empty as we have requested multiple applications only
            if (listSelectedApplications.Count == 0)
            {
                MessageBox.Show("Please select one or more applications which are to be aliased", "Select Alias Application");
                DialogResult = DialogResult.None;
                return;
            }

            // OK - we must also have the 'target' application selected
            InstalledApplication targetApplication = selectTarget.GetSelectedApplication();

            if (targetApplication == null)
            {
                MessageBox.Show("Please select the target application to which these applications should be aliased", "Select Target Application");
                DialogResult = DialogResult.None;
                return;
            }

            // One last check to make sure that we don't have a single application selected in both lists and it is
            // the same as someone is bound to try it to catch us out
            if ((listSelectedApplications.Count == 1) &&
                (targetApplication.ApplicationID == listSelectedApplications[0].ApplicationID))
            {
                MessageBox.Show("You cannot alias an application to itself, please choose different applications", "Circular Alias");
                DialogResult = DialogResult.None;
                return;
            }

            // ...and we cannot alias an application which is itself already aliased by other applications
            if ((listSelectedApplications.Count == 1) &&
                (lwDataAccess.GetAliasCount(listSelectedApplications[0].ApplicationID) != 0))
            {
                MessageBox.Show("You cannot alias an application which is itself already the target of an alias, please choose different applications", "Circular Alias");
                DialogResult = DialogResult.None;
                return;
            }

            List <string> lAliasedApplications = new List <string>();

            // OK All validation complete - now we have to actually act on the selected applications
            foreach (InstalledApplication application in listSelectedApplications)
            {
                if (application.Version == "" || application.Name.EndsWith(application.Version))
                {
                    lAliasedApplications.Add(application.Name);
                }
                else
                {
                    lAliasedApplications.Add(application.Name + " (" + application.Version + ")");
                }

                if (application.ApplicationID != targetApplication.ApplicationID)
                {
                    lwDataAccess.ApplicationSetAlias(application.ApplicationID, targetApplication.ApplicationID);
                }
            }

            string targetApplicationDisplay = "";

            if (targetApplication.Version == "" || targetApplication.Name.EndsWith(targetApplication.Version))
            {
                targetApplicationDisplay = targetApplication.Name;
            }
            else
            {
                targetApplicationDisplay = targetApplication.Name + " (" + targetApplication.Version + ")";
            }

            MessageBox.Show(
                String.Format("The following application(s) have been successfully aliased to '{0}' "
                              + Environment.NewLine + Environment.NewLine + string.Join("\n", lAliasedApplications.ToArray()), targetApplicationDisplay),
                "Alias Applications",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information);

            PopulatePublisherLists();
            RefreshGrid();
            tabControl1.SelectedTab = tabPage2;
        }