示例#1
0
        // a user wants to add or update a version information entry within the remote database..
        private void MnuAddUpdateAssembly_Click(object sender, EventArgs e)
        {
            Assembly assembly = null;

            if ((sender.Equals(mnuAddUpdateAssembly) || sender.Equals(tsbUpdateEntry)) &&
                odAssembly.ShowDialog() == DialogResult.OK)
            {
                assembly = Assembly.LoadFile(odAssembly.FileName);
            }
            else if (sender.Equals(mnuThisAssemblyVersion))
            {
                // ..just use the entry assembly..
                assembly = Assembly.GetEntryAssembly();
            }

            if (assembly != null)
            {
                var info = FormDialogAddUpdateAssemblyVersion.ShowDialog(assembly.Location, assembly,
                                                                         out bool archivePreviousEntry, out bool previousLocalizedData);

                var version = gvSoftwareVersions.CurrentRow?.Cells[colVersion.Index].Value.ToString();

                if (info != null)
                {
                    if (info.ID != -1)
                    {
                        if (archivePreviousEntry)
                        {
                            VersionCheck.ArchiveVersion(info.ID);
                            if (previousLocalizedData && version != null)
                            {
                                VersionCheck.PreservePreviousVersionData(version, info.SoftwareVersion, info.ID);
                            }
                            else
                            {
                                VersionCheck.ArchiveVersionHistoryByApplicationId(info.ID, true);
                            }
                        }
                        else
                        {
                            VersionCheck.DeleteVersionHistoryByApplicationId(info.ID);
                        }
                    }

                    VersionCheck.UpdateVersion(assembly, info.DownloadLink, info.IsDirectDownload, info.ReleaseDate,
                                               info.MetaData);
                    ListVersions();
                }
            }
        }
示例#2
0
        private void mnuUpdateVersionManually_Click(object sender, EventArgs e)
        {
            var assemblyName = gvSoftwareVersions.CurrentRow?.Cells[colApp.Index].Value.ToString();

            var versionNew = FormDialogUpdateVersion.ShowDialog();

            var info = FormDialogAddUpdateAssemblyVersion.ShowDialog(assemblyName, versionNew,
                                                                     out bool archivePreviousEntry, out bool previousLocalizedData);

            var version = gvSoftwareVersions.CurrentRow?.Cells[colVersion.Index].Value.ToString();

            if (info != null)
            {
                if (info.ID != -1)
                {
                    if (archivePreviousEntry)
                    {
                        VersionCheck.ArchiveVersion(info.ID);
                        if (previousLocalizedData && version != null)
                        {
                            VersionCheck.PreservePreviousVersionData(version, info.SoftwareVersion, info.ID);
                        }
                        else
                        {
                            VersionCheck.ArchiveVersionHistoryByApplicationId(info.ID, true);
                        }
                    }
                    else
                    {
                        VersionCheck.DeleteVersionHistoryByApplicationId(info.ID);
                    }
                }

                VersionCheck.UpdateVersion(assemblyName, versionNew, info.DownloadLink, info.IsDirectDownload,
                                           info.ReleaseDate,
                                           info.MetaData);
                ListVersions();
            }
        }
示例#3
0
        // a user wants to delete a selected entry in the grid from the remote database..
        private void TsbDeleteSelectedEntry_Click(object sender, EventArgs e)
        {
            if (gvSoftwareVersions.CurrentRow != null)
            {
                // verify that the user wants to delete a software entry from the server's database..
                var(dialogResult, archive, archiveHistory) = FormDialogQueryDeleteArchiveEntry.ShowDialog(this,
                                                                                                          gvSoftwareVersions.CurrentRow.Cells[colApp.Index].Value.ToString());

                var name = gvSoftwareVersions.CurrentRow.Cells[colApp.Index].Value.ToString();

                var id = Convert.ToInt32(gvSoftwareVersions.CurrentRow.Cells[colID.Index].Value);

                if (dialogResult == DialogResult.OK)
                {
                    if (archive)
                    {
                        VersionCheck.ArchiveVersion(id, true);
                    }
                    else
                    {
                        VersionCheck.DeleteSoftwareEntry(name);
                    }

                    if (archiveHistory)
                    {
                        VersionCheck.ArchiveVersionHistoryByApplicationId(id, true);
                    }
                    else
                    {
                        VersionCheck.DeleteVersionHistoryByApplicationId(id);
                    }

                    //VersionCheck.DeleteSoftwareEntry(name);
                }
            }

            ListVersions();
        }